Commit c5bc38df authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Add QDeclarativeItem as base class for NewClassWidget.

parent 2ec67765
......@@ -407,6 +407,9 @@ static inline NewClassWidget::ClassType classTypeForBaseClass(const QString &bas
if (baseClass == QLatin1String("QWidget") || baseClass == QLatin1String("QMainWindow")
|| baseClass == QLatin1String("QDialog"))
return NewClassWidget::ClassInheritsQWidget;
// Declarative Items
if (baseClass == QLatin1String("QDeclarativeItem"))
return NewClassWidget::ClassInheritsQDeclarativeItem;
return NewClassWidget::NoClassType;
}
......
......@@ -78,6 +78,7 @@ class QTCREATOR_UTILS_EXPORT NewClassWidget : public QWidget
Q_ENUMS(ClassType)
public:
enum ClassType { NoClassType, ClassInheritsQObject, ClassInheritsQWidget,
ClassInheritsQDeclarativeItem,
SharedDataClass };
explicit NewClassWidget(QWidget *parent = 0);
......
......@@ -69,6 +69,11 @@
<string>Inherits QWidget</string>
</property>
</item>
<item>
<property name="text">
<string>Inherits QDeclarativeItem</string>
</property>
</item>
<item>
<property name="text">
<string>Based on QSharedData</string>
......@@ -175,7 +180,7 @@
</widget>
</item>
<item row="8" column="1">
<widget class="Utils::PathChooser" name="pathChooser" native="true"/>
<widget class="Utils::PathChooser" name="pathChooser"/>
</item>
</layout>
</widget>
......
......@@ -69,7 +69,8 @@ ClassNamePage::ClassNamePage(QWidget *parent) :
m_newClassWidget->setBaseClassChoices(QStringList() << QString()
<< QLatin1String("QObject")
<< QLatin1String("QWidget")
<< QLatin1String("QMainWindow"));
<< QLatin1String("QMainWindow")
<< QLatin1String("QDeclarativeItem"));
m_newClassWidget->setBaseClassEditable(true);
m_newClassWidget->setFormInputVisible(false);
m_newClassWidget->setNamespacesEnabled(true);
......@@ -257,6 +258,13 @@ bool CppClassWizard::generateHeaderAndSource(const CppClassWizardParameters &par
parentQObjectClass = QLatin1String("QWidget");
defineQObjectMacro = true;
break;
case Utils::NewClassWidget::ClassInheritsQDeclarativeItem:
parentQObjectClass = QLatin1String("QDeclarativeItem");
defineQObjectMacro = true;
break;
case Utils::NewClassWidget::NoClassType:
case Utils::NewClassWidget::SharedDataClass:
break;
}
const QString baseClass = params.baseClass.isEmpty()
&& params.classType != Utils::NewClassWidget::NoClassType ?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment