diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-06-25 13:49:53 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-06-25 13:49:53 (GMT) |
commit | db8f05e257019694f5e8076845626008f2adc3dd (patch) | |
tree | 05d3959403cf15ac5f702091439e028af01f343b /demos/arthurplugin | |
parent | 8aafaa65a1d16f8b982279f5aceedf1e281ddb5a (diff) | |
parent | 796a5a2c7d8c91a46ac761dde18b7da2ec6c177b (diff) | |
download | Qt-db8f05e257019694f5e8076845626008f2adc3dd.zip Qt-db8f05e257019694f5e8076845626008f2adc3dd.tar.gz Qt-db8f05e257019694f5e8076845626008f2adc3dd.tar.bz2 |
Merge commit 'qt/master-stable' into 4.6-stable
Bring Qt 4.6 into the Qt-S60 repo.
Conflicts:
configure.exe
mkspecs/features/qttest_p4.prf
qmake/generators/makefile.cpp
src/corelib/io/qdir.cpp
src/corelib/io/qprocess.h
src/corelib/kernel/qcoreevent.h
src/corelib/kernel/qobject.cpp
src/corelib/kernel/qsharedmemory_unix.cpp
src/corelib/thread/qthread_p.h
src/corelib/tools/qvector.h
src/gui/dialogs/qdialog.cpp
src/gui/dialogs/qfiledialog.cpp
src/gui/dialogs/qfiledialog_p.h
src/gui/dialogs/qmessagebox.cpp
src/gui/graphicsview/qgraphicsitem.cpp
src/gui/graphicsview/qgraphicsview.cpp
src/gui/image/qpixmapcache.cpp
src/gui/kernel/qapplication.cpp
src/gui/kernel/qapplication_p.h
src/gui/kernel/qwidget.cpp
src/gui/kernel/qwidget_p.h
src/gui/painting/qdrawhelper.cpp
src/gui/painting/qpaintengine_raster.cpp
src/gui/text/qfontengine_qpf.cpp
src/gui/widgets/qmenubar.cpp
src/network/socket/qlocalserver.cpp
src/testlib/qtestcase.cpp
src/testlib/testlib.pro
tests/auto/qimagereader/tst_qimagereader.cpp
tests/auto/qitemdelegate/tst_qitemdelegate.cpp
tests/auto/qnetworkreply/tst_qnetworkreply.cpp
tests/auto/qpixmap/qpixmap.pro
Diffstat (limited to 'demos/arthurplugin')
-rw-r--r-- | demos/arthurplugin/plugin.cpp | 74 |
1 files changed, 54 insertions, 20 deletions
diff --git a/demos/arthurplugin/plugin.cpp b/demos/arthurplugin/plugin.cpp index e2bf54e..c26aae7 100644 --- a/demos/arthurplugin/plugin.cpp +++ b/demos/arthurplugin/plugin.cpp @@ -55,7 +55,26 @@ QT_FORWARD_DECLARE_CLASS(QDesignerFormEditorInterface) -static inline QString customWidgetDomXml(const QString &className) +// Specify "text" to be a singleline property (no richtext) +static inline QString textSingleLinePropertyDeclaration(const QString &className) +{ + QString rc = QLatin1String( + "<customwidgets>\n" + " <customwidget>\n" + " <class>"); + rc += className; + rc += QLatin1String("</class>\n" + " <propertyspecifications>\n" + " <stringpropertyspecification name=\"text\" type=\"singleline\"/>\n" + " </propertyspecifications>\n" + " </customwidget>\n" + "</customwidgets>\n"); + return rc; +} + +// Plain XML for a custom widget +static inline QString customWidgetDomXml(const QString &className, + const QString &customSection = QString()) { QString rc = QLatin1String("<ui language=\"c++\"><widget class=\""); rc += className; @@ -63,7 +82,9 @@ static inline QString customWidgetDomXml(const QString &className) QString objectName = className; objectName[0] = objectName.at(0).toLower(); rc += objectName; - rc += QLatin1String("\"/></ui>"); + rc += QLatin1String("\"/>"); + rc += customSection; + rc += QLatin1String("</ui>"); return rc; } @@ -80,7 +101,7 @@ class DemoPlugin : public QDesignerCustomWidgetInterface Q_INTERFACES(QDesignerCustomWidgetInterface) protected: - DemoPlugin(const QString &className); + explicit DemoPlugin(const QString &className, const QString &customSection = QString()); public: QString name() const { return m_className; } @@ -105,9 +126,9 @@ private: bool m_initialized; }; -DemoPlugin::DemoPlugin(const QString &className) : +DemoPlugin::DemoPlugin(const QString &className, const QString &customSection) : m_className(className), - m_domXml(customWidgetDomXml(className)), + m_domXml(customWidgetDomXml(className, customSection)), m_initialized(false) { } @@ -117,8 +138,8 @@ class DeformPlugin : public QObject, public DemoPlugin Q_OBJECT public: - DeformPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("PathDeformRendererEx")) { } - QString includeFile() const { return "deform.h"; } + explicit DeformPlugin(QObject *parent = 0); + QString includeFile() const { return QLatin1String("deform.h"); } QWidget *createWidget(QWidget *parent) { @@ -126,12 +147,19 @@ public: deform->setRadius(70); deform->setAnimated(false); deform->setFontSize(20); - deform->setText("Arthur Widgets Demo"); + deform->setText(QLatin1String("Arthur Widgets Demo")); return deform; } }; +DeformPlugin::DeformPlugin(QObject *parent) : + QObject(parent), + DemoPlugin(QLatin1String("PathDeformRendererEx"), + textSingleLinePropertyDeclaration(QLatin1String("PathDeformRendererEx"))) +{ +} + class XFormRendererEx : public XFormView { Q_OBJECT @@ -144,24 +172,30 @@ class XFormPlugin : public QObject, public DemoPlugin { Q_OBJECT public: - XFormPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("XFormRendererEx")) { } - QString includeFile() const { return "xform.h"; } + explicit XFormPlugin(QObject *parent = 0); + QString includeFile() const { return QLatin1String("xform.h"); } QWidget *createWidget(QWidget *parent) { XFormRendererEx *xform = new XFormRendererEx(parent); - xform->setText("Qt - Hello World!!"); - xform->setPixmap(QPixmap(":/trolltech/arthurplugin/bg1.jpg")); + xform->setText(QLatin1String("Qt - Hello World!!")); + xform->setPixmap(QPixmap(QLatin1String(":/trolltech/arthurplugin/bg1.jpg"))); return xform; } }; +XFormPlugin::XFormPlugin(QObject *parent) : + QObject(parent), + DemoPlugin(QLatin1String("XFormRendererEx"), + textSingleLinePropertyDeclaration(QLatin1String("XFormRendererEx"))) +{ +} class GradientEditorPlugin : public QObject, public DemoPlugin { Q_OBJECT public: - GradientEditorPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("GradientEditor")) { } + explicit GradientEditorPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("GradientEditor")) { } QString includeFile() const { return "gradients.h"; } QWidget *createWidget(QWidget *parent) @@ -184,7 +218,7 @@ class GradientRendererPlugin : public QObject, public DemoPlugin Q_OBJECT public: GradientRendererPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("GradientRendererEx")) { } - QString includeFile() const { return "gradients.h"; } + QString includeFile() const { return QLatin1String("gradients.h"); } QWidget *createWidget(QWidget *parent) { @@ -198,7 +232,7 @@ class PathStrokeRendererEx : public PathStrokeRenderer { Q_OBJECT public: - PathStrokeRendererEx(QWidget *p) : PathStrokeRenderer(p) { } + explicit PathStrokeRendererEx(QWidget *p) : PathStrokeRenderer(p) { } QSize sizeHint() const { return QSize(300, 200); } }; @@ -206,8 +240,8 @@ class StrokeRenderPlugin : public QObject, public DemoPlugin { Q_OBJECT public: - StrokeRenderPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("PathStrokeRendererEx")) { } - QString includeFile() const { return "pathstroke.h"; } + explicit StrokeRenderPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("PathStrokeRendererEx")) { } + QString includeFile() const { return QLatin1String("pathstroke.h"); } QWidget *createWidget(QWidget *parent) { @@ -221,8 +255,8 @@ class CompositionModePlugin : public QObject, public DemoPlugin { Q_OBJECT public: - CompositionModePlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("CompositionRenderer")) { } - QString includeFile() const { return "composition.h"; } + explicit CompositionModePlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("CompositionRenderer")) { } + QString includeFile() const { return QLatin1String("composition.h"); } QWidget *createWidget(QWidget *parent) { @@ -239,7 +273,7 @@ class ArthurPlugins : public QObject, public QDesignerCustomWidgetCollectionInte Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) public: - ArthurPlugins(QObject *parent = 0); + explicit ArthurPlugins(QObject *parent = 0); QList<QDesignerCustomWidgetInterface*> customWidgets() const { return m_plugins; } private: |