24 #include "qgsexpression.h" 36 #include <QProgressDialog> 37 #include <QTreeWidgetItem> 38 #include <QVBoxLayout> 39 #include <QMessageBox> 41 #ifdef ENABLE_MODELTEST 42 #include "modeltest.h" 72 this->layout()->setContentsMargins( 0, 0, 0, 0 );
75 #ifdef ENABLE_MODELTEST 76 new ModelTest(
mModel,
this );
78 viewRules->setModel(
mModel );
81 mDeleteAction->setShortcut( QKeySequence( QKeySequence::Delete ) );
87 mRefineMenu =
new QMenu( tr(
"Refine current rule" ), btnRefineRule );
148 QModelIndex currentIndex = viewRules->selectionModel()->currentIndex();
149 mModel->
insertRule( currentIndex.parent(), currentIndex.row() + 1, newrule );
150 QModelIndex newindex =
mModel->
index( currentIndex.row() + 1, 0, currentIndex.parent() );
151 viewRules->selectionModel()->setCurrentIndex( newindex, QItemSelectionModel::ClearAndSelect );
159 viewRules->selectionModel()->setCurrentIndex( newindex, QItemSelectionModel::ClearAndSelect );
166 QItemSelectionModel *sel = viewRules->selectionModel();
167 QModelIndex idx = sel->currentIndex();
168 if ( !idx.isValid() )
175 editRule( viewRules->selectionModel()->currentIndex() );
180 if ( !index.isValid() )
207 QItemSelection sel = viewRules->selectionModel()->selection();
208 QgsDebugMsg( QString(
"REMOVE RULES!!! ranges: %1" ).arg( sel.count() ) );
209 Q_FOREACH (
const QItemSelectionRange &range, sel )
211 QgsDebugMsg( QString(
"RANGE: r %1 - %2" ).arg( range.top() ).arg( range.bottom() ) );
212 if ( range.isValid() )
213 mModel->
removeRows( range.top(), range.bottom() - range.top() + 1, range.parent() );
216 viewRules->selectionModel()->clear();
222 Q_UNUSED( previous );
223 btnEditRule->setEnabled( current.isValid() );
232 #include <QDialogButtonBox> 233 #include <QInputDialog> 234 #include <QClipboard> 238 QModelIndexList indexlist = viewRules->selectionModel()->selectedRows();
240 if ( indexlist.isEmpty() )
246 else if ( type == 1 )
254 Q_FOREACH (
const QModelIndex &index, indexlist )
255 viewRules->expand( index );
293 Q_FOREACH (
const QModelIndex &index, indexList )
298 if ( !initialRule->
symbol() )
300 QMessageBox::warning(
this, tr(
"Scale Refinement" ), tr(
"Parent rule %1 must have a symbol for this operation." ).arg( initialRule->
label() ) );
305 QString txt = QInputDialog::getText(
this,
306 tr(
"Scale Refinement" ),
307 tr(
"Please enter scale denominators at which will split the rule, separate them by commas (e.g. 1000,5000):" ) );
313 Q_FOREACH (
const QString &item, txt.split(
',' ) )
315 int scale = item.toInt( &ok );
317 scales.append( scale );
319 QMessageBox::information(
this, tr(
"Scale Refinement" ), QString( tr(
"\"%1\" is not valid scale denominator, ignoring it." ) ).arg( item ) );
322 Q_FOREACH (
const QModelIndex &index, indexList )
333 QList<QgsSymbol *> symbolList;
340 QItemSelection sel = viewRules->selectionModel()->selection();
341 Q_FOREACH (
const QItemSelectionRange &range, sel )
343 QModelIndex parent = range.parent();
346 for (
int row = range.top(); row <= range.bottom(); row++ )
348 symbolList.append( children[row]->symbol() );
358 QItemSelection sel = viewRules->selectionModel()->selection();
359 Q_FOREACH (
const QItemSelectionRange &range, sel )
361 QModelIndex parent = range.parent();
364 for (
int row = range.top(); row <= range.bottom(); row++ )
366 rl.append( children[row]->clone() );
391 if ( event->key() == Qt::Key_C &&
event->modifiers() == Qt::ControlModifier )
397 else if ( event->key() == Qt::Key_V &&
event->modifiers() == Qt::ControlModifier )
399 QgsRuleBasedRenderer::RuleList::const_iterator rIt =
mCopyBuffer.constBegin();
439 QString path =
"/Windows/RuleBasedTree/sectionWidth/" + QString::number( section );
446 QString path = QStringLiteral(
"/Windows/RuleBasedTree/sectionWidth/" );
447 QHeaderView *head = viewRules->header();
448 head->resizeSection( 0, settings.
value( path + QString::number( 0 ), 150 ).toInt() );
449 head->resizeSection( 1, settings.
value( path + QString::number( 1 ), 150 ).toInt() );
450 head->resizeSection( 2, settings.
value( path + QString::number( 2 ), 80 ).toInt() );
451 head->resizeSection( 3, settings.
value( path + QString::number( 3 ), 80 ).toInt() );
452 head->resizeSection( 4, settings.
value( path + QString::number( 4 ), 50 ).toInt() );
453 head->resizeSection( 5, settings.
value( path + QString::number( 5 ), 50 ).toInt() );
458 QModelIndexList indexlist = viewRules->selectionModel()->selectedRows();
459 QgsDebugMsg( QString(
"%1" ).arg( indexlist.count() ) );
461 if ( indexlist.isEmpty() )
465 QApplication::clipboard()->setMimeData( mime );
470 const QMimeData *mime = QApplication::clipboard()->mimeData();
471 QModelIndexList indexlist = viewRules->selectionModel()->selectedRows();
473 if ( indexlist.isEmpty() )
476 index = indexlist.first();
477 mModel->
dropMimeData( mime, Qt::CopyAction, index.row(), index.column(), index.parent() );
480 void QgsRuleBasedRendererWidget::refineRuleCategoriesAccepted(
QgsPanelWidget *panel )
486 QModelIndexList indexList = viewRules->selectionModel()->selectedRows();
487 Q_FOREACH (
const QModelIndex &index, indexList )
496 void QgsRuleBasedRendererWidget::refineRuleRangesAccepted(
QgsPanelWidget *panel )
501 QModelIndexList indexList = viewRules->selectionModel()->selectedRows();
502 Q_FOREACH (
const QModelIndex &index, indexList )
511 void QgsRuleBasedRendererWidget::ruleWidgetPanelAccepted(
QgsPanelWidget *panel )
520 QModelIndex index = viewRules->selectionModel()->currentIndex();
525 void QgsRuleBasedRendererWidget::liveUpdateRuleFromPanel()
527 ruleWidgetPanelAccepted( qobject_cast<QgsPanelWidget *>( sender() ) );
537 QHash<QgsRuleBasedRenderer::Rule *, QgsRuleBasedRendererCount> countMap;
543 countMap[rule].count = 0;
544 countMap[rule].duplicateCount = 0;
568 QProgressDialog p( tr(
"Calculating feature count." ), tr(
"Abort" ), 0, nFeatures );
569 p.setWindowModality( Qt::WindowModal );
570 int featuresCounted = 0;
580 countMap[rule].count++;
581 if ( featureRuleList.size() > 1 )
583 countMap[rule].duplicateCount++;
587 if ( duplicateRule == rule )
continue;
588 countMap[rule].duplicateCountMap[duplicateRule] += 1;
592 if ( featuresCounted % 50 == 0 )
594 if ( featuresCounted > nFeatures )
598 p.setValue( featuresCounted );
599 if ( p.wasCanceled() )
605 p.setValue( nFeatures );
612 QgsDebugMsg( QString(
"rule: %1 count %2" ).arg( rule->
label() ).arg( countMap[rule].count ) );
621 bool enabled = !viewRules->selectionModel()->selectedIndexes().isEmpty();
622 btnRefineRule->setEnabled( enabled );
623 btnRemoveRule->setEnabled( enabled );
635 layout()->setMargin( 0 );
636 layout()->setContentsMargins( 0, 0, 0, 0 );
646 groupScale->setChecked(
true );
647 mScaleRangeWidget->setMaximumScale( std::max( rule->
maximumScale(), 0.0 ) );
648 mScaleRangeWidget->setMinimumScale( std::max( rule->
minimumScale(), 0.0 ) );
654 groupSymbol->setChecked(
true );
659 groupSymbol->setChecked(
false );
664 mSymbolSelector->setContext(
mContext );
668 QVBoxLayout *l =
new QVBoxLayout;
669 l->addWidget( mSymbolSelector );
670 groupSymbol->setLayout( l );
689 setWindowModality( Qt::WindowModal );
692 QVBoxLayout *layout =
new QVBoxLayout(
this );
694 layout->addWidget( scrollArea );
696 buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
699 scrollArea->setWidget( mPropsWidget );
700 layout->addWidget( buttonBox );
701 this->setWindowTitle(
"Edit Rule" );
704 connect( buttonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
705 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsRendererRulePropsDialog::showHelp );
708 restoreGeometry( settings.
value( QStringLiteral(
"Windows/QgsRendererRulePropsDialog/geometry" ) ).toByteArray() );
714 settings.
setValue( QStringLiteral(
"Windows/QgsRendererRulePropsDialog/geometry" ),
saveGeometry() );
729 mPropsWidget->
apply();
733 void QgsRendererRulePropsDialog::showHelp()
735 QgsHelp::openHelp( QStringLiteral(
"working_with_vector/vector_properties.html#rule-based-rendering" ) );
752 editFilter->setText( dlg.expressionText() );
757 QgsExpression filter( editFilter->text() );
758 if ( filter.hasParserError() )
760 QMessageBox::critical(
this, tr(
"Test Filter" ), tr(
"Filter expression parsing error:\n" ) + filter.parserErrorString() );
772 if ( !filter.prepare( &context ) )
774 QMessageBox::critical(
this, tr(
"Test Filter" ), filter.evalErrorString() );
778 QApplication::setOverrideCursor( Qt::WaitCursor );
783 .setExpressionContext( context );
794 QApplication::restoreOverrideCursor();
796 QMessageBox::information(
this, tr(
"Test Filter" ), tr(
"Filter returned %n feature(s)",
"number of filtered features", count ) );
801 mRule->setFilterExpression( editFilter->text() );
802 mRule->setLabel( editLabel->text() );
803 mRule->setDescription( editDescription->text() );
805 mRule->setMinimumScale( groupScale->isChecked() ? mScaleRangeWidget->minimumScale() : 0 );
806 mRule->setMaximumScale( groupScale->isChecked() ? mScaleRangeWidget->maximumScale() : 0 );
807 mRule->setSymbol( groupSymbol->isChecked() ? mSymbol->clone() : nullptr );
813 mSymbolSelector->setDockMode( dockMode );
828 : QAbstractItemModel( parent )
835 if ( !index.isValid() )
836 return Qt::ItemIsDropEnabled;
839 Qt::ItemFlag drop = ( index.column() == 0 ? Qt::ItemIsDropEnabled : Qt::NoItemFlags );
841 Qt::ItemFlag checkable = ( index.column() == 0 ? Qt::ItemIsUserCheckable : Qt::NoItemFlags );
843 return Qt::ItemIsEnabled | Qt::ItemIsSelectable |
844 Qt::ItemIsEditable | checkable |
845 Qt::ItemIsDragEnabled | drop;
850 if ( !index.isValid() )
855 if ( role == Qt::DisplayRole || role == Qt::ToolTipRole )
857 switch ( index.column() )
860 return rule->
label();
883 if ( role == Qt::DisplayRole )
891 QString tip = QStringLiteral(
"<p style='margin:0px;'><ul>" );
893 for (
auto it = duplicateMap.constBegin(); it != duplicateMap.constEnd(); ++it )
895 QString label = it.key()->label().replace(
'&', QLatin1String(
"&" ) ).replace(
'>', QLatin1String(
">" ) ).replace(
'<', QLatin1String(
"<" ) );
896 tip += tr(
"<li><nobr>%1 features also in rule %2</nobr></li>" ).arg( it.value() ).arg( label );
898 tip += QLatin1String(
"</ul>" );
912 else if ( role == Qt::DecorationRole && index.column() == 0 && rule->
symbol() )
916 else if ( role == Qt::TextAlignmentRole )
918 return ( index.column() == 2 || index.column() == 3 ) ? Qt::AlignRight : Qt::AlignLeft;
920 else if ( role == Qt::FontRole && index.column() == 1 )
925 italicFont.setItalic(
true );
930 else if ( role == Qt::EditRole )
932 switch ( index.column() )
935 return rule->
label();
946 else if ( role == Qt::CheckStateRole )
948 if ( index.column() != 0 )
950 return rule->
active() ? Qt::Checked : Qt::Unchecked;
958 if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section >= 0 && section < 7 )
961 lst << tr(
"Label" ) << tr(
"Rule" ) << tr(
"Min. scale" ) << tr(
"Max. scale" ) << tr(
"Count" ) << tr(
"Duplicate count" );
964 else if ( orientation == Qt::Horizontal && role == Qt::ToolTipRole )
968 return tr(
"Number of features in this rule." );
970 else if ( section == 5 )
972 return tr(
"Number of features in this rule which are also present in other rule(s)." );
981 if ( parent.column() > 0 )
986 return parentRule->
children().count();
996 if ( hasIndex( row, column, parent ) )
1000 return createIndex( row, column, childRule );
1002 return QModelIndex();
1007 if ( !index.isValid() )
1008 return QModelIndex();
1014 return QModelIndex();
1017 int row = parentRule->
parent()->
children().indexOf( parentRule );
1019 return createIndex( row, 0, parentRule );
1024 if ( !index.isValid() )
1029 if ( role == Qt::CheckStateRole )
1031 rule->
setActive( value.toInt() == Qt::Checked );
1032 emit dataChanged( index, index );
1036 if ( role != Qt::EditRole )
1039 switch ( index.column() )
1042 rule->
setLabel( value.toString() );
1057 emit dataChanged( index, index );
1063 return Qt::MoveAction;
1069 types << QStringLiteral(
"application/vnd.text.list" );
1075 QMimeData *
mimeData =
new QMimeData();
1076 QByteArray encodedData;
1078 QDataStream stream( &encodedData, QIODevice::WriteOnly );
1080 Q_FOREACH (
const QModelIndex &
index, indexes )
1083 if ( !index.isValid() || index.column() != 0 )
1092 QDomElement rootElem = doc.createElement( QStringLiteral(
"rule_mime" ) );
1093 rootElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"renderer" ) );
1094 QDomElement rulesElem = rule->
save( doc, symbols );
1095 rootElem.appendChild( rulesElem );
1097 rootElem.appendChild( symbolsElem );
1098 doc.appendChild( rootElem );
1102 stream << doc.toString( -1 );
1105 mimeData->setData( QStringLiteral(
"application/vnd.text.list" ), encodedData );
1114 if ( ruleElem.hasAttribute( QStringLiteral(
"description" ) ) )
1115 ruleElem.setAttribute( QStringLiteral(
"label" ), ruleElem.attribute( QStringLiteral(
"description" ) ) );
1118 QDomElement childRuleElem = ruleElem.firstChildElement( QStringLiteral(
"rule" ) );
1119 while ( !childRuleElem.isNull() )
1122 childRuleElem = childRuleElem.nextSiblingElement( QStringLiteral(
"rule" ) );
1128 Qt::DropAction action,
int row,
int column,
const QModelIndex &
parent )
1132 if ( action == Qt::IgnoreAction )
1135 if ( !data->hasFormat( QStringLiteral(
"application/vnd.text.list" ) ) )
1138 if ( parent.column() > 0 )
1141 QByteArray encodedData = data->data( QStringLiteral(
"application/vnd.text.list" ) );
1142 QDataStream stream( &encodedData, QIODevice::ReadOnly );
1151 while ( !stream.atEnd() )
1157 if ( !doc.setContent( text ) )
1159 QDomElement rootElem = doc.documentElement();
1160 if ( rootElem.tagName() != QLatin1String(
"rule_mime" ) )
1162 if ( rootElem.attribute( QStringLiteral(
"type" ) ) == QLatin1String(
"labeling" ) )
1163 rootElem.appendChild( doc.createElement( QStringLiteral(
"symbols" ) ) );
1164 QDomElement symbolsElem = rootElem.firstChildElement( QStringLiteral(
"symbols" ) );
1165 if ( symbolsElem.isNull() )
1168 QDomElement ruleElem = rootElem.firstChildElement( QStringLiteral(
"rule" ) );
1169 if ( rootElem.attribute( QStringLiteral(
"type" ) ) == QLatin1String(
"labeling" ) )
1182 if ( index.isValid() )
1183 return static_cast<QgsRuleBasedRenderer::Rule *>( index.internalPointer() );
1191 if ( row < 0 || row >= parentRule->
children().count() )
1194 QgsDebugMsg( QString(
"Called: row %1 count %2 parent ~~%3~~" ).arg( row ).arg( count ).arg( parentRule->
dump() ) );
1196 beginRemoveRows( parent, row, row + count - 1 );
1198 for (
int i = 0; i < count; i++ )
1200 if ( row < parentRule->children().count() )
1208 QgsDebugMsg(
"trying to remove invalid index - this should not happen!" );
1220 beginInsertRows( parent, before, before );
1222 QgsDebugMsg( QString(
"insert before %1 rule: %2" ).arg( before ).arg( newrule->
dump() ) );
1232 emit dataChanged(
index( row, 0, parent ),
1238 emit dataChanged(
index( 0, 0, idx ),
1241 for (
int i = 0; i <
rowCount( idx ); i++ )
1250 if ( !index.isValid() )
1253 beginRemoveRows( index.parent(), index.row(), index.row() );
1256 rule->parent()->removeChild( rule );
1264 beginInsertRows( parent, row, row + count - 1 );
The class is used as a container of context for various read/write operations on other objects...
Wrapper for iterator of features from vector data provider or vector layer.
QList< QgsExpressionContextScope * > globalProjectAtlasMapLayerScopes(const QgsMapLayer *layer) const
Returns list of scopes: global, project, atlas, map, layer.
QDomElement save(QDomDocument &doc, QgsSymbolMap &symbolMap) const
void insertRule(const QModelIndex &parent, int before, QgsRuleBasedRenderer::Rule *newrule)
Tree model for the rules:
QgsRuleBasedRenderer::RuleList descendants() const
Returns all children, grand-children, grand-grand-children, grand-gra...
QMimeData * mimeData(const QModelIndexList &indexes) const override
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Return a list of attributes required by this renderer.
bool isElse()
Check if this rule is an ELSE rule.
This class is a composition of two QSettings instances:
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
This class keeps data about a rules for rule-based renderer.
void setRendererScale(double scale)
Sets the renderer map scale.
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
void updateRule(const QModelIndex &parent, int row)
void setMinimumScale(double scale)
Sets the minimum map scale (i.e.
QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
QgsRuleBasedRenderer::RuleList & children()
Return all children rules of this rule.
bool dependsOnScale() const
void setForceOrderingEnabled(bool enabled)
double maximumScale() const
Returns the maximum map scale (i.e.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
int columnCount(const QModelIndex &=QModelIndex()) const override
QString description() const
A human readable description for this rule.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
void stopRender(QgsRenderContext &context) override
Must be called when a render cycle has finished, to allow the renderer to clean up.
bool active() const
Returns if this rule is active.
void saveGeometry(QWidget *widget, const QString &keyName)
Save the wigget geometry into settings.
QList< QgsRuleBasedRenderer::Rule * > RuleList
QString dump(int indent=0) const
Dump for debug purpose.
QgsFeatureRequest & setExpressionContext(const QgsExpressionContext &context)
Sets the expression context used to evaluate filter expressions.
bool restoreGeometry(QWidget *widget, const QString &keyName)
Restore the wigget geometry from settings.
void setValue(const QString &key, const QVariant &value, const QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
QgsRuleBasedRenderer::RuleList rulesForFeature(QgsFeature &feat, QgsRenderContext *context=nullptr)
tell which rules will be used to render the feature
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
static QgsSymbol * defaultSymbol(QgsWkbTypes::GeometryType geomType)
return new default symbol for specified geometry type
static QIcon symbolPreviewIcon(QgsSymbol *symbol, QSize size, int padding=0)
Returns an icon preview for a color ramp.
QgsFields fields() const override
Returns the list of fields of this layer.
static QDomElement saveSymbols(QgsSymbolMap &symbols, const QString &tagName, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a collection of symbols to XML with specified tagName for the top-level element.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown...
long featureCount(const QString &legendKey) const
Number of features rendered with specified legend key.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
This class wraps a request for features to a vector layer (or directly its vector data provider)...
When drawing a vector layer with rule-based renderer, it goes through the rules and draws features wi...
QgsRuleBasedRenderer::Rule * rootRule()
double minimumScale() const
Returns the minimum map scale (i.e.
void insertChild(int i, QgsRuleBasedRenderer::Rule *rule)
add child rule, take ownership, sets this as parent
Single scope for storing variables and functions for use within a QgsExpressionContext.
QHash< QgsRuleBasedRenderer::Rule *, QgsRuleBasedRendererCount > mFeatureCountMap
QModelIndex parent(const QModelIndex &index) const override
static QgsSymbolMap loadSymbols(QDomElement &element, const QgsReadWriteContext &context)
Reads a collection of symbols from XML and returns them in a map. Caller is responsible for deleting ...
void willAddRules(const QModelIndex &parent, int count)
QgsRuleBasedRendererModel(QgsRuleBasedRenderer *renderer, QObject *parent)
Constructor for QgsRuleBasedRendererModel, for the specified renderer.
void setMaximumScale(double scale)
Sets the maximum map scale (i.e.
A dialog which allows the user to modify the rendering order of symbol layers.
void setFeatureCounts(const QHash< QgsRuleBasedRenderer::Rule *, QgsRuleBasedRendererCount > &countMap)
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const override
Query the layer for features specified in request.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
QgsRuleBasedRenderer::Rule * ruleForIndex(const QModelIndex &index) const
static QString toString(double scale)
Helper function to convert a scale double to scale string.
Qt::ItemFlags flags(const QModelIndex &index) const override
QgsExpressionContext & expressionContext()
Gets the expression context.
static void refineRuleRanges(QgsRuleBasedRenderer::Rule *initialRule, QgsGraduatedSymbolRenderer *r)
take a rule and create a list of new rules based on the ranges from graduated symbol renderer ...
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
void setActive(bool state)
Sets if this rule is active.
QgsRuleBasedRenderer::Rule * clone() const
clone this rule, return new instance
Contains information about the context of a rendering operation.
void clearFeatureCounts()
void startRender(QgsRenderContext &context, const QgsFields &fields) override
Must be called when a new render cycle is started.
void setLabel(const QString &label)
~QgsRendererRulePropsDialog() override
virtual QgsSymbol * clone() const =0
Get a deep copy of this symbol.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), const Section section=NoSection) const
Returns the value for setting key.
static QgsRuleBasedRenderer * convertFromRenderer(const QgsFeatureRenderer *renderer)
creates a QgsRuleBasedRenderer from an existing renderer.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
QMap< QString, QgsSymbol *> QgsSymbolMap
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
void finishedAddingRules()
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
static void refineRuleCategories(QgsRuleBasedRenderer::Rule *initialRule, QgsCategorizedSymbolRenderer *r)
take a rule and create a list of new rules based on the categories from categorized symbol renderer ...
QgsRuleBasedRenderer * mR
QList< int > QgsAttributeList
QString filter(const QgsFields &fields=QgsFields()) override
If a renderer does not require all the features this method may be overridden and return an expressio...
void setFilterExpression(const QString &filterExp)
Set the expression used to check if a given feature shall be rendered with this rule.
bool nextFeature(QgsFeature &f)
static void refineRuleScales(QgsRuleBasedRenderer::Rule *initialRule, QList< int > scales)
take a rule and create a list of new rules with intervals of scales given by the passed scale denomin...
void removeChildAt(int i)
delete child rule
QString filterExpression() const
A filter that will check if this rule applies.
static QgsRuleBasedRenderer::Rule * create(QDomElement &ruleElem, QgsSymbolMap &symbolMap)
Create a rule from an XML definition.
Geometry is not required. It may still be returned if e.g. required for a filter condition.
Qt::DropActions supportedDropActions() const override
Represents a vector layer which manages a vector based data sets.
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
A generic dialog for building expression strings.
void removeRule(const QModelIndex &index)
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context.
QgsRendererRulePropsDialog(QgsRuleBasedRenderer::Rule *rule, QgsVectorLayer *layer, QgsStyle *style, QWidget *parent=nullptr, const QgsSymbolWidgetContext &context=QgsSymbolWidgetContext())
Constructor for QgsRendererRulePropsDialog.
QStringList mimeTypes() const override
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Set flags that affect how features will be fetched.
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer...
QgsRuleBasedRenderer::Rule * parent()
The parent rule.