23#include "moc_qgscheckboxconfigdlg.cpp"
25using namespace Qt::StringLiterals;
34 mDisplayAsTextComboBox->setCurrentIndex( 0 );
40 if ( vl->
fields().
at( fieldIdx ).
type() == QMetaType::Type::Bool )
42 leCheckedState->setEnabled(
false );
43 leUncheckedState->setEnabled(
false );
45 leCheckedState->setPlaceholderText( u
"TRUE"_s );
46 leUncheckedState->setPlaceholderText( u
"FALSE"_s );
54 cfg.insert( u
"CheckedState"_s, leCheckedState->text() );
55 cfg.insert( u
"UncheckedState"_s, leUncheckedState->text() );
56 cfg.insert( u
"TextDisplayMethod"_s, mDisplayAsTextComboBox->currentData().toInt() );
57 cfg.insert( u
"AllowNullState"_s, mAllowNullState->isChecked() );
64 if (
layer()->fields().at(
field() ).type() != QMetaType::Type::Bool )
66 leCheckedState->setText(
config.value( u
"CheckedState"_s ).toString() );
67 leUncheckedState->setText(
config.value( u
"UncheckedState"_s ).toString() );
70 mAllowNullState->setChecked(
config.value( u
"AllowNullState"_s ).toBool() );
void setConfig(const QVariantMap &config) override
Update the configuration widget to represent the given configuration.
QVariantMap config() override
Create a configuration from the current GUI state.
QgsCheckBoxConfigDlg(QgsVectorLayer *vl, int fieldIdx, QWidget *parent=nullptr)
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
Represents a vector layer which manages a vector based dataset.