15#ifndef QGSLABELINGENGINERULESWIDGET_H
16#define QGSLABELINGENGINERULESWIDGET_H
21#include "ui_qgslabelingengineruleswidgetbase.h"
23#include <QAbstractItemModel>
27class QDialogButtonBox;
51 Qt::ItemFlags
flags(
const QModelIndex &
index )
const override;
52 QModelIndex
parent(
const QModelIndex &child )
const override;
53 int rowCount(
const QModelIndex &
parent = QModelIndex() )
const override;
55 QVariant
data(
const QModelIndex &
index,
int role = Qt::DisplayRole )
const override;
56 QModelIndex
index(
int row,
int column,
const QModelIndex &
parent )
const override;
57 bool removeRows(
int row,
int count,
const QModelIndex &
parent = QModelIndex() )
override;
58 bool setData(
const QModelIndex &
index,
const QVariant &value,
int role = Qt::EditRole )
override;
65 void setRules(
const QList<QgsAbstractLabelingEngineRule *> &
rules );
70 void addRule( std::unique_ptr<QgsAbstractLabelingEngineRule> &rule );
80 void changeRule(
const QModelIndex &
index, std::unique_ptr<QgsAbstractLabelingEngineRule> &rule );
87 QList<QgsAbstractLabelingEngineRule *>
rules()
const;
90 std::vector<std::unique_ptr<QgsAbstractLabelingEngineRule>> mRules;
123 void setRules(
const QList<QgsAbstractLabelingEngineRule *> &rules );
141 void createTypesMenu();
142 void createRule(
const QString &
id );
143 void editSelectedRule();
144 void editRule(
const QModelIndex &index );
149 QMenu *mAddRuleMenu =
nullptr;
181 void setRules(
const QList<QgsAbstractLabelingEngineRule *> &rules );
192 QDialogButtonBox *mButtonBox =
nullptr;
Abstract base class for labeling engine rules.
A dialog which allows configuration of a list of labeling engine rules.
A model for configuration of a list of labeling engine rules.
QModelIndex index(int row, int column, const QModelIndex &parent) const override
int columnCount(const QModelIndex &parent=QModelIndex()) const override
void setRules(const QList< QgsAbstractLabelingEngineRule * > &rules)
Sets the rules to include in the model.
QModelIndex parent(const QModelIndex &child) const override
QList< QgsAbstractLabelingEngineRule * > rules() const
Returns the rules shown in the widget.
QgsAbstractLabelingEngineRule * ruleAtIndex(const QModelIndex &index) const
Returns the rule at the specified model index.
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
void addRule(std::unique_ptr< QgsAbstractLabelingEngineRule > &rule)
Adds a rule to the model.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
~QgsLabelingEngineRulesModel() override
void changeRule(const QModelIndex &index, std::unique_ptr< QgsAbstractLabelingEngineRule > &rule)
Swaps the rule at the specified index for a new rule.