|
| 1 | +/*************************************************************************** |
| 2 | + qgsfieldexpressionwidgetplugin.cpp |
| 3 | + -------------------------------------- |
| 4 | + Date : 25.04.2014 |
| 5 | + Copyright : (C) 2014 Denis Rouzaud |
| 6 | + Email : denis.rouzaud@gmail.com |
| 7 | +*************************************************************************** |
| 8 | +* * |
| 9 | +* This program is free software; you can redistribute it and/or modify * |
| 10 | +* it under the terms of the GNU General Public License as published by * |
| 11 | +* the Free Software Foundation; either version 2 of the License, or * |
| 12 | +* (at your option) any later version. * |
| 13 | +* * |
| 14 | +***************************************************************************/ |
| 15 | + |
| 16 | +#include "qgiscustomwidgets.h" |
| 17 | +#include "qgsfieldexpressionwidgetplugin.h" |
| 18 | +#include "qgsfieldexpressionwidget.h" |
| 19 | + |
| 20 | + |
| 21 | +QgsFieldExpressionWidgetPlugin::QgsFieldExpressionWidgetPlugin( QObject *parent ) |
| 22 | + : QObject( parent ) |
| 23 | + , mInitialized( false ) |
| 24 | +{ |
| 25 | +} |
| 26 | + |
| 27 | + |
| 28 | +QString QgsFieldExpressionWidgetPlugin::name() const |
| 29 | +{ |
| 30 | + return "QgsFieldExpressionWidget"; |
| 31 | +} |
| 32 | + |
| 33 | +QString QgsFieldExpressionWidgetPlugin::group() const |
| 34 | +{ |
| 35 | + return QgisCustomWidgets::groupName(); |
| 36 | +} |
| 37 | + |
| 38 | +QString QgsFieldExpressionWidgetPlugin::includeFile() const |
| 39 | +{ |
| 40 | + return "qgsfieldexpressionwidget.h"; |
| 41 | +} |
| 42 | + |
| 43 | +QIcon QgsFieldExpressionWidgetPlugin::icon() const |
| 44 | +{ |
| 45 | + return QIcon(); |
| 46 | +} |
| 47 | + |
| 48 | +bool QgsFieldExpressionWidgetPlugin::isContainer() const |
| 49 | +{ |
| 50 | + return false; |
| 51 | +} |
| 52 | + |
| 53 | +QWidget *QgsFieldExpressionWidgetPlugin::createWidget( QWidget *parent ) |
| 54 | +{ |
| 55 | + return new QgsFieldExpressionWidget( parent ); |
| 56 | +} |
| 57 | + |
| 58 | +bool QgsFieldExpressionWidgetPlugin::isInitialized() const |
| 59 | +{ |
| 60 | + return mInitialized; |
| 61 | +} |
| 62 | + |
| 63 | +void QgsFieldExpressionWidgetPlugin::initialize( QDesignerFormEditorInterface *core ) |
| 64 | +{ |
| 65 | + Q_UNUSED( core ); |
| 66 | + if ( mInitialized ) |
| 67 | + return; |
| 68 | + mInitialized = true; |
| 69 | +} |
| 70 | + |
| 71 | + |
| 72 | +QString QgsFieldExpressionWidgetPlugin::toolTip() const |
| 73 | +{ |
| 74 | + return "An editable combo box to enter an expression"; |
| 75 | +} |
| 76 | + |
| 77 | +QString QgsFieldExpressionWidgetPlugin::whatsThis() const |
| 78 | +{ |
| 79 | + return "An editable combo box to enter an expression. A button allows opening the expression dialog. Expression are evaluated to detect errors."; |
| 80 | +} |
| 81 | + |
| 82 | +QString QgsFieldExpressionWidgetPlugin::domXml() const |
| 83 | +{ |
| 84 | + return QString( "<ui language=\"c++\">\n" |
| 85 | + " <widget class=\"%1\" name=\"mFieldExpressionWidget\">\n" |
| 86 | + " <property name=\"geometry\">\n" |
| 87 | + " <rect>\n" |
| 88 | + " <x>0</x>\n" |
| 89 | + " <y>0</y>\n" |
| 90 | + " <width>300</width>\n" |
| 91 | + " <height>100</height>\n" |
| 92 | + " </rect>\n" |
| 93 | + " </property>\n" |
| 94 | + " <property name=\"toolTip\" >\n" |
| 95 | + " <string>%2</string>\n" |
| 96 | + " </property>\n" |
| 97 | + " <property name=\"whatsThis\" >\n" |
| 98 | + " <string>%3.</string>\n" |
| 99 | + " </property>\n" |
| 100 | + " </widget>\n" |
| 101 | + "</ui>\n" ) |
| 102 | + .arg( name() ) |
| 103 | + .arg( toolTip() ) |
| 104 | + .arg( whatsThis() ); |
| 105 | +} |
0 commit comments