22 #include <QMessageBox> 33 mCondCombo->addItem(
tr(
"has the tag" ),
QVariant(
"tag" ) );
34 mCondCombo->addItem(
tr(
"is a member of group" ),
QVariant(
"group" ) );
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(
"is NOT a member of group" ),
QVariant(
"!group" ) );
38 mCondCombo->addItem(
tr(
"has NO part of name matching" ),
QVariant(
"!name" ) );
52 return mCondCombo->itemData( mCondCombo->currentIndex() ).toString();
57 return mCondLineEdit->text();
62 mCondCombo->setCurrentIndex( mCondCombo->findData(
QVariant( constraint ) ) );
67 mCondLineEdit->setText( param );
72 mRemoveBtn->setVisible( !hide );
87 mAndOrCombo->addItem(
tr(
"ALL the constraints" ),
QVariant(
"AND" ) );
88 mAndOrCombo->addItem(
tr(
"any ONE of the constraints" ),
QVariant(
"OR" ) );
102 return mNameLineEdit->text();
156 return mAndOrCombo->itemData( mAndOrCombo->currentIndex() ).toString();
162 constraints <<
"tag" <<
"group" <<
"name" <<
"!tag" <<
"!group" <<
"!name";
172 Q_FOREACH (
const QString &constr, constraints )
175 Q_FOREACH (
const QString ¶m, params )
193 mAndOrCombo->setCurrentIndex( mAndOrCombo->findData(
QVariant( op ) ) );
198 mNameLineEdit->setText( name );
203 if ( mNameLineEdit->text().isEmpty() )
void setParameter(const QString ¶m)
sets the given param
QList< T > values() const
QgsSmartConditionMap conditionMap()
returns the condition map
void on_buttonBox_accepted()
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
void hideRemoveButton(bool hide)
sets the remove button hidden state to 'hide'
~QgsSmartGroupEditorDialog()
void addCondition()
function to create a new ConditionBox and update UI
QString smartgroupName()
returns the value from mNameLineEdit
QString tr(const char *sourceText, const char *disambiguation, int n)
QList< Key > keys() const
QgsSmartGroupEditorDialog(QgsStyleV2 *style, QWidget *parent=nullptr)
const char * name() const
QMap< Key, T >::iterator insert(const Key &key, const T &value)
QString parameter()
returns the parameter
QMap< int, QgsSmartGroupCondition * > mConditionMap
QString constraint()
returns the constraint key
void removeCondition(int)
slot to remove the condition with id int
void setOperator(const QString &)
sets the operator AND/OR
void setConstraint(const QString &constraint)
sets the given constraint
StandardButton critical(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
void setSmartgroupName(const QString &)
sets the smart group Name
iterator insert(const Key &key, const T &value)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QgsSmartGroupCondition(int id, QWidget *parent=nullptr)
void setConditionMap(const QgsSmartConditionMap &)
sets up the GUI for the given conditionmap
int count(const Key &key) const
QString conditionOperator()
returns the AND/OR condition