-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
2,455 additions
and
627 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
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,14 @@ | ||
/** | ||
* Holds a set of configuration parameters for a editor widget wrapper. | ||
* It's basically a set of key => value pairs. | ||
* | ||
* If you need more advanced structures than a simple key => value pair, | ||
* you can use a value to hold any structure a QVariant can handle (and that's | ||
* about anything you get through your compiler) | ||
* | ||
* These are the user configurable options in the field properties tab of the | ||
* vector layer properties. They are saved in the project file per layer and field. | ||
* You get these passed, for every new widget wrapper. | ||
*/ | ||
|
||
typedef QMap<QString, QVariant> QgsEditorWidgetConfig; |
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,31 @@ | ||
/*************************************************************************** | ||
qgseditorconfigwidget.sip | ||
-------------------------------------- | ||
Date : 24.4.2013 | ||
Copyright : (C) 2013 Matthias Kuhn | ||
Email : matthias dot kuhn at gmx dot ch | ||
*************************************************************************** | ||
* * | ||
* 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. * | ||
* * | ||
***************************************************************************/ | ||
|
||
class QgsEditorConfigWidget : QWidget | ||
{ | ||
%TypeHeaderCode | ||
#include <qgseditorconfigwidget.h> | ||
%End | ||
|
||
public: | ||
explicit QgsEditorConfigWidget( QgsVectorLayer* vl, int fieldIdx, QWidget* parent /TransferThis/ ); | ||
int field(); | ||
|
||
QgsVectorLayer* layer(); | ||
|
||
virtual QgsEditorWidgetConfig config() = 0; | ||
virtual void setConfig( const QgsEditorWidgetConfig& config ) = 0; | ||
}; | ||
|
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,34 @@ | ||
/*************************************************************************** | ||
qgseditorwidgetfactory.sip | ||
-------------------------------------- | ||
Date : 21.4.2013 | ||
Copyright : (C) 2013 Matthias Kuhn | ||
Email : matthias dot kuhn at gmx dot ch | ||
*************************************************************************** | ||
* * | ||
* 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. * | ||
* * | ||
***************************************************************************/ | ||
|
||
/** | ||
* Every attribute editor widget needs a factory, which inherits this class | ||
*/ | ||
class QgsEditorWidgetFactory | ||
{ | ||
%TypeHeaderCode | ||
#include <qgseditorwidgetfactory.h> | ||
%End | ||
|
||
public: | ||
QgsEditorWidgetFactory( const QString& name ); | ||
virtual ~QgsEditorWidgetFactory(); | ||
virtual QgsEditorWidgetWrapper* create( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) const = 0 /Factory/; | ||
virtual QgsEditorConfigWidget* configWidget( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) const = 0 /Factory/; | ||
virtual QgsEditorWidgetConfig readConfig( const QDomElement& configElement, QgsVectorLayer* layer, int fieldIdx ); | ||
virtual void writeConfig( const QgsEditorWidgetConfig& config, QDomElement& configElement, const QDomDocument& doc, const QgsVectorLayer* layer, int fieldIdx ); | ||
|
||
virtual QString 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,32 @@ | ||
/*************************************************************************** | ||
qgseditorwidgetregistry.sip | ||
-------------------------------------- | ||
Date : 21.4.2013 | ||
Copyright : (C) 2013 Matthias Kuhn | ||
Email : matthias dot kuhn at gmx dot ch | ||
*************************************************************************** | ||
* * | ||
* 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. * | ||
* * | ||
***************************************************************************/ | ||
|
||
/** | ||
* This class manages all known edit widget factories | ||
*/ | ||
class QgsEditorWidgetRegistry : QObject | ||
{ | ||
%TypeHeaderCode | ||
#include <qgseditorwidgetregistry.h> | ||
%End | ||
|
||
public: | ||
static QgsEditorWidgetRegistry* instance(); | ||
void registerWidget( const QString& widgetType, QgsEditorWidgetFactory* widgetFactory /Transfer/ ); | ||
QgsEditorWidgetWrapper* create( const QString& widgetType, QgsVectorLayer* vl, int fieldIdx, const QgsEditorWidgetConfig& config, QWidget* editor = NULL, QWidget* parent = NULL ) /Factory/; | ||
QgsEditorConfigWidget* createConfigWidget( const QString& widgetId, QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) /Factory/; | ||
|
||
const QMap<QString, QgsEditorWidgetFactory*> factories(); | ||
}; |
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,42 @@ | ||
/*************************************************************************** | ||
qgseditorwidgetwrapper.sip | ||
-------------------------------------- | ||
Date : 20.4.2013 | ||
Copyright : (C) 2013 Matthias Kuhn | ||
Email : matthias dot kuhn at gmx dot ch | ||
*************************************************************************** | ||
* * | ||
* 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. * | ||
* * | ||
***************************************************************************/ | ||
|
||
class QgsEditorWidgetWrapper : QObject | ||
{ | ||
%TypeHeaderCode | ||
#include <qgseditorwidgetwrapper.h> | ||
%End | ||
|
||
public: | ||
explicit QgsEditorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent /TransferThis/ = 0 ); | ||
QWidget* widget(); | ||
virtual void setConfig( QMap<QString, QVariant> config ); | ||
virtual QVariant value() = 0; | ||
QVariant config( QString key ); | ||
|
||
QgsVectorLayer* layer(); | ||
int field(); | ||
|
||
protected: | ||
virtual QWidget* createWidget( QWidget* parent ) = 0 /Factory/; | ||
|
||
signals: | ||
void valueChanged( const QVariant& value ); | ||
|
||
public slots: | ||
virtual void setValue( const QVariant& value ) = 0; | ||
virtual void setEnabled( bool enabled ); | ||
|
||
}; |
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
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
Oops, something went wrong.