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 );
80 :
QDialog( parent ), mStyle( style )
86 mAndOrCombo->addItem(
tr(
"ALL the constraints" ),
QVariant(
"AND" ) );
87 mAndOrCombo->addItem(
tr(
"any ONE of the constraints" ),
QVariant(
"OR" ) );
101 return mNameLineEdit->text();
155 return mAndOrCombo->itemData( mAndOrCombo->currentIndex() ).toString();
161 constraints <<
"tag" <<
"group" <<
"name" <<
"!tag" <<
"!group" <<
"!name";
171 Q_FOREACH (
const QString &constr, constraints )
174 Q_FOREACH (
const QString ¶m, params )
192 mAndOrCombo->setCurrentIndex( mAndOrCombo->findData(
QVariant( op ) ) );
197 mNameLineEdit->setText( name );
202 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()
QgsSmartGroupEditorDialog(QgsStyleV2 *style, QWidget *parent=NULL)
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
void setConditionMap(QgsSmartConditionMap)
sets up the GUI for the given conditionmap
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
QgsSmartGroupCondition(int id, QWidget *parent=NULL)
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)
int count(const Key &key) const
QString conditionOperator()
returns the AND/OR condition