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.at( 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.at( 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 );
   648     groupScale->setChecked( 
true );
   649     mScaleRangeWidget->setMaximumScale( std::max( rule->
maximumScale(), 0.0 ) );
   650     mScaleRangeWidget->setMinimumScale( std::max( rule->
minimumScale(), 0.0 ) );
   656     groupSymbol->setChecked( 
true );
   661     groupSymbol->setChecked( 
false );
   666   mSymbolSelector->setContext( 
mContext );
   670   QVBoxLayout *l = 
new QVBoxLayout;
   671   l->addWidget( mSymbolSelector );
   672   groupSymbol->setLayout( l );
   682   connect( mFilterRadio, &QRadioButton::toggled, 
this, [ = ]( 
bool toggled ) { filterFrame->setEnabled( toggled ) ; } );
   683   connect( mElseRadio, &QRadioButton::toggled, 
this, [ = ]( 
bool toggled ) { 
if ( toggled ) editFilter->setText( QStringLiteral( 
"ELSE" ) );} );
   693   setWindowModality( Qt::WindowModal );
   696   QVBoxLayout *layout = 
new QVBoxLayout( 
this );
   698   layout->addWidget( scrollArea );
   700   buttonBox = 
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
   703   scrollArea->setWidget( mPropsWidget );
   704   layout->addWidget( buttonBox );
   705   this->setWindowTitle( 
"Edit Rule" );
   708   connect( buttonBox, &QDialogButtonBox::rejected, 
this, &QDialog::reject );
   709   connect( buttonBox, &QDialogButtonBox::helpRequested, 
this, &QgsRendererRulePropsDialog::showHelp );
   712   restoreGeometry( settings.
value( QStringLiteral( 
"Windows/QgsRendererRulePropsDialog/geometry" ) ).toByteArray() );
   718   settings.
setValue( QStringLiteral( 
"Windows/QgsRendererRulePropsDialog/geometry" ), 
saveGeometry() );
   733   mPropsWidget->
apply();
   737 void QgsRendererRulePropsDialog::showHelp()
   739   QgsHelp::openHelp( QStringLiteral( 
"working_with_vector/vector_properties.html#rule-based-rendering" ) );
   756     editFilter->setText( dlg.expressionText() );
   761   if ( !mFilterRadio->isChecked() )
   765   if ( filter.hasParserError() )
   767     QMessageBox::critical( 
this, tr( 
"Test Filter" ),  tr( 
"Filter expression parsing error:\n" ) + filter.parserErrorString() );
   779   if ( !filter.prepare( &context ) )
   781     QMessageBox::critical( 
this, tr( 
"Test Filter" ), filter.evalErrorString() );
   785   QApplication::setOverrideCursor( Qt::WaitCursor );
   790                           .setExpressionContext( context );
   801   QApplication::restoreOverrideCursor();
   803   QMessageBox::information( 
this, tr( 
"Test Filter" ), tr( 
"Filter returned %n feature(s)", 
"number of filtered features", count ) );
   808   QString filter = mElseRadio->isChecked() ? QStringLiteral( 
"ELSE" ) : editFilter->text();
   809   mRule->setFilterExpression( filter );
   810   mRule->setLabel( editLabel->text() );
   811   mRule->setDescription( editDescription->text() );
   813   mRule->setMinimumScale( groupScale->isChecked() ? mScaleRangeWidget->minimumScale() : 0 );
   814   mRule->setMaximumScale( groupScale->isChecked() ? mScaleRangeWidget->maximumScale() : 0 );
   815   mRule->setSymbol( groupSymbol->isChecked() ? mSymbol->clone() : nullptr );
   821   mSymbolSelector->setDockMode( dockMode );
   836   : QAbstractItemModel( parent )
   843   if ( !index.isValid() )
   844     return Qt::ItemIsDropEnabled;
   847   Qt::ItemFlag drop = ( index.column() == 0 ? Qt::ItemIsDropEnabled : Qt::NoItemFlags );
   849   Qt::ItemFlag checkable = ( index.column() == 0 ? Qt::ItemIsUserCheckable : Qt::NoItemFlags );
   851   return Qt::ItemIsEnabled | Qt::ItemIsSelectable |
   852          Qt::ItemIsEditable | checkable |
   853          Qt::ItemIsDragEnabled | drop;
   858   if ( !index.isValid() )
   863   if ( role == Qt::DisplayRole || role == Qt::ToolTipRole )
   865     switch ( index.column() )
   868         return rule->
label();
   891           if ( role == Qt::DisplayRole )
   899               QString tip = QStringLiteral( 
"<p style='margin:0px;'><ul>" );
   901               for ( 
auto it = duplicateMap.constBegin(); it != duplicateMap.constEnd(); ++it )
   903                 QString label = it.key()->label().replace( 
'&', QLatin1String( 
"&" ) ).replace( 
'>', QLatin1String( 
">" ) ).replace( 
'<', QLatin1String( 
"<" ) );
   904                 tip += tr( 
"<li><nobr>%1 features also in rule %2</nobr></li>" ).arg( it.value() ).arg( label );
   906               tip += QLatin1String( 
"</ul>" );
   920   else if ( role == Qt::DecorationRole && index.column() == 0 && rule->
symbol() )
   924   else if ( role == Qt::TextAlignmentRole )
   926     return ( index.column() == 2 || index.column() == 3 ) ? Qt::AlignRight : Qt::AlignLeft;
   928   else if ( role == Qt::FontRole && index.column() == 1 )
   933       italicFont.setItalic( 
true );
   938   else if ( role == Qt::EditRole )
   940     switch ( index.column() )
   943         return rule->
label();
   954   else if ( role == Qt::CheckStateRole )
   956     if ( index.column() != 0 )
   958     return rule->
active() ? Qt::Checked : Qt::Unchecked;
   966   if ( orientation == Qt::Horizontal && role == Qt::DisplayRole && section >= 0 && section < 7 )
   969     lst << tr( 
"Label" ) << tr( 
"Rule" ) << tr( 
"Min. scale" ) << tr( 
"Max. scale" ) << tr( 
"Count" ) << tr( 
"Duplicate count" );
   972   else if ( orientation == Qt::Horizontal && role == Qt::ToolTipRole )
   976       return tr( 
"Number of features in this rule." );
   978     else if ( section == 5 )  
   980       return tr( 
"Number of features in this rule which are also present in other rule(s)." );
   989   if ( parent.column() > 0 )
   994   return parentRule->
children().count();
  1004   if ( hasIndex( row, column, parent ) )
  1008     return createIndex( row, column, childRule );
  1010   return QModelIndex();
  1015   if ( !index.isValid() )
  1016     return QModelIndex();
  1022     return QModelIndex();
  1025   int row = parentRule->
parent()->
children().indexOf( parentRule );
  1027   return createIndex( row, 0, parentRule );
  1032   if ( !index.isValid() )
  1037   if ( role == Qt::CheckStateRole )
  1039     rule->
setActive( value.toInt() == Qt::Checked );
  1040     emit dataChanged( index, index );
  1044   if ( role != Qt::EditRole )
  1047   switch ( index.column() )
  1050       rule->
setLabel( value.toString() );
  1065   emit dataChanged( index, index );
  1071   return Qt::MoveAction; 
  1077   types << QStringLiteral( 
"application/vnd.text.list" );
  1083   QMimeData *
mimeData = 
new QMimeData();
  1084   QByteArray encodedData;
  1086   QDataStream stream( &encodedData, QIODevice::WriteOnly );
  1088   Q_FOREACH ( 
const QModelIndex &
index, indexes )
  1091     if ( !index.isValid() || index.column() != 0 )
  1100     QDomElement rootElem = doc.createElement( QStringLiteral( 
"rule_mime" ) );
  1101     rootElem.setAttribute( QStringLiteral( 
"type" ), QStringLiteral( 
"renderer" ) ); 
  1102     QDomElement rulesElem = rule->
save( doc, symbols );
  1103     rootElem.appendChild( rulesElem );
  1105     rootElem.appendChild( symbolsElem );
  1106     doc.appendChild( rootElem );
  1110     stream << doc.toString( -1 );
  1113   mimeData->setData( QStringLiteral( 
"application/vnd.text.list" ), encodedData );
  1122   if ( ruleElem.hasAttribute( QStringLiteral( 
"description" ) ) )
  1123     ruleElem.setAttribute( QStringLiteral( 
"label" ), ruleElem.attribute( QStringLiteral( 
"description" ) ) );
  1126   QDomElement childRuleElem = ruleElem.firstChildElement( QStringLiteral( 
"rule" ) );
  1127   while ( !childRuleElem.isNull() )
  1130     childRuleElem = childRuleElem.nextSiblingElement( QStringLiteral( 
"rule" ) );
  1136     Qt::DropAction action, 
int row, 
int column, 
const QModelIndex &
parent )
  1140   if ( action == Qt::IgnoreAction )
  1143   if ( !data->hasFormat( QStringLiteral( 
"application/vnd.text.list" ) ) )
  1146   if ( parent.column() > 0 )
  1149   QByteArray encodedData = data->data( QStringLiteral( 
"application/vnd.text.list" ) );
  1150   QDataStream stream( &encodedData, QIODevice::ReadOnly );
  1159   while ( !stream.atEnd() )
  1165     if ( !doc.setContent( text ) )
  1167     QDomElement rootElem = doc.documentElement();
  1168     if ( rootElem.tagName() != QLatin1String( 
"rule_mime" ) )
  1170     if ( rootElem.attribute( QStringLiteral( 
"type" ) ) == QLatin1String( 
"labeling" ) )
  1171       rootElem.appendChild( doc.createElement( QStringLiteral( 
"symbols" ) ) );
  1172     QDomElement symbolsElem = rootElem.firstChildElement( QStringLiteral( 
"symbols" ) );
  1173     if ( symbolsElem.isNull() )
  1176     QDomElement ruleElem = rootElem.firstChildElement( QStringLiteral( 
"rule" ) );
  1177     if ( rootElem.attribute( QStringLiteral( 
"type" ) ) == QLatin1String( 
"labeling" ) )
  1190   if ( index.isValid() )
  1191     return static_cast<QgsRuleBasedRenderer::Rule *>( index.internalPointer() );
  1199   if ( row < 0 || row >= parentRule->
children().count() )
  1202   QgsDebugMsg( QString( 
"Called: row %1 count %2 parent ~~%3~~" ).arg( row ).arg( count ).arg( parentRule->
dump() ) );
  1204   beginRemoveRows( parent, row, row + count - 1 );
  1206   for ( 
int i = 0; i < count; i++ )
  1208     if ( row < parentRule->children().count() )
  1216       QgsDebugMsg( 
"trying to remove invalid index - this should not happen!" );
  1228   beginInsertRows( parent, before, before );
  1230   QgsDebugMsg( QString( 
"insert before %1 rule: %2" ).arg( before ).arg( newrule->
dump() ) );
  1240   emit dataChanged( 
index( row, 0, parent ),
  1246   emit dataChanged( 
index( 0, 0, idx ),
  1249   for ( 
int i = 0; i < 
rowCount( idx ); i++ )
  1258   if ( !index.isValid() )
  1261   beginRemoveRows( index.parent(), index.row(), index.row() );
  1264   rule->parent()->removeChild( rule );
  1272   beginInsertRows( parent, row, row + count - 1 );
 
Class for parsing and evaluation of expressions (formerly called "search strings"). 
 
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
Returns a list of attributes required by this renderer. 
 
This class is a composition of two QSettings instances: 
 
const QgsRuleBasedRenderer::RuleList & children()
Returns all children rules of this rule. 
 
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key. 
 
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. 
 
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
 
bool isElse() const
Check if this rule is an ELSE rule. 
 
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. 
 
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression. 
 
static QgsSymbol * defaultSymbol(QgsWkbTypes::GeometryType geomType)
Returns 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...
 
QgsRuleBasedRenderer::RuleList rulesForFeature(const QgsFeature &feature, QgsRenderContext *context=nullptr, bool onlyActive=true)
Returns the list of rules used to render the feature in a specific context. 
 
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
 
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value. 
 
virtual QgsSymbol * clone() const =0
Gets a deep copy of this symbol. 
 
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)
Sets 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.