Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
custom widgets: added color and data defined buttons, missing SIP for…
… scale range and fix flags for field combo / expression widget
- Loading branch information
Showing
13 changed files
with
351 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
class QgsScaleRangeWidget : QWidget | ||
{ | ||
%TypeHeaderCode | ||
#include "qgsscalerangewidget.h" | ||
%End | ||
|
||
public: | ||
explicit QgsScaleRangeWidget( QWidget *parent /TransferThis/ = 0 ); | ||
~QgsScaleRangeWidget(); | ||
|
||
//! set the map canvas which will be used for the current scale buttons | ||
/** | ||
* @brief setMapCanvas set the map canvas which will be used for the current scale buttons | ||
* if not set, the buttons are hidden. | ||
*/ | ||
void setMapCanvas( QgsMapCanvas* mapCanvas ); | ||
|
||
//! return the minimum scale | ||
double minimumScale(); | ||
|
||
//! return the maximum scale | ||
double maximumScale(); | ||
|
||
//! return the minimum scale denominator ( = 1 / maximum scale ) | ||
double minimumScaleDenom(); | ||
|
||
//! return the maximum scale denominator ( = 1 / minimum scale ) | ||
double maximumScaleDenom(); | ||
|
||
//! call to reload the project scales and apply them to the 2 scales combo boxes | ||
void reloadProjectScales(); | ||
|
||
public slots: | ||
void setMinimumScale( double scale ); | ||
|
||
void setMaximumScale( double scale ); | ||
|
||
void setScaleRange( double min, double max ); | ||
}; |
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,97 @@ | ||
/*************************************************************************** | ||
qgscolorbuttonplugin.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 "qgscolorbuttonplugin.h" | ||
#include "qgscolorbutton.h" | ||
|
||
|
||
QgsColorButtonPlugin::QgsColorButtonPlugin( QObject *parent ) | ||
: QObject( parent ) | ||
, mInitialized( false ) | ||
{ | ||
} | ||
|
||
|
||
QString QgsColorButtonPlugin::name() const | ||
{ | ||
return "QgsColorButton"; | ||
} | ||
|
||
QString QgsColorButtonPlugin::group() const | ||
{ | ||
return QgisCustomWidgets::groupName(); | ||
} | ||
|
||
QString QgsColorButtonPlugin::includeFile() const | ||
{ | ||
return "qgscolorbutton.h"; | ||
} | ||
|
||
QIcon QgsColorButtonPlugin::icon() const | ||
{ | ||
return QIcon(); | ||
} | ||
|
||
bool QgsColorButtonPlugin::isContainer() const | ||
{ | ||
return false; | ||
} | ||
|
||
QWidget *QgsColorButtonPlugin::createWidget( QWidget *parent ) | ||
{ | ||
return new QgsColorButton( parent ); | ||
} | ||
|
||
bool QgsColorButtonPlugin::isInitialized() const | ||
{ | ||
return mInitialized; | ||
} | ||
|
||
void QgsColorButtonPlugin::initialize( QDesignerFormEditorInterface *core ) | ||
{ | ||
Q_UNUSED( core ); | ||
if ( mInitialized ) | ||
return; | ||
mInitialized = true; | ||
} | ||
|
||
|
||
QString QgsColorButtonPlugin::toolTip() const | ||
{ | ||
return "A widget to define the scale range"; | ||
} | ||
|
||
QString QgsColorButtonPlugin::whatsThis() const | ||
{ | ||
return "A widget to define the scale range."; | ||
} | ||
|
||
QString QgsColorButtonPlugin::domXml() const | ||
{ | ||
return QString( "<ui language=\"c++\">\n" | ||
" <widget class=\"%1\" name=\"mColorButton\">\n" | ||
" <property name=\"geometry\">\n" | ||
" <rect>\n" | ||
" <x>0</x>\n" | ||
" <y>0</y>\n" | ||
" <width>27</width>\n" | ||
" <height>27</height>\n" | ||
" </rect>\n" | ||
" </property>\n" | ||
" </widget>\n" | ||
"</ui>\n" ) | ||
.arg( name() ); | ||
} |
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,48 @@ | ||
/*************************************************************************** | ||
qgscolorbuttonplugin.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 QGSCOLORBUTTONPLUGIN_H | ||
#define QGSCOLORBUTTONPLUGIN_H | ||
|
||
#include <QDesignerExportWidget> | ||
#include <QDesignerCustomWidgetInterface> | ||
|
||
|
||
class QDESIGNER_WIDGET_EXPORT QgsColorButtonPlugin : public QObject, public QDesignerCustomWidgetInterface | ||
{ | ||
Q_OBJECT | ||
Q_INTERFACES( QDesignerCustomWidgetInterface ) | ||
|
||
public: | ||
explicit QgsColorButtonPlugin( 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 // QGSCOLORBUTTONPLUGIN_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,97 @@ | ||
/*************************************************************************** | ||
qgsdatadefinedbuttonplugin.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 "qgsdatadefinedbuttonplugin.h" | ||
#include "qgsdatadefinedbutton.h" | ||
|
||
|
||
QgsDataDefinedButtonPlugin::QgsDataDefinedButtonPlugin( QObject *parent ) | ||
: QObject( parent ) | ||
, mInitialized( false ) | ||
{ | ||
} | ||
|
||
|
||
QString QgsDataDefinedButtonPlugin::name() const | ||
{ | ||
return "QgsDataDefinedButton"; | ||
} | ||
|
||
QString QgsDataDefinedButtonPlugin::group() const | ||
{ | ||
return QgisCustomWidgets::groupName(); | ||
} | ||
|
||
QString QgsDataDefinedButtonPlugin::includeFile() const | ||
{ | ||
return "qgsdatadefinedbutton.h"; | ||
} | ||
|
||
QIcon QgsDataDefinedButtonPlugin::icon() const | ||
{ | ||
return QIcon(); | ||
} | ||
|
||
bool QgsDataDefinedButtonPlugin::isContainer() const | ||
{ | ||
return false; | ||
} | ||
|
||
QWidget *QgsDataDefinedButtonPlugin::createWidget( QWidget *parent ) | ||
{ | ||
return new QgsDataDefinedButton( parent ); | ||
} | ||
|
||
bool QgsDataDefinedButtonPlugin::isInitialized() const | ||
{ | ||
return mInitialized; | ||
} | ||
|
||
void QgsDataDefinedButtonPlugin::initialize( QDesignerFormEditorInterface *core ) | ||
{ | ||
Q_UNUSED( core ); | ||
if ( mInitialized ) | ||
return; | ||
mInitialized = true; | ||
} | ||
|
||
|
||
QString QgsDataDefinedButtonPlugin::toolTip() const | ||
{ | ||
return "A widget to define the scale range"; | ||
} | ||
|
||
QString QgsDataDefinedButtonPlugin::whatsThis() const | ||
{ | ||
return "A widget to define the scale range."; | ||
} | ||
|
||
QString QgsDataDefinedButtonPlugin::domXml() const | ||
{ | ||
return QString( "<ui language=\"c++\">\n" | ||
" <widget class=\"%1\" name=\"mDataDefinedButton\">\n" | ||
" <property name=\"geometry\">\n" | ||
" <rect>\n" | ||
" <x>0</x>\n" | ||
" <y>0</y>\n" | ||
" <width>27</width>\n" | ||
" <height>27</height>\n" | ||
" </rect>\n" | ||
" </property>\n" | ||
" </widget>\n" | ||
"</ui>\n" ) | ||
.arg( name() ); | ||
} |
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,48 @@ | ||
/*************************************************************************** | ||
qgsdatadefinedbuttonplugin.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 QGSDATADEFINEDBUTTONPLUGIN_H | ||
#define QGSDATADEFINEDBUTTONPLUGIN_H | ||
|
||
#include <QDesignerExportWidget> | ||
#include <QDesignerCustomWidgetInterface> | ||
|
||
|
||
class QDESIGNER_WIDGET_EXPORT QgsDataDefinedButtonPlugin : public QObject, public QDesignerCustomWidgetInterface | ||
{ | ||
Q_OBJECT | ||
Q_INTERFACES( QDesignerCustomWidgetInterface ) | ||
|
||
public: | ||
explicit QgsDataDefinedButtonPlugin( 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 // QGSDATADEFINEDBUTTONPLUGIN_H |
Oops, something went wrong.