-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add options in list config widget for how to deal with empty rows
Allow NULL or empty array
- Loading branch information
1 parent
4e125eb
commit 9a8a8c9
Showing
6 changed files
with
149 additions
and
13 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 @@ | ||
/*************************************************************************** | ||
qgslistconfigdlg.cpp | ||
-------------------------------------- | ||
Date : 9.2020 | ||
Copyright : (C) 2020 Stephen Knox | ||
Email : stephenknox73 at gmail dot 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 "qgslistconfigdlg.h" | ||
|
||
QgsListConfigDlg::QgsListConfigDlg( QgsVectorLayer *vl, int fieldIdx, QWidget *parent ) | ||
: QgsEditorConfigWidget( vl, fieldIdx, parent ) | ||
{ | ||
setupUi( this ); | ||
connect( mNullBehavior, &QGroupBox::toggled, this, &QgsEditorConfigWidget::changed ); | ||
} | ||
|
||
|
||
QVariantMap QgsListConfigDlg::config() | ||
{ | ||
QVariantMap cfg; | ||
|
||
cfg.insert( QStringLiteral( "EmptyIsNull" ), mEmptyisNull->isChecked() ); | ||
cfg.insert( QStringLiteral( "EmptyIsEmptyArray" ), mEmptyisEmptyArray->isChecked() ); | ||
|
||
return cfg; | ||
} | ||
|
||
void QgsListConfigDlg::setConfig( const QVariantMap &config ) | ||
{ | ||
mEmptyisNull->setChecked( config.value( QStringLiteral( "EmptyIsNull" ) ).toBool() ); | ||
mEmptyisEmptyArray->setChecked( config.value( QStringLiteral( "EmptyIsEmptyArray" ) ).toBool() ); | ||
} |
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,51 @@ | ||
/*************************************************************************** | ||
qgstexteditconfigdlg.h | ||
-------------------------------------- | ||
Date : 9.2020 | ||
Copyright : (C) 2020 Stephen Knox | ||
Email : stephenknox73 at gmail dot 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 QGSLISTCONFIGDLG_H | ||
#define QGSLISTCONFIGDLG_H | ||
|
||
#include "ui_qgslistconfigdlg.h" | ||
|
||
#include "qgseditorconfigwidget.h" | ||
#include "qgis_gui.h" | ||
|
||
SIP_NO_FILE | ||
|
||
/** | ||
* A configuration dialog for the List Widget class | ||
* \ingroup gui | ||
* \class QgsListConfigDlg | ||
* \note not available in Python bindings | ||
* | ||
* \since QGIS 3.16 | ||
*/ | ||
class GUI_EXPORT QgsListConfigDlg : public QgsEditorConfigWidget, private Ui::QgsListConfigDlg | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
|
||
/** | ||
* Constructor for QgsListConfigDlg, with the specified \a vector layer and field index. | ||
*/ | ||
explicit QgsListConfigDlg( QgsVectorLayer *vl, int fieldIdx, QWidget *parent = nullptr ); | ||
|
||
// QgsEditorConfigWidget interface | ||
public: | ||
QVariantMap config() override; | ||
void setConfig( const QVariantMap &config ) override; | ||
}; | ||
|
||
#endif // QGSLISTCONFIGDLG_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
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,50 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>QgsListConfigDlg</class> | ||
<widget class="QWidget" name="QgsListConfigDlg"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>78</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string notr="true">Form</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<widget class="QGroupBox" name="mNullBehavior"> | ||
<property name="title"> | ||
<string>Treatment of Empty Cells</string> | ||
</property> | ||
<layout class="QFormLayout" name="formLayout_2"> | ||
<item row="0" column="0"> | ||
<widget class="QRadioButton" name="mEmptyisNull"> | ||
<property name="text"> | ||
<string>NULL</string> | ||
</property> | ||
<property name="checked"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="1"> | ||
<widget class="QRadioButton" name="mEmptyisEmptyArray"> | ||
<property name="text"> | ||
<string>Empty Array</string> | ||
</property> | ||
<property name="checked"> | ||
<bool>false</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |