27 if (
config( QStringLiteral(
"AllowNullState" ) ).toBool() && mCheckBox && mCheckBox->checkState() == Qt::PartiallyChecked )
32 if (
field().type() == QMetaType::Type::Bool )
36 return mGroupBox->isChecked();
40 return mCheckBox->isChecked();
47 return mGroupBox->isChecked() ?
config( QStringLiteral(
"CheckedState" ) ) :
config( QStringLiteral(
"UncheckedState" ) );
51 return mCheckBox->isChecked() ?
config( QStringLiteral(
"CheckedState" ) ) :
config( QStringLiteral(
"UncheckedState" ) );
62 mIndeterminateStateEnabled =
true;
63 whileBlocking( mCheckBox )->setCheckState( Qt::PartiallyChecked );
69 return new QCheckBox( parent );
74 mCheckBox = qobject_cast<QCheckBox *>( editor );
75 mGroupBox = qobject_cast<QGroupBox *>( editor );
78 connect( mCheckBox, &QCheckBox::stateChanged,
this, [ = ](
int state )
80 if ( !mIndeterminateStateEnabled && mCheckBox->checkState() != Qt::PartiallyChecked )
82 mCheckBox->setTristate( false );
90 connect( mGroupBox, &QGroupBox::toggled,
this, [ = ](
bool state )
101 return mCheckBox || mGroupBox;
104void QgsCheckboxWidgetWrapper::updateValues(
const QVariant &value,
const QVariantList & )
106 Qt::CheckState state = Qt::Unchecked;
108 if (
config( QStringLiteral(
"AllowNullState" ) ).toBool() &&
value.isNull() )
110 state = Qt::PartiallyChecked;
114 if (
field().type() == QMetaType::Type::Bool )
116 state =
value.toBool() ? Qt::Checked : Qt::Unchecked;
120 state =
value ==
config( QStringLiteral(
"CheckedState" ) ) ? Qt::Checked : Qt::Unchecked;
126 mGroupBox->setChecked( state == Qt::Checked );
131 mCheckBox->setTristate( state == Qt::PartiallyChecked );
132 mCheckBox->setCheckState( state );
Represents a vector layer which manages a vector based data sets.
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.