Skip to content

Commit 1320751

Browse files
committed
Doxymentation for QgsEditorWidgetV2
1 parent abaebbe commit 1320751

18 files changed

+178
-7
lines changed

src/core/qgsvectorlayer.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,28 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
12841284
/**
12851285
* Set the editor widget type for a field
12861286
*
1287+
* QGIS ships the following widget types, additional types may be available depending
1288+
* on plugins.
1289+
*
1290+
* <ul>
1291+
* <li>CheckBox (QgsCheckboxWidgetWrapper)</li>
1292+
* <li>Classification (QgsClassificationWidgetWrapper)</li>
1293+
* <li>Color (QgsColorWidgetWrapper)</li>
1294+
* <li>DateTime (QgsDateTimeEditWrapper)</li>
1295+
* <li>Enumeration (QgsEnumerationWidgetWrapper)</li>
1296+
* <li>FileName (QgsFileNameWidgetWrapper)</li>
1297+
* <li>Hidden (QgsHiddenWidgetWrapper)</li>
1298+
* <li>Photo (QgsPhotoWidgetWrapper)</li>
1299+
* <li>Range (QgsRangeWidgetWrapper)</li>
1300+
* <li>RelationReference (QgsRelationReferenceWidgetWrapper)</li>
1301+
* <li>TextEdit (QgsTextEditWidgetWrapper)</li>
1302+
* <li>UniqueValues (QgsUniqueValueWidgetWrapper)</li>
1303+
* <li>UuidGenerator (QgsUuidWidgetWrapper)</li>
1304+
* <li>ValueMap (QgsValueMapWidgetWrapper)</li>
1305+
* <li>ValueRelation (QgsValueRelationWidget)</li>
1306+
* <li>WebView (QgsWebViewWidgetWrapper)</li>
1307+
* </ul>
1308+
*
12871309
* @param attrIdx Index of the field
12881310
* @param widgetType Type id of the editor widget to use
12891311
*/

src/gui/editorwidgets/qgscheckboxwidgetwrapper.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@
2121
#include <QCheckBox>
2222
#include <QGroupBox>
2323

24+
/**
25+
* Wraps a checkbox widget. This will offer a checkbox to represent boolean values.
26+
*
27+
* Options:
28+
* <ul>
29+
* <li><b>CheckedState</b> <i>The value used to represent "True" in the data.</i></li>
30+
* <li><b>UncheckedState</b> <i>The value used to represent "False" in the data.</i></li>
31+
* </ul>
32+
*
33+
*/
34+
2435
class GUI_EXPORT QgsCheckboxWidgetWrapper : public QgsEditorWidgetWrapper
2536
{
2637
Q_OBJECT
@@ -32,7 +43,7 @@ class GUI_EXPORT QgsCheckboxWidgetWrapper : public QgsEditorWidgetWrapper
3243
QVariant value();
3344

3445
protected:
35-
QWidget*createWidget( QWidget* parent );
46+
QWidget* createWidget( QWidget* parent );
3647
void initWidget( QWidget* editor );
3748

3849
public slots:

src/gui/editorwidgets/qgscolorwidgetwrapper.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020

2121
#include "qgscolorbutton.h"
2222

23+
24+
/**
25+
* Wraps a color widget. Users will be able to choose a color.
26+
*
27+
*/
28+
2329
class GUI_EXPORT QgsColorWidgetWrapper : public QgsEditorWidgetWrapper
2430
{
2531
Q_OBJECT

src/gui/editorwidgets/qgsdatetimeeditfactory.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class GUI_EXPORT QgsDateTimeEditFactory : public QgsEditorWidgetFactory
2929

3030
// QgsEditorWidgetFactory interface
3131
public:
32-
QgsEditorWidgetWrapper *create( QgsVectorLayer *vl, int fieldIdx, QWidget *editor, QWidget *parent ) const;
33-
QgsEditorConfigWidget *configWidget( QgsVectorLayer *vl, int fieldIdx, QWidget *parent ) const;
32+
QgsEditorWidgetWrapper* create( QgsVectorLayer *vl, int fieldIdx, QWidget *editor, QWidget *parent ) const;
33+
QgsEditorConfigWidget* configWidget( QgsVectorLayer *vl, int fieldIdx, QWidget *parent ) const;
3434
QgsEditorWidgetConfig readConfig( const QDomElement &configElement, QgsVectorLayer *layer, int fieldIdx );
3535
void writeConfig( const QgsEditorWidgetConfig& config, QDomElement& configElement, QDomDocument& doc, const QgsVectorLayer* layer, int fieldIdx );
3636
QString representValue( QgsVectorLayer* vl, int fieldIdx, const QgsEditorWidgetConfig& config, const QVariant& cache, const QVariant& value ) const;

src/gui/editorwidgets/qgsdatetimeeditwrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void QgsDateTimeEditWrapper::initWidget( QWidget *editor )
5858
if ( !mQDateTimeEdit )
5959
{
6060
QgsDebugMsg( "Date/time edit widget could not be initialized because provided widget is not a QDateTimeEdit." );
61-
QgsMessageLog::logMessage( "Date/time edit widget could not be initialized because provided widget is not a QDateTimeEdit." , "UI forms", QgsMessageLog::WARNING );
61+
QgsMessageLog::logMessage( "Date/time edit widget could not be initialized because provided widget is not a QDateTimeEdit.", "UI forms", QgsMessageLog::WARNING );
6262
return;
6363
}
6464

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

src/gui/editorwidgets/qgsdatetimeeditwrapper.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@
2222
#include "qgsdatetimeedit.h"
2323
#include "qgsdatetimeeditfactory.h"
2424

25+
/**
26+
* Wraps a date time widget. Users will be able to choose date and time from an appropriate dialog.
27+
*
28+
* Options:
29+
* <ul>
30+
* <li><b>display_format</b> <i>The format used to represent the date/time to the user.</i></li>
31+
* <li><b>calendar_popup</b> <i>If True, will offer a calendar popup.</i></li>
32+
* <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>
33+
* <li><b>field_format</b> <i>The format used to save the date/time.</i></li>
34+
* </ul>
35+
*
36+
*/
2537

2638
class GUI_EXPORT QgsDateTimeEditWrapper : public QgsEditorWidgetWrapper
2739
{

src/gui/editorwidgets/qgsfilenamewidgetwrapper.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
#include <QPushButton>
2323
#include <QLabel>
2424

25+
26+
/**
27+
* Wraps a file name widget. Will offer a file browser to choose files.
28+
*
29+
*/
30+
2531
class GUI_EXPORT QgsFileNameWidgetWrapper : public QgsEditorWidgetWrapper
2632
{
2733
Q_OBJECT

src/gui/editorwidgets/qgshiddenwidgetwrapper.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
#include "qgseditorwidgetwrapper.h"
2020

21+
/**
22+
* Wraps a hidden widget. Fields with this widget type will not be visible.
23+
*
24+
*/
25+
2126
class GUI_EXPORT QgsHiddenWidgetWrapper : public QgsEditorWidgetWrapper
2227
{
2328
Q_OBJECT

src/gui/editorwidgets/qgsphotowidgetwrapper.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@
2222
#include <QPushButton>
2323
#include <QLineEdit>
2424

25+
26+
/**
27+
* Wraps a photo widget. Will show a picture and a file chooser to change the picture.
28+
*
29+
* Options:
30+
*
31+
* <ul>
32+
* <li><b>Width</b> <i>The width of the picture widget. If 0 and "Height" &gt; 0 will be determined automatically.</i></li>
33+
* <li><b>Height</b> <i>The height of the picture widget. If 0 and "Width" &gt; 0 will be determined automatically.</i></li>
34+
* </ul>
35+
*
36+
*/
37+
2538
class GUI_EXPORT QgsPhotoWidgetWrapper : public QgsEditorWidgetWrapper
2639
{
2740
Q_OBJECT

src/gui/editorwidgets/qgsrangewidgetwrapper.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@
2424
#include "qgsdial.h"
2525
#include "qgsslider.h"
2626

27+
/**
28+
* Wraps a range widget.
29+
*
30+
* Options:
31+
* <ul>
32+
* <li><b>Style</b> <i>Can be "Dial" or "Slider"</i></li>
33+
* <li><b>Min</b> <i>The minimal allowed value</i></li>
34+
* <li><b>Max</b> <i>The maximal allowed value</i></li>
35+
* <li><b>Step</b> <i>The step size when incrementing/decrementing the value</i></li>
36+
* </ul>
37+
*
38+
*/
39+
2740
class GUI_EXPORT QgsRangeWidgetWrapper : public QgsEditorWidgetWrapper
2841
{
2942
Q_OBJECT

src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@
1919
#include "qgsrelationreferencewidget.h"
2020
#include "qgseditorwidgetwrapper.h"
2121

22+
23+
/**
24+
* Wraps a relation reference widget.
25+
*
26+
* Options:
27+
* <ul>
28+
* <li><b>ShowForm</b> <i>If True, an embedded form with the referenced feature will be shown.</i></li>
29+
* <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>
30+
* <li><b>ReadOnly</b> <i>If True, will represent the referenced widget in a read-only line edit. Can speed up loading.</i></li>
31+
* <li><b>AllowNULL</b> <i>Will offer NULL as a value.</i></li>
32+
* <li><b>Relation</b> <i>The ID of the relation that will be used to define this widget.</i></li>
33+
* ReadOnly
34+
* </ul>
35+
*
36+
*/
37+
2238
class GUI_EXPORT QgsRelationReferenceWidgetWrapper : public QgsEditorWidgetWrapper
2339
{
2440
Q_OBJECT

src/gui/editorwidgets/qgstexteditwrapper.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@
2222
#include <QPlainTextEdit>
2323
#include <QTextEdit>
2424

25+
/**
26+
* Wraps a text widget. Users will be able to modify text with this widget type.
27+
*
28+
* Options:
29+
* <ul>
30+
* <li><b>IsMultiline</b> <i>If set to True, a multiline widget will be used.</i></li>
31+
* <li><b>UseHtml</b> <i>Will represent the content as HTML. Only available for multiline widgets.</i></li>
32+
* </ul>
33+
*
34+
*/
35+
2536
class GUI_EXPORT QgsTextEditWrapper : public QgsEditorWidgetWrapper
2637
{
2738
Q_OBJECT

src/gui/editorwidgets/qgsuniquevaluewidgetfactory.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@
1818

1919
#include "qgseditorwidgetfactory.h"
2020

21+
22+
/**
23+
* Wraps a unique value widget. Will offer any value previously used for this field.
24+
*
25+
* Options:
26+
* <ul>
27+
* <li><b>Editable</b> <i>If True the user can manually insert new (not yet used) values.</i></li>
28+
* </ul>
29+
*
30+
*/
31+
2132
class GUI_EXPORT QgsUniqueValueWidgetFactory : public QgsEditorWidgetFactory
2233
{
2334
public:

src/gui/editorwidgets/qgsuuidwidgetfactory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ QgsUuidWidgetFactory::QgsUuidWidgetFactory( const QString& name )
2424
}
2525

2626

27-
QgsEditorWidgetWrapper*QgsUuidWidgetFactory::create( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) const
27+
QgsEditorWidgetWrapper* QgsUuidWidgetFactory::create( QgsVectorLayer* vl, int fieldIdx, QWidget* editor, QWidget* parent ) const
2828
{
2929
return new QgsUuidWidgetWrapper( vl, fieldIdx, editor, parent );
3030
}
3131

32-
QgsEditorConfigWidget*QgsUuidWidgetFactory::configWidget( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) const
32+
QgsEditorConfigWidget* QgsUuidWidgetFactory::configWidget( QgsVectorLayer* vl, int fieldIdx, QWidget* parent ) const
3333
{
3434
return new QgsDummyConfigDlg( vl, fieldIdx, parent, QObject::tr( "Read-only field that generates a UUID if empty." ) );
3535
}

src/gui/editorwidgets/qgsuuidwidgetwrapper.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
#include <QLineEdit>
2222
#include <QLabel>
2323

24+
25+
/**
26+
* Wraps a uuid widget. Will create a new UUID if empty or represent the current value if not empty.
27+
*
28+
*/
29+
30+
2431
class GUI_EXPORT QgsUuidWidgetWrapper : public QgsEditorWidgetWrapper
2532
{
2633
Q_OBJECT

src/gui/editorwidgets/qgsvaluemapwidgetwrapper.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@
2020

2121
#include <QComboBox>
2222

23+
24+
/**
25+
* Wraps a value map widget.
26+
*
27+
* Options:
28+
* <ul>
29+
* <li><b>[Key]</b> <i>Value</i></li>
30+
* </ul>
31+
*
32+
* Any option will be treated as entry in the value map.
33+
*
34+
*/
35+
2336
class GUI_EXPORT QgsValueMapWidgetWrapper : public QgsEditorWidgetWrapper
2437
{
2538
Q_OBJECT

src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,26 @@
2323

2424
class QgsValueRelationWidgetFactory;
2525

26+
/**
27+
* Wraps a value relation widget. This widget will offer a combobox with values from another layer
28+
* referenced by a foreign key (a constraint may be set but is not required on data level).
29+
* This is useful for having value lists on a separate layer containing codes and their
30+
* translation to human readable names.
31+
*
32+
* Options:
33+
*
34+
* <ul>
35+
* <li><b>Layer</b> <i>The id of the referenced layer.</i></li>
36+
* <li><b>Key</b> <i>The key field on the referenced layer (code).</i></li>
37+
* <li><b>Value</b> <i>The value field on the referenced layer (human readable name).</i></li>
38+
* <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>
39+
* <li><b>AllowNull</b> <i>Will offer NULL as a possible value.</i></li>
40+
* <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>
41+
* <li><b>OrderByValue</b> <i>Will order by value instead of key.</i></li>
42+
* </ul>
43+
*
44+
*/
45+
2646
class GUI_EXPORT QgsValueRelationWidgetWrapper : public QgsEditorWidgetWrapper
2747
{
2848
Q_OBJECT

src/gui/editorwidgets/qgswebviewwidgetwrapper.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
#include <QLineEdit>
2323
#include <QPushButton>
2424

25+
/**
26+
* Wraps a web view widget. Will show the content available at the URL of the value in a web browser.
27+
*
28+
*/
29+
2530
class GUI_EXPORT QgsWebViewWidgetWrapper : public QgsEditorWidgetWrapper
2631
{
2732
Q_OBJECT

0 commit comments

Comments
 (0)