Skip to content

Commit

Permalink
Doxymentation for QgsEditorWidgetV2
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Sep 15, 2014
1 parent abaebbe commit 1320751
Show file tree
Hide file tree
Showing 18 changed files with 178 additions and 7 deletions.
22 changes: 22 additions & 0 deletions src/core/qgsvectorlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,28 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
/**
* Set the editor widget type for a field
*
* QGIS ships the following widget types, additional types may be available depending
* on plugins.
*
* <ul>
* <li>CheckBox (QgsCheckboxWidgetWrapper)</li>
* <li>Classification (QgsClassificationWidgetWrapper)</li>
* <li>Color (QgsColorWidgetWrapper)</li>
* <li>DateTime (QgsDateTimeEditWrapper)</li>
* <li>Enumeration (QgsEnumerationWidgetWrapper)</li>
* <li>FileName (QgsFileNameWidgetWrapper)</li>
* <li>Hidden (QgsHiddenWidgetWrapper)</li>
* <li>Photo (QgsPhotoWidgetWrapper)</li>
* <li>Range (QgsRangeWidgetWrapper)</li>
* <li>RelationReference (QgsRelationReferenceWidgetWrapper)</li>
* <li>TextEdit (QgsTextEditWidgetWrapper)</li>
* <li>UniqueValues (QgsUniqueValueWidgetWrapper)</li>
* <li>UuidGenerator (QgsUuidWidgetWrapper)</li>
* <li>ValueMap (QgsValueMapWidgetWrapper)</li>
* <li>ValueRelation (QgsValueRelationWidget)</li>
* <li>WebView (QgsWebViewWidgetWrapper)</li>
* </ul>
*
* @param attrIdx Index of the field
* @param widgetType Type id of the editor widget to use
*/
Expand Down
13 changes: 12 additions & 1 deletion src/gui/editorwidgets/qgscheckboxwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
#include <QCheckBox>
#include <QGroupBox>

/**
* Wraps a checkbox widget. This will offer a checkbox to represent boolean values.
*
* Options:
* <ul>
* <li><b>CheckedState</b> <i>The value used to represent "True" in the data.</i></li>
* <li><b>UncheckedState</b> <i>The value used to represent "False" in the data.</i></li>
* </ul>
*
*/

class GUI_EXPORT QgsCheckboxWidgetWrapper : public QgsEditorWidgetWrapper
{
Q_OBJECT
Expand All @@ -32,7 +43,7 @@ class GUI_EXPORT QgsCheckboxWidgetWrapper : public QgsEditorWidgetWrapper
QVariant value();

protected:
QWidget*createWidget( QWidget* parent );
QWidget* createWidget( QWidget* parent );
void initWidget( QWidget* editor );

public slots:
Expand Down
6 changes: 6 additions & 0 deletions src/gui/editorwidgets/qgscolorwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@

#include "qgscolorbutton.h"


/**
* Wraps a color widget. Users will be able to choose a color.
*
*/

class GUI_EXPORT QgsColorWidgetWrapper : public QgsEditorWidgetWrapper
{
Q_OBJECT
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsdatetimeeditfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class GUI_EXPORT QgsDateTimeEditFactory : public QgsEditorWidgetFactory

// QgsEditorWidgetFactory interface
public:
QgsEditorWidgetWrapper *create( QgsVectorLayer *vl, int fieldIdx, QWidget *editor, QWidget *parent ) const;
QgsEditorConfigWidget *configWidget( QgsVectorLayer *vl, int fieldIdx, QWidget *parent ) const;
QgsEditorWidgetWrapper* create( QgsVectorLayer *vl, int fieldIdx, QWidget *editor, QWidget *parent ) const;
QgsEditorConfigWidget* configWidget( QgsVectorLayer *vl, int fieldIdx, QWidget *parent ) const;
QgsEditorWidgetConfig readConfig( const QDomElement &configElement, QgsVectorLayer *layer, int fieldIdx );
void writeConfig( const QgsEditorWidgetConfig& config, QDomElement& configElement, QDomDocument& doc, const QgsVectorLayer* layer, int fieldIdx );
QString representValue( QgsVectorLayer* vl, int fieldIdx, const QgsEditorWidgetConfig& config, const QVariant& cache, const QVariant& value ) const;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsdatetimeeditwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void QgsDateTimeEditWrapper::initWidget( QWidget *editor )
if ( !mQDateTimeEdit )
{
QgsDebugMsg( "Date/time edit widget could not be initialized because provided widget is not a QDateTimeEdit." );
QgsMessageLog::logMessage( "Date/time edit widget could not be initialized because provided widget is not a QDateTimeEdit." , "UI forms", QgsMessageLog::WARNING );
QgsMessageLog::logMessage( "Date/time edit widget could not be initialized because provided widget is not a QDateTimeEdit.", "UI forms", QgsMessageLog::WARNING );
return;
}

Expand All @@ -76,7 +76,7 @@ void QgsDateTimeEditWrapper::initWidget( QWidget *editor )
else
{
QgsMessageLog::instance()->logMessage( tr( "The usual date/time widget QDateTimeEdit cannot be configured to allow NULL values. "
"For that the QGIS custom widget QgsDateTimeEdit is used." ),
"For that the QGIS custom widget QgsDateTimeEdit needs to be used." ),
"field widgets" );
}

Expand Down
12 changes: 12 additions & 0 deletions src/gui/editorwidgets/qgsdatetimeeditwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@
#include "qgsdatetimeedit.h"
#include "qgsdatetimeeditfactory.h"

/**
* Wraps a date time widget. Users will be able to choose date and time from an appropriate dialog.
*
* Options:
* <ul>
* <li><b>display_format</b> <i>The format used to represent the date/time to the user.</i></li>
* <li><b>calendar_popup</b> <i>If True, will offer a calendar popup.</i></li>
* <li><b>allow_null</b> <i>If True, will allow NULL values. Requires QgsDateTimeEdit as widget (Be aware if you work with .ui files).</i></li>
* <li><b>field_format</b> <i>The format used to save the date/time.</i></li>
* </ul>
*
*/

class GUI_EXPORT QgsDateTimeEditWrapper : public QgsEditorWidgetWrapper
{
Expand Down
6 changes: 6 additions & 0 deletions src/gui/editorwidgets/qgsfilenamewidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
#include <QPushButton>
#include <QLabel>


/**
* Wraps a file name widget. Will offer a file browser to choose files.
*
*/

class GUI_EXPORT QgsFileNameWidgetWrapper : public QgsEditorWidgetWrapper
{
Q_OBJECT
Expand Down
5 changes: 5 additions & 0 deletions src/gui/editorwidgets/qgshiddenwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

#include "qgseditorwidgetwrapper.h"

/**
* Wraps a hidden widget. Fields with this widget type will not be visible.
*
*/

class GUI_EXPORT QgsHiddenWidgetWrapper : public QgsEditorWidgetWrapper
{
Q_OBJECT
Expand Down
13 changes: 13 additions & 0 deletions src/gui/editorwidgets/qgsphotowidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@
#include <QPushButton>
#include <QLineEdit>


/**
* Wraps a photo widget. Will show a picture and a file chooser to change the picture.
*
* Options:
*
* <ul>
* <li><b>Width</b> <i>The width of the picture widget. If 0 and "Height" &gt; 0 will be determined automatically.</i></li>
* <li><b>Height</b> <i>The height of the picture widget. If 0 and "Width" &gt; 0 will be determined automatically.</i></li>
* </ul>
*
*/

class GUI_EXPORT QgsPhotoWidgetWrapper : public QgsEditorWidgetWrapper
{
Q_OBJECT
Expand Down
13 changes: 13 additions & 0 deletions src/gui/editorwidgets/qgsrangewidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@
#include "qgsdial.h"
#include "qgsslider.h"

/**
* Wraps a range widget.
*
* Options:
* <ul>
* <li><b>Style</b> <i>Can be "Dial" or "Slider"</i></li>
* <li><b>Min</b> <i>The minimal allowed value</i></li>
* <li><b>Max</b> <i>The maximal allowed value</i></li>
* <li><b>Step</b> <i>The step size when incrementing/decrementing the value</i></li>
* </ul>
*
*/

class GUI_EXPORT QgsRangeWidgetWrapper : public QgsEditorWidgetWrapper
{
Q_OBJECT
Expand Down
16 changes: 16 additions & 0 deletions src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@
#include "qgsrelationreferencewidget.h"
#include "qgseditorwidgetwrapper.h"


/**
* Wraps a relation reference widget.
*
* Options:
* <ul>
* <li><b>ShowForm</b> <i>If True, an embedded form with the referenced feature will be shown.</i></li>
* <li><b>MapIdentification</b> <i>Will offer a map tool to pick a referenced feature on the map canvas. Only use for layers with geometry.</i></li>
* <li><b>ReadOnly</b> <i>If True, will represent the referenced widget in a read-only line edit. Can speed up loading.</i></li>
* <li><b>AllowNULL</b> <i>Will offer NULL as a value.</i></li>
* <li><b>Relation</b> <i>The ID of the relation that will be used to define this widget.</i></li>
* ReadOnly
* </ul>
*
*/

class GUI_EXPORT QgsRelationReferenceWidgetWrapper : public QgsEditorWidgetWrapper
{
Q_OBJECT
Expand Down
11 changes: 11 additions & 0 deletions src/gui/editorwidgets/qgstexteditwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
#include <QPlainTextEdit>
#include <QTextEdit>

/**
* Wraps a text widget. Users will be able to modify text with this widget type.
*
* Options:
* <ul>
* <li><b>IsMultiline</b> <i>If set to True, a multiline widget will be used.</i></li>
* <li><b>UseHtml</b> <i>Will represent the content as HTML. Only available for multiline widgets.</i></li>
* </ul>
*
*/

class GUI_EXPORT QgsTextEditWrapper : public QgsEditorWidgetWrapper
{
Q_OBJECT
Expand Down
11 changes: 11 additions & 0 deletions src/gui/editorwidgets/qgsuniquevaluewidgetfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@

#include "qgseditorwidgetfactory.h"


/**
* Wraps a unique value widget. Will offer any value previously used for this field.
*
* Options:
* <ul>
* <li><b>Editable</b> <i>If True the user can manually insert new (not yet used) values.</i></li>
* </ul>
*
*/

class GUI_EXPORT QgsUniqueValueWidgetFactory : public QgsEditorWidgetFactory
{
public:
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsuuidwidgetfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ QgsUuidWidgetFactory::QgsUuidWidgetFactory( const QString& name )
}


QgsEditorWidgetWrapper*QgsUuidWidgetFactory::create( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) const
QgsEditorWidgetWrapper* QgsUuidWidgetFactory::create( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) const
{
return new QgsUuidWidgetWrapper( vl, fieldIdx, editor, parent );
}

QgsEditorConfigWidget*QgsUuidWidgetFactory::configWidget( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) const
QgsEditorConfigWidget* QgsUuidWidgetFactory::configWidget( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) const
{
return new QgsDummyConfigDlg( vl, fieldIdx, parent, QObject::tr( "Read-only field that generates a UUID if empty." ) );
}
7 changes: 7 additions & 0 deletions src/gui/editorwidgets/qgsuuidwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
#include <QLineEdit>
#include <QLabel>


/**
* Wraps a uuid widget. Will create a new UUID if empty or represent the current value if not empty.
*
*/


class GUI_EXPORT QgsUuidWidgetWrapper : public QgsEditorWidgetWrapper
{
Q_OBJECT
Expand Down
13 changes: 13 additions & 0 deletions src/gui/editorwidgets/qgsvaluemapwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@

#include <QComboBox>


/**
* Wraps a value map widget.
*
* Options:
* <ul>
* <li><b>[Key]</b> <i>Value</i></li>
* </ul>
*
* Any option will be treated as entry in the value map.
*
*/

class GUI_EXPORT QgsValueMapWidgetWrapper : public QgsEditorWidgetWrapper
{
Q_OBJECT
Expand Down
20 changes: 20 additions & 0 deletions src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@

class QgsValueRelationWidgetFactory;

/**
* Wraps a value relation widget. This widget will offer a combobox with values from another layer
* referenced by a foreign key (a constraint may be set but is not required on data level).
* This is useful for having value lists on a separate layer containing codes and their
* translation to human readable names.
*
* Options:
*
* <ul>
* <li><b>Layer</b> <i>The id of the referenced layer.</i></li>
* <li><b>Key</b> <i>The key field on the referenced layer (code).</i></li>
* <li><b>Value</b> <i>The value field on the referenced layer (human readable name).</i></li>
* <li><b>AllowMulti</b> <i>If set to True, will allow multiple selections. This requires the data type to be a string. This does NOT work with normalized database structures.</i></li>
* <li><b>AllowNull</b> <i>Will offer NULL as a possible value.</i></li>
* <li><b>FilterExpression</b> <i>If not empty, will be used as expression. Only if this evaluates to True, the value will be shown.</i></li>
* <li><b>OrderByValue</b> <i>Will order by value instead of key.</i></li>
* </ul>
*
*/

class GUI_EXPORT QgsValueRelationWidgetWrapper : public QgsEditorWidgetWrapper
{
Q_OBJECT
Expand Down
5 changes: 5 additions & 0 deletions src/gui/editorwidgets/qgswebviewwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
#include <QLineEdit>
#include <QPushButton>

/**
* Wraps a web view widget. Will show the content available at the URL of the value in a web browser.
*
*/

class GUI_EXPORT QgsWebViewWidgetWrapper : public QgsEditorWidgetWrapper
{
Q_OBJECT
Expand Down

0 comments on commit 1320751

Please sign in to comment.