15#ifndef QGSLABELINGENGINERULESWIDGET_H
16#define QGSLABELINGENGINERULESWIDGET_H
21#include "ui_qgslabelingengineruleswidgetbase.h"
23#include <QAbstractItemModel>
27class QDialogButtonBox;
52 Qt::ItemFlags
flags(
const QModelIndex &
index )
const override;
53 QModelIndex
parent(
const QModelIndex &child )
const override;
54 int rowCount(
const QModelIndex &
parent = QModelIndex() )
const override;
56 QVariant
data(
const QModelIndex &
index,
int role = Qt::DisplayRole )
const override;
57 QModelIndex
index(
int row,
int column,
const QModelIndex &
parent )
const override;
58 bool removeRows(
int row,
int count,
const QModelIndex &
parent = QModelIndex() )
override;
59 bool setData(
const QModelIndex &
index,
const QVariant &value,
int role = Qt::EditRole )
override;
66 void setRules(
const QList< QgsAbstractLabelingEngineRule * > &
rules );
71 void addRule( std::unique_ptr< QgsAbstractLabelingEngineRule > &rule );
81 void changeRule(
const QModelIndex &
index, std::unique_ptr< QgsAbstractLabelingEngineRule > &rule );
88 QList<QgsAbstractLabelingEngineRule * >
rules()
const;
92 std::vector< std::unique_ptr< QgsAbstractLabelingEngineRule > > mRules;
129 void setRules(
const QList< QgsAbstractLabelingEngineRule * > &rules );
147 void createTypesMenu();
148 void createRule(
const QString &
id );
149 void editSelectedRule();
150 void editRule(
const QModelIndex &index );
156 QMenu *mAddRuleMenu =
nullptr;
190 void setRules(
const QList< QgsAbstractLabelingEngineRule * > &rules );
202 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.