38 #include <QMessageBox> 52 if ( !iconName.isEmpty() )
56 if ( pix.
load( iconPath ) )
66 static bool initialized =
false;
86 , mActiveWidget( nullptr )
87 , mPaintEffect( nullptr )
88 , mMapCanvas( nullptr )
91 mLayerRenderingGroupBox->setSettingGroup(
"layerRenderingGroupBox" );
105 Q_FOREACH (
const QString& name, renderers )
111 cboRenderers->setCurrentIndex( -1 );
116 connect( mLayerTransparencySlider, SIGNAL( valueChanged(
int ) ), mLayerTransparencySpnBx, SLOT( setValue(
int ) ) );
117 connect( mLayerTransparencySpnBx, SIGNAL( valueChanged(
int ) ), mLayerTransparencySlider, SLOT( setValue(
int ) ) );
120 connect( checkboxEnableOrderBy, SIGNAL( toggled(
bool ) ), btnOrderBy, SLOT(
setEnabled(
bool ) ) );
121 connect( btnOrderBy, SIGNAL( clicked(
bool ) ),
this, SLOT( showOrderByDialog() ) );
126 widgets << mLayerTransparencySpnBx
128 << checkboxEnableOrderBy
129 << mBlendModeComboBox
130 << mFeatureBlendComboBox
139 Q_FOREACH (
QWidget* widget, widgets )
143 connect( w, SIGNAL( dataDefinedActivated(
bool ) ),
this, slot );
144 connect( w, SIGNAL( dataDefinedChanged(
QString ) ),
this, slot );
150 else if (
QComboBox* w = qobject_cast<QComboBox*>( widget ) )
152 connect( w, SIGNAL( currentIndexChanged(
int ) ),
this, slot );
154 else if (
QSpinBox* w = qobject_cast<QSpinBox*>( widget ) )
156 connect( w, SIGNAL( valueChanged(
int ) ),
this, slot );
158 else if (
QDoubleSpinBox* w = qobject_cast<QDoubleSpinBox*>( widget ) )
160 connect( w , SIGNAL( valueChanged(
double ) ),
this, slot );
166 else if (
QCheckBox* w = qobject_cast<QCheckBox*>( widget ) )
168 connect( w, SIGNAL( toggled(
bool ) ),
this, slot );
170 else if (
QLineEdit* w = qobject_cast<QLineEdit*>( widget ) )
177 connect( w, SIGNAL( changed() ),
this, slot );
196 mDockMode = dockMode;
197 mEffectWidget->setDockMode( dockMode );
205 if ( cboRenderers->currentIndex() == -1 )
207 QgsDebugMsg(
"No current item -- this should never happen!" );
211 QString rendererName = cboRenderers->itemData( cboRenderers->currentIndex() ).toString();
259 stackedWidget->setCurrentWidget( pageNoWidget );
325 void QgsRendererV2PropertiesDialog::syncToLayer()
354 checkboxEnableOrderBy->setChecked(
true );
358 btnOrderBy->setEnabled(
false );
359 checkboxEnableOrderBy->setChecked(
false );
367 int rendererIdx = cboRenderers->findData( rendererName );
368 cboRenderers->setCurrentIndex( rendererIdx );
371 Q_ASSERT( rendererIdx != -1 &&
"there must be a renderer!" );
376 void QgsRendererV2PropertiesDialog::showOrderByDialog()
391 checkboxEnableOrderBy->setChecked( orderByEnabled );
394 void QgsRendererV2PropertiesDialog::updateUIState(
bool hidden )
396 mLayerRenderingGroupBox->setHidden( hidden );
397 cboRenderers->setHidden( hidden );
QgsMapCanvas * mMapCanvas
void showPanel(QgsPanelWidget *panel)
Emit when you require a panel to be show in the interface.
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the dialog.
static QgsRendererV2Registry * instance()
Returns a pointer to the QgsRendererV2Registry singleton.
QByteArray toByteArray() const
QgsFeatureRequest::OrderBy mOrderBy
This is a dialog to build and manage a list of order by clauses.
void setContentsMargins(int left, int top, int right, int bottom)
void setOrderBy(const QgsFeatureRequest::OrderBy &orderBy)
Set the order by to manage.
static QString defaultThemePath()
Returns the path to the default theme directory.
void setRendererV2(QgsFeatureRendererV2 *r)
Set renderer which will be invoked to represent this layer.
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 setFeatureBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering each feature.
QgsRendererV2PropertiesDialog(QgsVectorLayer *layer, QgsStyleV2 *style, bool embedded=false, QWidget *parent=nullptr)
Constructor for QgsRendererV2PropertiesDialog.
void setLayerTransparency(int layerTransparency)
Set the transparency for the vector layer.
QString iconPath(const QString &iconFile)
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
Map canvas is a class for displaying all GIS data types on a canvas.
QgsRendererV2AbstractMetadata * rendererMetadata(const QString &rendererName)
Returns the metadata for a specified renderer.
virtual QgsPaintEffect * clone() const =0
Duplicates an effect by creating a deep copy of the effect.
static void _initRendererWidgetFunctions()
void setValue(const QString &key, const QVariant &value)
const char * name() const
virtual QgsFeatureRendererV2 * clone() const =0
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
void layerVariablesChanged()
Emitted when expression context variables on the associated vector layers have been changed...
void setOrderByEnabled(bool enabled)
Sets whether custom ordering should be applied before features are processed by this renderer...
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the renderer.
void connectValueChanged(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...
int layerTransparency() const
Returns the current transparency for the vector layer.
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the renderer.
void setDockMode(bool dockMode)
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs...
bool load(const QString &fileName, const char *format, QFlags< Qt::ImageConversionFlag > flags)
QPainter::CompositionMode featureBlendMode() const
Returns the current blending mode for features.
static bool _initRenderer(const QString &name, QgsRendererV2WidgetFunc f, const QString &iconName=QString())
void rendererChanged()
called when user changes renderer type
void onOK()
Apply and accept the changes for the dialog.
virtual void keyPressEvent(QKeyEvent *e)
QgsFeatureRequest::OrderBy orderBy() const
Get the order in which features shall be processed by this renderer.
QVariant value(const QString &key, const QVariant &defaultValue) const
void setOrderBy(const QgsFeatureRequest::OrderBy &orderBy)
Define the order in which features shall be processed by this renderer.
bool orderByEnabled() const
Returns whether custom ordering will be applied before features are processed by this renderer...
void keyPressEvent(QKeyEvent *event) override
Reimplements dialog keyPress event so we can ignore it.
void widgetChanged()
Emitted when something on the widget has changed.
QgsPaintEffect * mPaintEffect
~QgsRendererV2PropertiesDialog()
QStringList renderersList(QgsRendererV2AbstractMetadata::LayerTypes layerTypes=QgsRendererV2AbstractMetadata::All) const
Returns a list of available renderers.
QgsFeatureRequest::OrderBy orderBy()
Get the order by defined in the dialog.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void apply()
Apply the changes from the dialog to the layer.
Represents a vector layer which manages a vector based data sets.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QgsRendererV2Widget *(* QgsRendererV2WidgetFunc)(QgsVectorLayer *, QgsStyleV2 *, QgsFeatureRendererV2 *)
Represents a list of OrderByClauses, with the most important first and the least important last...
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
QDialog(QWidget *parent, QFlags< Qt::WindowType > f)
QgsRendererV2Widget * mActiveWidget