[Kst] branches/work/kst/portto4/kst/src/widgets
Adam Treat
treat at kde.org
Wed Feb 28 02:28:55 CET 2007
SVN commit 637876 by treat:
* Make this a little easier. Rest of plugins to follow
M +38 -23 kstwidgets.h
--- branches/work/kst/portto4/kst/src/widgets/kstwidgets.h #637875:637876
@@ -38,38 +38,32 @@
#include <QtPlugin>
-#include "curveappearancewidget.h"
+class KstWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface {
+public:
+ KstWidgetPlugin(QObject *parent = 0) : QObject(parent), _initialized(false) {}
-class CurveAppearanceWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface {
- Q_OBJECT
- Q_INTERFACES(QDesignerCustomWidgetInterface)
+ QString group() const { return tr("Kst Widgets"); }
+ QString toolTip() const { return ""; }
+ QString whatsThis() const { return ""; }
-public:
- CurveAppearanceWidgetPlugin(QObject *parent = 0) : QObject(parent), _initialized(false) {}
+ QString instanceName() const {
+ QChar camel = name().at(0).toLower();
+ return name().replace(0,1,camel.toLower());
+ }
- bool isContainer() const {
- return false;
+ QString includeFile() const {
+ return name().toLower() + ".h";
}
- bool isInitialized() const {
- return _initialized;
- };
- QIcon icon() const { return QIcon(); }
QString domXml() const {
- return "<widget class=\"CurveAppearanceWidget\" name=\"curveAppearanceWidget\">\n"
- "</widget>\n";
+ return QString::fromUtf8("<widget class=\"%1\" name=\"%2\"/>")
+ .arg(name()).arg(instanceName().toLower());
}
- QString group() const { return "Kst Widgets"; }
- QString includeFile() const { return "curveappearancewidget.ui.h"; }
- QString name() const { return "CurveAppearanceWidget"; }
- QString toolTip() const { return ""; }
- QString whatsThis() const { return ""; }
+ bool isContainer() const { return false; }
+ bool isInitialized() const { return _initialized; }
+ QIcon icon() const { return QIcon(); }
- QWidget *createWidget(QWidget *parent) {
- return new CurveAppearanceWidget(parent);
- }
-
void initialize(QDesignerFormEditorInterface *) {
if (_initialized)
return;
@@ -80,7 +74,28 @@
private:
bool _initialized;
};
+
+#include "curveappearancewidget.h"
+class CurveAppearanceWidgetPlugin : public KstWidgetPlugin {
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+public:
+ CurveAppearanceWidgetPlugin(QObject *parent = 0) : KstWidgetPlugin(parent) {}
+ QString name() const { return "CurveAppearanceWidget"; } //do not translate
+ QWidget *createWidget(QWidget *parent) { return new CurveAppearanceWidget(parent); }
+};
Q_EXPORT_PLUGIN2(curveappearancewidgetplugin, CurveAppearanceWidgetPlugin)
+// #include "curveplacementwidget.h"
+// class CurvePlacementWidgetPlugin : public KstWidgetPlugin {
+// Q_OBJECT
+// Q_INTERFACES(QDesignerCustomWidgetInterface)
+// public:
+// CurvePlacementWidgetPlugin(QObject *parent = 0) : KstWidgetPlugin(parent) {}
+// QString name() const { return "CurvePlacementWidget"; } //do not translate
+// QWidget *createWidget(QWidget *parent) { return new CurvePlacementWidget(parent); }
+// };
+// Q_EXPORT_PLUGIN2(curveplacementwidgetplugin, CurvePlacementWidgetPlugin)
+
#endif
// vim: ts=2 sw=2 et
More information about the Kst
mailing list