23 #include <QMessageBox>
34 mCondCombo->addItem( tr(
"has the tag" ), QVariant(
"tag" ) );
35 mCondCombo->addItem( tr(
"has a part of name matching" ), QVariant(
"name" ) );
36 mCondCombo->addItem( tr(
"does NOT have the tag" ), QVariant(
"!tag" ) );
37 mCondCombo->addItem( tr(
"has NO part of name matching" ), QVariant(
"!name" ) );
51 return mCondCombo->currentData().toString();
56 return mCondLineEdit->text();
61 mCondCombo->setCurrentIndex( mCondCombo->findData( QVariant(
constraint ) ) );
66 mCondLineEdit->setText( param );
71 mRemoveBtn->setVisible( !hide );
85 connect( buttonBox, &QDialogButtonBox::accepted,
this, &QgsSmartGroupEditorDialog::buttonBox_accepted );
89 mAndOrCombo->addItem( tr(
"ALL the constraints" ), QVariant(
"AND" ) );
90 mAndOrCombo->addItem( tr(
"any ONE of the constraints" ), QVariant(
"OR" ) );
92 mLayout =
new QGridLayout( mConditionsBox );
100 return mNameLineEdit->text();
111 condition->hideRemoveButton(
false );
134 condition->hideRemoveButton(
true );
149 conditions.insert( condition->constraint(), condition->parameter() );
157 return mAndOrCombo->currentData().toString();
162 QStringList constraints;
163 constraints << QStringLiteral(
"tag" ) << QStringLiteral(
"name" ) << QStringLiteral(
"!tag" ) << QStringLiteral(
"!name" );
170 const auto constConstraints = constraints;
171 for (
const QString &constr : constConstraints )
173 QStringList params = map.values( constr );
174 const auto constParams = params;
175 for (
const QString ¶m : constParams )
193 mAndOrCombo->setCurrentIndex( mAndOrCombo->findData( QVariant( op ) ) );
198 mNameLineEdit->setText( name );
201 void QgsSmartGroupEditorDialog::buttonBox_accepted()
203 if ( mNameLineEdit->text().isEmpty() )
205 QMessageBox::critical(
this, tr(
"Edit Smart Group" ), tr(
"The smart group name field is empty. Kindly provide a name." ) );