| 
    QGIS API Documentation
    3.26.3-Buenos Aires (65e4edfdad)
    
   | 
 
 
 
 
Go to the documentation of this file.
   44 #include <QMessageBox> 
   46 static bool _initRenderer( 
const QString &name, 
QgsRendererWidgetFunc f, 
const QString &iconName = QString() )
 
   58   if ( !iconName.isEmpty() )
 
   67 static void _initRendererWidgetFunctions()
 
   69   static bool sInitialized = 
false;
 
   96   mLayerRenderingGroupBox->setSettingGroup( QStringLiteral( 
"layerRenderingGroupBox" ) );
 
  102     layout()->setContentsMargins( 0, 0, 0, 0 );
 
  106   _initRendererWidgetFunctions();
 
  110   const auto constRenderers = renderers;
 
  111   for ( 
const QString &name : constRenderers )
 
  117   cboRenderers->setCurrentIndex( -1 ); 
 
  123   connect( checkboxEnableOrderBy, &QAbstractButton::toggled, btnOrderBy, &QWidget::setEnabled );
 
  124   connect( btnOrderBy, &QAbstractButton::clicked, 
this, &QgsRendererPropertiesDialog::showOrderByDialog );
 
  128   QList<QWidget *> widgets;
 
  129   widgets << mOpacityWidget
 
  131           << checkboxEnableOrderBy
 
  132           << mBlendModeComboBox
 
  133           << mFeatureBlendComboBox
 
  142   for ( QWidget *widget : widgets )
 
  146       connect( w, SIGNAL( changed ), 
this, slot );
 
  150       connect( w, SIGNAL( fieldChanged( QString ) ), 
this,  slot );
 
  152     else if ( 
QgsOpacityWidget *w = qobject_cast<QgsOpacityWidget *>( widget ) )
 
  154       connect( w, SIGNAL( opacityChanged( 
double ) ), 
this,  slot );
 
  156     else if ( QComboBox *w = qobject_cast<QComboBox *>( widget ) )
 
  158       connect( w, SIGNAL( currentIndexChanged( 
int ) ), 
this, slot );
 
  160     else if ( QSpinBox *w = qobject_cast<QSpinBox *>( widget ) )
 
  162       connect( w, SIGNAL( valueChanged( 
int ) ), 
this, slot );
 
  164     else if ( QDoubleSpinBox *w = qobject_cast<QDoubleSpinBox *>( widget ) )
 
  166       connect( w, SIGNAL( valueChanged( 
double ) ), 
this, slot );
 
  168     else if ( 
QgsColorButton *w = qobject_cast<QgsColorButton *>( widget ) )
 
  170       connect( w, SIGNAL( colorChanged( QColor ) ), 
this, slot );
 
  172     else if ( QCheckBox *w = qobject_cast<QCheckBox *>( widget ) )
 
  174       connect( w, SIGNAL( toggled( 
bool ) ), 
this, slot );
 
  176     else if ( QLineEdit *w = qobject_cast<QLineEdit *>( widget ) )
 
  178       connect( w, SIGNAL( textEdited( QString ) ), 
this, slot );
 
  179       connect( w, SIGNAL( textChanged( QString ) ), 
this, slot );
 
  183       connect( w, SIGNAL( changed() ), 
this, slot );
 
  216   mDockMode = dockMode;
 
  217   mEffectWidget->setDockMode( dockMode );
 
  225   if ( cboRenderers->currentIndex() == -1 )
 
  227     QgsDebugMsg( QStringLiteral( 
"No current item -- this should never happen!" ) );
 
  231   const QString rendererName = cboRenderers->currentData().toString();
 
  284     stackedWidget->setCurrentWidget( pageNoWidget );
 
  331     QDialog *dlg = 
new QDialog();
 
  332     const QString key = QStringLiteral( 
"/UI/paneldialog/%1" ).arg( panel->
panelTitle() );
 
  334     dlg->restoreGeometry( settings.
value( key ).toByteArray() );
 
  336     dlg->setLayout( 
new QVBoxLayout() );
 
  337     dlg->layout()->addWidget( panel );
 
  338     QDialogButtonBox *buttonBox = 
new QDialogButtonBox( QDialogButtonBox::Ok );
 
  339     connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
 
  340     dlg->layout()->addWidget( buttonBox );
 
  342     settings.
setValue( key, dlg->saveGeometry() );
 
  347 void QgsRendererPropertiesDialog::syncToLayer()
 
  350   mFeatureBlendComboBox->setShowClippingModes( mBlendModeComboBox->showClippingModes() );
 
  378     checkboxEnableOrderBy->setChecked( 
true );
 
  382     btnOrderBy->setEnabled( 
false );
 
  383     checkboxEnableOrderBy->setChecked( 
false );
 
  391     const int rendererIdx = cboRenderers->findData( rendererName );
 
  392     cboRenderers->setCurrentIndex( rendererIdx );
 
  395     Q_ASSERT( rendererIdx != -1 && 
"there must be a renderer!" );
 
  400 void QgsRendererPropertiesDialog::showOrderByDialog()
 
  415   checkboxEnableOrderBy->setChecked( orderByEnabled );
 
  418 void QgsRendererPropertiesDialog::updateUIState( 
bool hidden )
 
  420   mLayerRenderingGroupBox->setHidden( hidden );
 
  421   cboRenderers->setHidden( hidden );
 
  428   if ( !isWindow() && e->key() == Qt::Key_Escape )
 
  434     QDialog::keyPressEvent( e );
 
  
void setRenderer(QgsFeatureRenderer *r)
Sets the feature renderer which will be invoked to represent this layer in 2D map views.
 
~QgsRendererPropertiesDialog() override
 
void showPanel(QgsPanelWidget *panel)
Emit when you require a panel to be show in the interface.
 
QgsFeatureRequest::OrderBy mOrderBy
 
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
 
static QgsRendererRegistry * rendererRegistry()
Returns the application's renderer registry, used for managing vector layer renderers.
 
QPainter::CompositionMode featureBlendMode() const
Returns the current blending mode for features.
 
static bool layerIsContainedInGroupLayer(QgsProject *project, QgsMapLayer *layer)
Returns true if the specified layer is a child layer from any QgsGroupLayer in the given project.
 
void apply()
Apply the changes from the dialog to the layer.
 
QgsPaintEffect * mPaintEffect
 
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
 
void setOrderByEnabled(bool enabled)
Sets whether custom ordering should be applied before features are processed by this renderer.
 
#define QgsDebugMsgLevel(str, level)
 
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
 
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
 
Map canvas is a class for displaying all GIS data types on a canvas.
 
void setDockMode(bool dockMode)
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
 
static QgsProject * instance()
Returns the QgsProject singleton instance.
 
This class is a composition of two QSettings instances:
 
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
 
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the dialog.
 
void rendererChanged()
called when user changes renderer type
 
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
 
QgsFeatureRequest::OrderBy orderBy() const
Gets the order in which features shall be processed by this renderer.
 
QgsRendererWidget * mActiveWidget
 
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
 
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
 
QgsRendererWidget *(* QgsRendererWidgetFunc)(QgsVectorLayer *, QgsStyle *, QgsFeatureRenderer *)
 
void layerVariablesChanged()
Emitted when expression context variables on the associated vector layers have been changed.
 
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
 
virtual QgsPaintEffect * clone() const =0
Duplicates an effect by creating a deep copy of the effect.
 
virtual void setOpacity(double opacity)
Sets the opacity for the layer, where opacity is a value between 0 (totally transparent) and 1....
 
QgsRendererPropertiesDialog(QgsVectorLayer *layer, QgsStyle *style, bool embedded=false, QWidget *parent=nullptr)
Constructor for QgsRendererPropertiesDialog.
 
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
 
void onOK()
Apply and accept the changes for the dialog.
 
QStringList renderersList(QgsRendererAbstractMetadata::LayerTypes layerTypes=QgsRendererAbstractMetadata::All) const
Returns a list of available renderers.
 
QgsMessageBar * mMessageBar
 
void widgetChanged()
Emitted when something on the widget has changed.
 
void openPanel(QgsPanelWidget *panel)
Open a panel or dialog depending on dock mode setting If dock mode is true this method will emit the ...
 
void keyPressEvent(QKeyEvent *event) override
 
Represents a list of OrderByClauses, with the most important first and the least important last.
 
Represents a vector layer which manages a vector based data sets.
 
bool orderByEnabled() const
Returns whether custom ordering will be applied before features are processed by this renderer.
 
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the renderer.
 
void setOrderBy(const QgsFeatureRequest::OrderBy &orderBy)
Define the order in which features shall be processed by this renderer.
 
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
 
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
 
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the renderer.
 
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the dialog is shown, e.g., the associated map canvas and expression context...
 
QgsRendererAbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
 
QgsMapCanvas * mMapCanvas
 
void setFeatureBlendMode(QPainter::CompositionMode blendMode)
Sets the blending mode used for rendering each feature.
 
This is a dialog to build and manage a list of order by clauses.
 
QgsFeatureRenderer * renderer()
Returns the feature renderer used for rendering the features in the layer in 2D map views.
 
void connectValueChanged(const QList< QWidget * > &widgets, const char *slot)
Connect the given slot to the value changed event for the set of widgets Each widget is checked for t...