forked from qt-creator/qt-creator
Designer: Remove further dead code from newclasswidget.*
The feature with base classes and class types was disabled by hiding the respective ui fields. Also, the code to handle these features is very incomplete. This change removes these ui fileds and unused code remnands. Change-Id: I27c3288e4937f0d605da85b2f33aba640dcf7371 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -48,11 +48,6 @@ NewClassWidget::NewClassWidget(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
d->m_ui.setupUi(this);
|
d->m_ui.setupUi(this);
|
||||||
|
|
||||||
d->m_ui.baseClassLabel->setVisible(false);
|
|
||||||
d->m_ui.baseClassComboBox->setVisible(false);
|
|
||||||
d->m_ui.classTypeLabel->setVisible(false);
|
|
||||||
d->m_ui.classTypeComboBox->setVisible(false);
|
|
||||||
|
|
||||||
d->m_ui.classLineEdit->setNamespacesEnabled(true);
|
d->m_ui.classLineEdit->setNamespacesEnabled(true);
|
||||||
setNamesDelimiter(QLatin1String("::"));
|
setNamesDelimiter(QLatin1String("::"));
|
||||||
|
|
||||||
@@ -60,10 +55,6 @@ NewClassWidget::NewClassWidget(QWidget *parent) :
|
|||||||
this, &NewClassWidget::slotUpdateFileNames);
|
this, &NewClassWidget::slotUpdateFileNames);
|
||||||
connect(d->m_ui.classLineEdit, &QLineEdit::textEdited,
|
connect(d->m_ui.classLineEdit, &QLineEdit::textEdited,
|
||||||
this, &NewClassWidget::classNameEdited);
|
this, &NewClassWidget::classNameEdited);
|
||||||
connect(d->m_ui.baseClassComboBox, &QComboBox::currentIndexChanged,
|
|
||||||
this, &NewClassWidget::suggestClassNameFromBase);
|
|
||||||
connect(d->m_ui.baseClassComboBox, &QComboBox::editTextChanged,
|
|
||||||
this, &NewClassWidget::slotValidChanged);
|
|
||||||
connect(d->m_ui.classLineEdit, &Utils::FancyLineEdit::validChanged,
|
connect(d->m_ui.classLineEdit, &Utils::FancyLineEdit::validChanged,
|
||||||
this, &NewClassWidget::slotValidChanged);
|
this, &NewClassWidget::slotValidChanged);
|
||||||
connect(d->m_ui.headerFileLineEdit, &Utils::FancyLineEdit::validChanged,
|
connect(d->m_ui.headerFileLineEdit, &Utils::FancyLineEdit::validChanged,
|
||||||
@@ -87,8 +78,6 @@ NewClassWidget::NewClassWidget(QWidget *parent) :
|
|||||||
this, &NewClassWidget::slotActivated);
|
this, &NewClassWidget::slotActivated);
|
||||||
connect(d->m_ui.pathChooser, &Utils::PathChooser::returnPressed,
|
connect(d->m_ui.pathChooser, &Utils::PathChooser::returnPressed,
|
||||||
this, &NewClassWidget::slotActivated);
|
this, &NewClassWidget::slotActivated);
|
||||||
|
|
||||||
setClassType(NoClassType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NewClassWidget::~NewClassWidget()
|
NewClassWidget::~NewClassWidget()
|
||||||
@@ -103,20 +92,6 @@ void NewClassWidget::classNameEdited()
|
|||||||
d->m_classEdited = true;
|
d->m_classEdited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewClassWidget::suggestClassNameFromBase()
|
|
||||||
{
|
|
||||||
if (debugNewClassWidget)
|
|
||||||
qDebug() << Q_FUNC_INFO << d->m_headerExtension << d->m_sourceExtension;
|
|
||||||
if (d->m_classEdited)
|
|
||||||
return;
|
|
||||||
// Suggest a class unless edited ("QMainWindow"->"MainWindow")
|
|
||||||
QString base = baseClassName();
|
|
||||||
if (base.startsWith(QLatin1Char('Q'))) {
|
|
||||||
base.remove(0, 1);
|
|
||||||
setClassName(base);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewClassWidget::setClassName(const QString &suggestedName)
|
void NewClassWidget::setClassName(const QString &suggestedName)
|
||||||
{
|
{
|
||||||
if (debugNewClassWidget)
|
if (debugNewClassWidget)
|
||||||
@@ -130,11 +105,6 @@ QString NewClassWidget::className() const
|
|||||||
return d->m_ui.classLineEdit->text();
|
return d->m_ui.classLineEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NewClassWidget::baseClassName() const
|
|
||||||
{
|
|
||||||
return d->m_ui.baseClassComboBox->currentText();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString NewClassWidget::sourceFileName() const
|
QString NewClassWidget::sourceFileName() const
|
||||||
{
|
{
|
||||||
return d->m_ui.sourceFileLineEdit->text();
|
return d->m_ui.sourceFileLineEdit->text();
|
||||||
@@ -195,11 +165,6 @@ void NewClassWidget::setLowerCaseFiles(bool v)
|
|||||||
d->m_ui.classLineEdit->setLowerCaseFileName(v);
|
d->m_ui.classLineEdit->setLowerCaseFileName(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewClassWidget::setClassType(ClassType ct)
|
|
||||||
{
|
|
||||||
d->m_ui.classTypeComboBox->setCurrentIndex(ct);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewClassWidget::setNamesDelimiter(const QString &delimiter)
|
void NewClassWidget::setNamesDelimiter(const QString &delimiter)
|
||||||
{
|
{
|
||||||
d->m_ui.classLineEdit->setNamespaceDelimiter(delimiter);
|
d->m_ui.classLineEdit->setNamespaceDelimiter(delimiter);
|
||||||
|
@@ -16,19 +16,10 @@ class NewClassWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum ClassType { NoClassType,
|
|
||||||
ClassInheritsQObject,
|
|
||||||
ClassInheritsQWidget,
|
|
||||||
ClassInheritsQDeclarativeItem,
|
|
||||||
ClassInheritsQQuickItem,
|
|
||||||
SharedDataClass
|
|
||||||
};
|
|
||||||
Q_ENUM(ClassType)
|
|
||||||
explicit NewClassWidget(QWidget *parent = nullptr);
|
explicit NewClassWidget(QWidget *parent = nullptr);
|
||||||
~NewClassWidget() override;
|
~NewClassWidget() override;
|
||||||
|
|
||||||
QString className() const;
|
QString className() const;
|
||||||
QString baseClassName() const;
|
|
||||||
QString sourceFileName() const;
|
QString sourceFileName() const;
|
||||||
QString headerFileName() const;
|
QString headerFileName() const;
|
||||||
QString formFileName() const;
|
QString formFileName() const;
|
||||||
@@ -56,16 +47,8 @@ public slots:
|
|||||||
void setSourceExtension(const QString &e);
|
void setSourceExtension(const QString &e);
|
||||||
void setHeaderExtension(const QString &e);
|
void setHeaderExtension(const QString &e);
|
||||||
void setLowerCaseFiles(bool v);
|
void setLowerCaseFiles(bool v);
|
||||||
void setClassType(ClassType ct);
|
|
||||||
void setNamesDelimiter(const QString &delimiter);
|
void setNamesDelimiter(const QString &delimiter);
|
||||||
|
|
||||||
/**
|
|
||||||
* Suggest a class name from the base class by stripping the leading 'Q'
|
|
||||||
* character. This will happen automagically if the base class combo
|
|
||||||
* changes until the class line edited is manually edited.
|
|
||||||
*/
|
|
||||||
void suggestClassNameFromBase();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void slotUpdateFileNames(const QString &t);
|
void slotUpdateFileNames(const QString &t);
|
||||||
void slotValidChanged();
|
void slotValidChanged();
|
||||||
|
@@ -40,102 +40,6 @@
|
|||||||
<widget class="Utils::ClassNameValidatingLineEdit" name="classLineEdit"/>
|
<widget class="Utils::ClassNameValidatingLineEdit" name="classLineEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="baseClassLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Base class:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>baseClassComboBox</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="baseClassComboBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="classTypeLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Type information:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>classTypeComboBox</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QComboBox" name="classTypeComboBox">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>None</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Inherits QObject</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Inherits QWidget</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Inherits QDeclarativeItem - Qt Quick 1</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Inherits QQuickItem - Qt Quick 2</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Based on QSharedData</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<spacer name="verticalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="headerLabel">
|
<widget class="QLabel" name="headerLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Header file:</string>
|
<string>&Header file:</string>
|
||||||
@@ -145,10 +49,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="Utils::FileNameValidatingLineEdit" name="headerFileLineEdit"/>
|
<widget class="Utils::FileNameValidatingLineEdit" name="headerFileLineEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="sourceLabel">
|
<widget class="QLabel" name="sourceLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Source file:</string>
|
<string>&Source file:</string>
|
||||||
@@ -158,10 +62,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="Utils::FileNameValidatingLineEdit" name="sourceFileLineEdit"/>
|
<widget class="Utils::FileNameValidatingLineEdit" name="sourceFileLineEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="formLabel">
|
<widget class="QLabel" name="formLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Form file:</string>
|
<string>&Form file:</string>
|
||||||
@@ -171,10 +75,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="Utils::FileNameValidatingLineEdit" name="formFileLineEdit"/>
|
<widget class="Utils::FileNameValidatingLineEdit" name="formFileLineEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="pathLabel">
|
<widget class="QLabel" name="pathLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Path:</string>
|
<string>&Path:</string>
|
||||||
@@ -184,7 +88,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="Utils::PathChooser" name="pathChooser" native="true"/>
|
<widget class="Utils::PathChooser" name="pathChooser" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
Reference in New Issue
Block a user