Changeset 561 for trunk/demos/arthurplugin/plugin.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/demos/arthurplugin/plugin.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the demonstration applications of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 56 56 QT_FORWARD_DECLARE_CLASS(QDesignerFormEditorInterface) 57 57 58 static inline QString customWidgetDomXml(const QString &className) 58 // Specify "text" to be a singleline property (no richtext) 59 static inline QString textSingleLinePropertyDeclaration(const QString &className) 60 { 61 QString rc = QLatin1String( 62 "<customwidgets>\n" 63 " <customwidget>\n" 64 " <class>"); 65 rc += className; 66 rc += QLatin1String("</class>\n" 67 " <propertyspecifications>\n" 68 " <stringpropertyspecification name=\"text\" type=\"singleline\"/>\n" 69 " </propertyspecifications>\n" 70 " </customwidget>\n" 71 "</customwidgets>\n"); 72 return rc; 73 } 74 75 // Plain XML for a custom widget 76 static inline QString customWidgetDomXml(const QString &className, 77 const QString &customSection = QString()) 59 78 { 60 79 QString rc = QLatin1String("<ui language=\"c++\"><widget class=\""); … … 64 83 objectName[0] = objectName.at(0).toLower(); 65 84 rc += objectName; 66 rc += QLatin1String("\"/></ui>"); 85 rc += QLatin1String("\"/>"); 86 rc += customSection; 87 rc += QLatin1String("</ui>"); 67 88 return rc; 68 89 } … … 81 102 82 103 protected: 83 DemoPlugin(const QString &className);104 explicit DemoPlugin(const QString &className, const QString &customSection = QString()); 84 105 85 106 public: … … 106 127 }; 107 128 108 DemoPlugin::DemoPlugin(const QString &className ) :129 DemoPlugin::DemoPlugin(const QString &className, const QString &customSection) : 109 130 m_className(className), 110 m_domXml(customWidgetDomXml(className )),131 m_domXml(customWidgetDomXml(className, customSection)), 111 132 m_initialized(false) 112 133 { … … 118 139 119 140 public: 120 DeformPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("PathDeformRendererEx")) { }121 QString includeFile() const { return "deform.h"; }141 explicit DeformPlugin(QObject *parent = 0); 142 QString includeFile() const { return QLatin1String("deform.h"); } 122 143 123 144 QWidget *createWidget(QWidget *parent) … … 127 148 deform->setAnimated(false); 128 149 deform->setFontSize(20); 129 deform->setText( "Arthur Widgets Demo");150 deform->setText(QLatin1String("Arthur Widgets Demo")); 130 151 131 152 return deform; … … 133 154 }; 134 155 156 DeformPlugin::DeformPlugin(QObject *parent) : 157 QObject(parent), 158 DemoPlugin(QLatin1String("PathDeformRendererEx"), 159 textSingleLinePropertyDeclaration(QLatin1String("PathDeformRendererEx"))) 160 { 161 } 162 135 163 class XFormRendererEx : public XFormView 136 164 { … … 145 173 Q_OBJECT 146 174 public: 147 XFormPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("XFormRendererEx")) { }148 QString includeFile() const { return "xform.h"; }175 explicit XFormPlugin(QObject *parent = 0); 176 QString includeFile() const { return QLatin1String("xform.h"); } 149 177 150 178 QWidget *createWidget(QWidget *parent) 151 179 { 152 180 XFormRendererEx *xform = new XFormRendererEx(parent); 153 xform->setText( "Qt - Hello World!!");154 xform->setPixmap(QPixmap( ":/trolltech/arthurplugin/bg1.jpg"));181 xform->setText(QLatin1String("Qt - Hello World!!")); 182 xform->setPixmap(QPixmap(QLatin1String(":/trolltech/arthurplugin/bg1.jpg"))); 155 183 return xform; 156 184 } 157 185 }; 158 186 187 XFormPlugin::XFormPlugin(QObject *parent) : 188 QObject(parent), 189 DemoPlugin(QLatin1String("XFormRendererEx"), 190 textSingleLinePropertyDeclaration(QLatin1String("XFormRendererEx"))) 191 { 192 } 159 193 160 194 class GradientEditorPlugin : public QObject, public DemoPlugin … … 162 196 Q_OBJECT 163 197 public: 164 GradientEditorPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("GradientEditor")) { }198 explicit GradientEditorPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("GradientEditor")) { } 165 199 QString includeFile() const { return "gradients.h"; } 166 200 … … 185 219 public: 186 220 GradientRendererPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("GradientRendererEx")) { } 187 QString includeFile() const { return "gradients.h"; }221 QString includeFile() const { return QLatin1String("gradients.h"); } 188 222 189 223 QWidget *createWidget(QWidget *parent) … … 199 233 Q_OBJECT 200 234 public: 201 PathStrokeRendererEx(QWidget *p) : PathStrokeRenderer(p) { }235 explicit PathStrokeRendererEx(QWidget *p) : PathStrokeRenderer(p) { } 202 236 QSize sizeHint() const { return QSize(300, 200); } 203 237 }; … … 207 241 Q_OBJECT 208 242 public: 209 StrokeRenderPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("PathStrokeRendererEx")) { }210 QString includeFile() const { return "pathstroke.h"; }243 explicit StrokeRenderPlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("PathStrokeRendererEx")) { } 244 QString includeFile() const { return QLatin1String("pathstroke.h"); } 211 245 212 246 QWidget *createWidget(QWidget *parent) … … 222 256 Q_OBJECT 223 257 public: 224 CompositionModePlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("CompositionRenderer")) { }225 QString includeFile() const { return "composition.h"; }258 explicit CompositionModePlugin(QObject *parent = 0) : QObject(parent), DemoPlugin(QLatin1String("CompositionRenderer")) { } 259 QString includeFile() const { return QLatin1String("composition.h"); } 226 260 227 261 QWidget *createWidget(QWidget *parent) … … 240 274 241 275 public: 242 ArthurPlugins(QObject *parent = 0);276 explicit ArthurPlugins(QObject *parent = 0); 243 277 QList<QDesignerCustomWidgetInterface*> customWidgets() const { return m_plugins; } 244 278
Note:
See TracChangeset
for help on using the changeset viewer.