Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added QgsFieldComboBox, QgsFieldExpressionWidget and QgsMapLayerCombo…
…Box to custom widgets
- Loading branch information
Showing
8 changed files
with
468 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/*************************************************************************** | ||
qgsfieldcomboboxplugin.cpp | ||
-------------------------------------- | ||
Date : 25.04.2014 | ||
Copyright : (C) 2014 Denis Rouzaud | ||
Email : denis.rouzaud@gmail.com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgiscustomwidgets.h" | ||
#include "qgsfieldcombobox.h" | ||
#include "qgsfieldcomboboxplugin.h" | ||
|
||
|
||
QgsFieldComboBoxPlugin::QgsFieldComboBoxPlugin( QObject *parent ) | ||
: QObject( parent ) | ||
, mInitialized( false ) | ||
{ | ||
} | ||
|
||
|
||
QString QgsFieldComboBoxPlugin::name() const | ||
{ | ||
return "QgsFieldComboBox"; | ||
} | ||
|
||
QString QgsFieldComboBoxPlugin::group() const | ||
{ | ||
return QgisCustomWidgets::groupName(); | ||
} | ||
|
||
QString QgsFieldComboBoxPlugin::includeFile() const | ||
{ | ||
return "qgsfieldcombobox.h"; | ||
} | ||
|
||
QIcon QgsFieldComboBoxPlugin::icon() const | ||
{ | ||
return QIcon(); | ||
} | ||
|
||
bool QgsFieldComboBoxPlugin::isContainer() const | ||
{ | ||
return false; | ||
} | ||
|
||
QWidget *QgsFieldComboBoxPlugin::createWidget( QWidget *parent ) | ||
{ | ||
return new QgsFieldComboBox( parent ); | ||
} | ||
|
||
bool QgsFieldComboBoxPlugin::isInitialized() const | ||
{ | ||
return mInitialized; | ||
} | ||
|
||
void QgsFieldComboBoxPlugin::initialize( QDesignerFormEditorInterface *core ) | ||
{ | ||
Q_UNUSED( core ); | ||
if ( mInitialized ) | ||
return; | ||
mInitialized = true; | ||
} | ||
|
||
|
||
QString QgsFieldComboBoxPlugin::toolTip() const | ||
{ | ||
return "A combo box to list the fields of a layer"; | ||
} | ||
|
||
QString QgsFieldComboBoxPlugin::whatsThis() const | ||
{ | ||
return "A combo box to list the field of a layer."; | ||
} | ||
|
||
QString QgsFieldComboBoxPlugin::domXml() const | ||
{ | ||
return QString( "<ui language=\"c++\">\n" | ||
" <widget class=\"%1\" name=\"mFieldComboBox\">\n" | ||
" <property name=\"geometry\">\n" | ||
" <rect>\n" | ||
" <x>0</x>\n" | ||
" <y>0</y>\n" | ||
" <width>300</width>\n" | ||
" <height>100</height>\n" | ||
" </rect>\n" | ||
" </property>\n" | ||
" <property name=\"toolTip\" >\n" | ||
" <string>%2</string>\n" | ||
" </property>\n" | ||
" <property name=\"whatsThis\" >\n" | ||
" <string>%3.</string>\n" | ||
" </property>\n" | ||
" </widget>\n" | ||
"</ui>\n" ) | ||
.arg( name() ) | ||
.arg( toolTip() ) | ||
.arg( whatsThis() ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*************************************************************************** | ||
qgsfieldcomboboxplugin.h | ||
-------------------------------------- | ||
Date : 25.04.2014 | ||
Copyright : (C) 2014 Denis Rouzaud | ||
Email : denis.rouzaud@gmail.com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSFIELDCOMBOBOXPLUGIN_H | ||
#define QGSFIELDCOMBOBOXPLUGIN_H | ||
|
||
#include <QDesignerCustomWidgetInterface> | ||
|
||
class CUSTOMWIDGETS_EXPORT QgsFieldComboBoxPlugin : public QObject, public QDesignerCustomWidgetInterface | ||
{ | ||
Q_OBJECT | ||
Q_INTERFACES( QDesignerCustomWidgetInterface ) | ||
|
||
public: | ||
explicit QgsFieldComboBoxPlugin( QObject *parent = 0 ); | ||
|
||
private: | ||
bool mInitialized; | ||
|
||
// QDesignerCustomWidgetInterface interface | ||
public: | ||
QString name() const; | ||
QString group() const; | ||
QString includeFile() const; | ||
QIcon icon() const; | ||
bool isContainer() const; | ||
QWidget *createWidget( QWidget *parent ); | ||
bool isInitialized() const; | ||
void initialize( QDesignerFormEditorInterface *core ); | ||
QString toolTip() const; | ||
QString whatsThis() const; | ||
QString domXml() const; | ||
}; | ||
#endif // QGSFIELDCOMBOBOXPLUGIN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/*************************************************************************** | ||
qgsfieldexpressionwidgetplugin.cpp | ||
-------------------------------------- | ||
Date : 25.04.2014 | ||
Copyright : (C) 2014 Denis Rouzaud | ||
Email : denis.rouzaud@gmail.com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgiscustomwidgets.h" | ||
#include "qgsfieldexpressionwidgetplugin.h" | ||
#include "qgsfieldexpressionwidget.h" | ||
|
||
|
||
QgsFieldExpressionWidgetPlugin::QgsFieldExpressionWidgetPlugin( QObject *parent ) | ||
: QObject( parent ) | ||
, mInitialized( false ) | ||
{ | ||
} | ||
|
||
|
||
QString QgsFieldExpressionWidgetPlugin::name() const | ||
{ | ||
return "QgsFieldExpressionWidget"; | ||
} | ||
|
||
QString QgsFieldExpressionWidgetPlugin::group() const | ||
{ | ||
return QgisCustomWidgets::groupName(); | ||
} | ||
|
||
QString QgsFieldExpressionWidgetPlugin::includeFile() const | ||
{ | ||
return "qgsfieldexpressionwidget.h"; | ||
} | ||
|
||
QIcon QgsFieldExpressionWidgetPlugin::icon() const | ||
{ | ||
return QIcon(); | ||
} | ||
|
||
bool QgsFieldExpressionWidgetPlugin::isContainer() const | ||
{ | ||
return false; | ||
} | ||
|
||
QWidget *QgsFieldExpressionWidgetPlugin::createWidget( QWidget *parent ) | ||
{ | ||
return new QgsFieldExpressionWidget( parent ); | ||
} | ||
|
||
bool QgsFieldExpressionWidgetPlugin::isInitialized() const | ||
{ | ||
return mInitialized; | ||
} | ||
|
||
void QgsFieldExpressionWidgetPlugin::initialize( QDesignerFormEditorInterface *core ) | ||
{ | ||
Q_UNUSED( core ); | ||
if ( mInitialized ) | ||
return; | ||
mInitialized = true; | ||
} | ||
|
||
|
||
QString QgsFieldExpressionWidgetPlugin::toolTip() const | ||
{ | ||
return "An editable combo box to enter an expression"; | ||
} | ||
|
||
QString QgsFieldExpressionWidgetPlugin::whatsThis() const | ||
{ | ||
return "An editable combo box to enter an expression. A button allows opening the expression dialog. Expression are evaluated to detect errors."; | ||
} | ||
|
||
QString QgsFieldExpressionWidgetPlugin::domXml() const | ||
{ | ||
return QString( "<ui language=\"c++\">\n" | ||
" <widget class=\"%1\" name=\"mFieldExpressionWidget\">\n" | ||
" <property name=\"geometry\">\n" | ||
" <rect>\n" | ||
" <x>0</x>\n" | ||
" <y>0</y>\n" | ||
" <width>300</width>\n" | ||
" <height>100</height>\n" | ||
" </rect>\n" | ||
" </property>\n" | ||
" <property name=\"toolTip\" >\n" | ||
" <string>%2</string>\n" | ||
" </property>\n" | ||
" <property name=\"whatsThis\" >\n" | ||
" <string>%3.</string>\n" | ||
" </property>\n" | ||
" </widget>\n" | ||
"</ui>\n" ) | ||
.arg( name() ) | ||
.arg( toolTip() ) | ||
.arg( whatsThis() ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*************************************************************************** | ||
qgsfieldexpressionwidgetplugin.h | ||
-------------------------------------- | ||
Date : 25.04.2014 | ||
Copyright : (C) 2014 Denis Rouzaud | ||
Email : denis.rouzaud@gmail.com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSFIELDEXPRESSIONWIDGETPLUGIN_H | ||
#define QGSFIELDEXPRESSIONWIDGETPLUGIN_H | ||
|
||
#include <QDesignerCustomWidgetInterface> | ||
|
||
class CUSTOMWIDGETS_EXPORT QgsFieldExpressionWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface | ||
{ | ||
Q_OBJECT | ||
Q_INTERFACES( QDesignerCustomWidgetInterface ) | ||
|
||
public: | ||
explicit QgsFieldExpressionWidgetPlugin( QObject *parent = 0 ); | ||
|
||
private: | ||
bool mInitialized; | ||
|
||
// QDesignerCustomWidgetInterface interface | ||
public: | ||
QString name() const; | ||
QString group() const; | ||
QString includeFile() const; | ||
QIcon icon() const; | ||
bool isContainer() const; | ||
QWidget *createWidget( QWidget *parent ); | ||
bool isInitialized() const; | ||
void initialize( QDesignerFormEditorInterface *core ); | ||
QString toolTip() const; | ||
QString whatsThis() const; | ||
QString domXml() const; | ||
}; | ||
#endif // QGSFIELDEXPRESSIONWIDGETPLUGIN_H |
Oops, something went wrong.