From 831e7cd23633bf16a54b8175b35c76154ac1284f Mon Sep 17 00:00:00 2001 From: Nathan Woodrow Date: Tue, 19 Apr 2016 09:44:12 +1000 Subject: [PATCH] [FEATURE][styles] Add new style dock for interactive styling --- python/gui/qgsfieldexpressionwidget.sip | 3 + src/app/CMakeLists.txt | 2 + src/app/qgisapp.cpp | 85 ++- src/app/qgisapp.h | 18 +- src/app/qgslabelinggui.cpp | 406 ++++++++-- src/app/qgslabelinggui.h | 8 + src/app/qgslabelingwidget.cpp | 106 ++- src/app/qgslabelingwidget.h | 15 + src/app/qgsmapstylingwidget.cpp | 113 +++ src/app/qgsmapstylingwidget.h | 46 ++ src/app/qgsrulebasedlabelingwidget.cpp | 140 +++- src/app/qgsrulebasedlabelingwidget.h | 33 +- src/gui/qgisgui.cpp | 1 - src/gui/qgsfieldexpressionwidget.h | 3 + src/ui/qgslabelingguibase.ui | 937 ++++++++---------------- src/ui/qgslabelingrulepropsdialog.ui | 180 +++-- src/ui/qgslabelingwidget.ui | 10 + src/ui/qgsrulebasedlabelingwidget.ui | 184 ++--- 18 files changed, 1360 insertions(+), 930 deletions(-) create mode 100644 src/app/qgsmapstylingwidget.cpp create mode 100644 src/app/qgsmapstylingwidget.h diff --git a/python/gui/qgsfieldexpressionwidget.sip b/python/gui/qgsfieldexpressionwidget.sip index 5644260c1f9..24bfb1e6fd9 100644 --- a/python/gui/qgsfieldexpressionwidget.sip +++ b/python/gui/qgsfieldexpressionwidget.sip @@ -84,6 +84,9 @@ class QgsFieldExpressionWidget : QWidget //! convenience slot to connect QgsMapLayerComboBox layer signal void setLayer( QgsMapLayer* layer ); + //! sets the current row in the widget + void setRow( int row ); + //! sets the current field or expression in the widget void setField( const QString &fieldName ); diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index b02fb26809c..3b2a22109f5 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -94,6 +94,7 @@ SET(QGIS_APP_SRCS nodetool/qgsvertexentry.cpp nodetool/qgsnodeeditor.cpp + qgsmapstylingwidget.cpp qgsmeasuredialog.cpp qgsmeasuretool.cpp qgsmergeattributesdialog.cpp @@ -268,6 +269,7 @@ SET (QGIS_APP_MOC_HDRS nodetool/qgsselectedfeature.h nodetool/qgsnodeeditor.h + qgsmapstylingwidget.h qgsmeasuredialog.h qgsmeasuretool.h qgsmergeattributesdialog.h diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index e61b8f1c4fa..d9ab19d4dc6 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -75,6 +75,7 @@ #include #include #include +#include #include #include @@ -716,6 +717,16 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh addDockWidget( Qt::LeftDockWidgetArea, mUndoWidget ); mUndoWidget->hide(); + mMapStylingDock = new QDockWidget( this ); + mMapStylingDock->setWindowTitle( tr( "Map Styling" ) ); + mMapStyleWidget = new QgsMapStylingWidget( mMapCanvas ); + mMapStylingDock->setWidget( mMapStyleWidget ); + + connect( mMapStyleWidget, SIGNAL( styleChanged( QgsMapLayer* ) ), this, SLOT( updateLabelToolButtons() ) ); + + addDockWidget( Qt::RightDockWidgetArea, mMapStylingDock ); + mMapStylingDock->hide(); + mSnappingDialog = new QgsSnappingDialog( this, mMapCanvas ); mSnappingDialog->setObjectName( "SnappingOption" ); @@ -2399,6 +2410,9 @@ void QgisApp::setupConnections() // connect legend signals connect( mLayerTreeView, SIGNAL( currentLayerChanged( QgsMapLayer * ) ), this, SLOT( activateDeactivateLayerRelatedActions( QgsMapLayer * ) ) ); + connect( mLayerTreeView, SIGNAL( currentLayerChanged( QgsMapLayer * ) ), + this, SLOT( setMapStyleDockLayer( QgsMapLayer* ) ) ); + connect( mLayerTreeView->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), this, SLOT( legendLayerSelectionChanged() ) ); connect( mLayerTreeView->layerTreeModel()->rootGroup(), SIGNAL( addedChildren( QgsLayerTreeNode*, int, int ) ), @@ -2748,6 +2762,11 @@ void QgisApp::initLayerTreeView() mLegendExpressionFilterButton->setToolTip( tr( "Filter legend by expression" ) ); connect( mLegendExpressionFilterButton, SIGNAL( toggled( bool ) ), this, SLOT( toggleFilterLegendByExpression( bool ) ) ); + mActionStyleDock = new QAction( tr( "Map Styling" ), this ); + mActionStyleDock->setToolTip( tr( "Open the map styling dock" ) ); + mActionStyleDock->setIcon( QgsApplication::getThemeIcon( "propertyicons/symbology.png" ) ); + connect( mActionStyleDock, SIGNAL( triggered() ), this, SLOT( mapStyleDock() ) ); + // expand / collapse tool buttons QAction* actionExpandAll = new QAction( tr( "Expand All" ), this ); actionExpandAll->setIcon( QgsApplication::getThemeIcon( "/mActionExpandTree.svg" ) ); @@ -2758,6 +2777,9 @@ void QgisApp::initLayerTreeView() actionCollapseAll->setToolTip( tr( "Collapse All" ) ); connect( actionCollapseAll, SIGNAL( triggered( bool ) ), mLayerTreeView, SLOT( collapseAll() ) ); + QWidget* spacer = new QWidget(); + spacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); + QToolBar* toolbar = new QToolBar(); toolbar->setIconSize( QSize( 16, 16 ) ); toolbar->addAction( actionAddGroup ); @@ -2767,6 +2789,8 @@ void QgisApp::initLayerTreeView() toolbar->addAction( actionExpandAll ); toolbar->addAction( actionCollapseAll ); toolbar->addAction( mActionRemoveLayer ); + toolbar->addWidget( spacer ); + toolbar->addAction( mActionStyleDock ); QVBoxLayout* vboxLayout = new QVBoxLayout; vboxLayout->setMargin( 0 ); @@ -5460,47 +5484,33 @@ void QgisApp::labeling() QgsVectorLayer *vlayer = qobject_cast( activeLayer() ); if ( !vlayer ) { - messageBar()->pushMessage( tr( "Labeling Options" ), - tr( "Please select a vector layer first" ), - QgsMessageBar::INFO, - messageTimeout() ); return; } + mapStyleDock(); +} - QDialog dlg; - dlg.setWindowTitle( tr( "Layer labeling settings" ) ); - QgsLabelingWidget *labelingGui = new QgsLabelingWidget( vlayer, mMapCanvas, &dlg ); - labelingGui->layout()->setContentsMargins( 0, 0, 0, 0 ); - QVBoxLayout *layout = new QVBoxLayout( &dlg ); - layout->addWidget( labelingGui ); - - QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Apply, Qt::Horizontal, &dlg ); - layout->addWidget( buttonBox ); - - dlg.setLayout( layout ); - - QSettings settings; - dlg.restoreGeometry( settings.value( "/Windows/Labeling/geometry" ).toByteArray() ); - - connect( buttonBox->button( QDialogButtonBox::Ok ), SIGNAL( clicked() ), &dlg, SLOT( accept() ) ); - connect( buttonBox->button( QDialogButtonBox::Cancel ), SIGNAL( clicked() ), &dlg, SLOT( reject() ) ); - connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), labelingGui, SLOT( apply() ) ); - - if ( dlg.exec() ) +void QgisApp::setMapStyleDockLayer( QgsMapLayer* layer ) +{ + if ( !layer ) { - labelingGui->writeSettingsToLayer(); - - settings.setValue( "/Windows/Labeling/geometry", dlg.saveGeometry() ); - - // trigger refresh - if ( mMapCanvas ) - { - mMapCanvas->refresh(); - } + mMapStylingDock->setEnabled( false ); + return; } - activateDeactivateLayerRelatedActions( vlayer ); + mMapStylingDock->setEnabled( true ); + // We don't set the layer if the dock isn't open mainly to save + // the extra work if it's not needed + if ( mMapStylingDock->isVisible() ) + mMapStyleWidget->setLayer( layer ); + + mMapStylingDock->setWindowTitle( tr( "Map Styling - %1" ).arg( layer->name() ) ); +} + +void QgisApp::mapStyleDock() +{ + mMapStylingDock->show(); + setMapStyleDockLayer( activeLayer() ); } void QgisApp::diagramProperties() @@ -9848,7 +9858,7 @@ void QgisApp::layerEditStateChanged() } } -void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer ) +void QgisApp::updateLabelToolButtons() { bool enableMove = false, enableRotate = false, enablePin = false, enableShowHide = false, enableChange = false; @@ -9895,6 +9905,11 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer ) mActionMoveLabel->setEnabled( enableMove ); mActionRotateLabel->setEnabled( enableRotate ); mActionChangeLabelProperties->setEnabled( enableChange ); +} + +void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer ) +{ + updateLabelToolButtons(); mMenuPasteAs->setEnabled( clipboard() && !clipboard()->isEmpty() ); mActionPasteAsNewVector->setEnabled( clipboard() && !clipboard()->isEmpty() ); diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h index fd5800c0cd8..acc46fb52b3 100644 --- a/src/app/qgisapp.h +++ b/src/app/qgisapp.h @@ -12,8 +12,7 @@ * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * - * * - ***************************************************************************/ + * * ***************************************************************************/ #ifndef QGISAPP_H #define QGISAPP_H @@ -94,6 +93,8 @@ class QgsScaleComboBox; class QgsDataItem; class QgsTileScaleWidget; +class QgsLabelingWidget; +class QgsMapStylingWidget; class QgsDiagramProperties; #include @@ -115,6 +116,7 @@ class QgsDiagramProperties; #include "qgsbookmarks.h" #include "qgswelcomepageitemsmodel.h" + #include "ui_qgisapp.h" #ifdef HAVE_TOUCH @@ -1089,6 +1091,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow /** Called when some layer's editing mode was toggled on/off */ void layerEditStateChanged(); + /** Update the label toolbar buttons */ + void updateLabelToolButtons(); + /** Activates or deactivates actions depending on the current maplayer type. Is called from the legend when the current legend item has changed*/ void activateDeactivateLayerRelatedActions( QgsMapLayer *layer ); @@ -1164,6 +1169,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow //! shows label settings dialog (for labeling-ng) void labeling(); + //! shows the map styling dock + void mapStyleDock(); + //! diagrams properties void diagramProperties(); @@ -1285,6 +1293,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow /** Pushes a layer error to the message bar */ void onLayerError( const QString& msg ); + /** Set the layer for the map style dock. Doesn't show the style dock */ + void setMapStyleDockLayer( QgsMapLayer *layer ); + signals: /** Emitted when a key is pressed and we want non widget sublasses to be able to pick up on this (e.g. maplayer) */ @@ -1682,6 +1693,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow QgsSnappingDialog *mSnappingDialog; QgsPluginManager *mPluginManager; + QDockWidget *mMapStylingDock; + QgsMapStylingWidget* mMapStyleWidget; QgsComposerManager *mComposerManager; @@ -1720,6 +1733,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow QgsMapCanvasTracer* mTracer; QAction* mActionFilterLegend; + QAction* mActionStyleDock; QgsLegendFilterButton* mLegendExpressionFilterButton; diff --git a/src/app/qgslabelinggui.cpp b/src/app/qgslabelinggui.cpp index 8321f732938..4aa4acb6d1d 100644 --- a/src/app/qgslabelinggui.cpp +++ b/src/app/qgslabelinggui.cpp @@ -76,9 +76,6 @@ QgsLabelingGui::QgsLabelingGui( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, , mMinPixelLimit( 0 ) , mLoadSvgParams( false ) { - if ( !layer ) - return; - setupUi( this ); mFieldExpressionWidget->registerGetExpressionContextCallback( &_getExpressionContext, mLayer ); @@ -124,22 +121,11 @@ QgsLabelingGui::QgsLabelingGui( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, connect( mBufferDrawChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); connect( mShapeDrawChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); connect( mShadowDrawChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); - connect( mDirectSymbChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); connect( mFormatNumChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); connect( mScaleBasedVisibilityChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); connect( mFontLimitPixelChkBox, SIGNAL( toggled( bool ) ), this, SLOT( updateUi() ) ); - // preview and basic option connections - connect( btnTextColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( changeTextColor( const QColor& ) ) ); - connect( mFontTranspSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ) ); - connect( mBufferDrawChkBx, SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ) ); - connect( btnBufferColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( changeBufferColor( const QColor& ) ) ); - connect( spinBufferSize, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ) ); - connect( mBufferTranspSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ) ); - connect( mBufferJoinStyleComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updatePreview() ) ); - connect( mBufferTranspFillChbx, SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ) ); - // internal connections connect( mFontTranspSlider, SIGNAL( valueChanged( int ) ), mFontTranspSpinBox, SLOT( setValue( int ) ) ); connect( mFontTranspSpinBox, SIGNAL( valueChanged( int ) ), mFontTranspSlider, SLOT( setValue( int ) ) ); @@ -158,45 +144,6 @@ QgsLabelingGui::QgsLabelingGui( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, connect( chkLineBelow, SIGNAL( toggled( bool ) ), this, SLOT( updateLinePlacementOptions() ) ); connect( chkLineOn, SIGNAL( toggled( bool ) ), this, SLOT( updateLinePlacementOptions() ) ); - // set placement methods page based on geometry type - switch ( layer->geometryType() ) - { - case QGis::Point: - stackedPlacement->setCurrentWidget( pagePoint ); - break; - case QGis::Line: - stackedPlacement->setCurrentWidget( pageLine ); - break; - case QGis::Polygon: - stackedPlacement->setCurrentWidget( pagePolygon ); - break; - case QGis::NoGeometry: - break; - case QGis::UnknownGeometry: - qFatal( "unknown geometry type unexpected" ); - } - - if ( layer->geometryType() == QGis::Point ) - { - // follow placement alignment is only valid for point layers - mFontMultiLineAlignComboBox->addItem( tr( "Follow label placement" ) ); - } - - // show/hide options based upon geometry type - chkMergeLines->setVisible( layer->geometryType() == QGis::Line ); - mDirectSymbolsFrame->setVisible( layer->geometryType() == QGis::Line ); - mMinSizeFrame->setVisible( layer->geometryType() != QGis::Point ); - mPolygonObstacleTypeFrame->setVisible( layer->geometryType() == QGis::Polygon ); - mPolygonFeatureOptionsFrame->setVisible( layer->geometryType() == QGis::Polygon ); - - // field combo and expression button - mFieldExpressionWidget->setLayer( mLayer ); - QgsDistanceArea myDa; - myDa.setSourceCrs( mLayer->crs().srsid() ); - myDa.setEllipsoidalMode( QgisApp::instance()->mapCanvas()->mapSettings().hasCrsTransformEnabled() ); - myDa.setEllipsoid( QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ) ); - mFieldExpressionWidget->setGeomCalculator( myDa ); - populateFontCapitalsComboBox(); // color buttons @@ -315,10 +262,351 @@ QgsLabelingGui::QgsLabelingGui( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, mLabelingOptionsSplitter->restoreState( settings.value( QString( "/Windows/Labeling/OptionsSplitState" ) ).toByteArray() ); mLabelingOptionsListWidget->setCurrentRow( settings.value( QString( "/Windows/Labeling/Tab" ), 0 ).toInt() ); + + setDockMode( false ); + + + QList widgets; + widgets << btnBufferColor + << btnTextColor + << chkLabelPerFeaturePart + << chkLineAbove + << chkLineBelow + << chkLineOn + << chkLineOrientationDependent + << chkMergeLines + << chkPreserveRotation + << comboBlendMode + << comboBufferBlendMode + << mAlwaysShowDDBtn + << mBufferBlendModeDDBtn + << mBufferColorDDBtn + << mBufferDrawChkBx + << mBufferDrawDDBtn + << mBufferJoinStyleComboBox + << mBufferJoinStyleDDBtn + << mBufferSizeDDBtn + << mBufferTranspDDBtn + << mBufferTranspFillChbx + << mBufferTranspSlider + << mBufferTranspSpinBox + << mBufferUnitsDDBtn + << mCentroidDDBtn + << mCentroidInsideCheckBox + << mChkNoObstacle + << mCoordAlignmentHDDBtn + << mCoordAlignmentVDDBtn + << mCoordRotationDDBtn + << mCoordXDDBtn + << mCoordYDDBtn + << mDirectSymbChkBx + << mDirectSymbDDBtn + << mDirectSymbLeftDDBtn + << mDirectSymbLeftLineEdit + << mDirectSymbLeftToolBtn + << mDirectSymbPlacementDDBtn + << mDirectSymbRevChkBx + << mDirectSymbRevDDBtn + << mDirectSymbRightDDBtn + << mDirectSymbRightLineEdit + << mDirectSymbRightToolBtn + << mFitInsidePolygonCheckBox + << mFontBlendModeDDBtn + << mFontBoldBtn + << mFontBoldDDBtn + << mFontCapitalsComboBox + << mFontCaseDDBtn + << mFontColorDDBtn + << mFontDDBtn + << mFontItalicBtn + << mFontItalicDDBtn + << mFontLetterSpacingDDBtn + << mFontLetterSpacingSpinBox + << mFontLimitPixelChkBox + << mFontLimitPixelDDBtn + << mFontLineHeightDDBtn + << mFontLineHeightSpinBox + << mFontMaxPixelDDBtn + << mFontMaxPixelSpinBox + << mFontMinPixelDDBtn + << mFontMinPixelSpinBox + << mFontMultiLineAlignComboBox + << mFontMultiLineAlignDDBtn + << mFontSizeDDBtn + << mFontSizeSpinBox + << mFontStrikeoutDDBtn + << mFontStrikethroughBtn + << mFontStyleComboBox + << mFontStyleDDBtn + << mFontTranspDDBtn + << mFontTranspSlider + << mFontTranspSpinBox + << mFontUnderlineBtn + << mFontUnderlineDDBtn + << mFontUnitsDDBtn + << mFontWordSpacingDDBtn + << mFontWordSpacingSpinBox + << mFormatNumChkBx + << mFormatNumDDBtn + << mFormatNumDecimalsDDBtn + << mFormatNumDecimalsSpnBx + << mFormatNumPlusSignChkBx + << mFormatNumPlusSignDDBtn + << mIsObstacleDDBtn + << mLimitLabelChkBox + << mLimitLabelSpinBox + << mLineDistanceDDBtn + << mLineDistanceSpnBx + << mLineDistanceUnitDDBtn + << mMaxCharAngleDDBtn + << mMaxCharAngleInDSpinBox + << mMaxCharAngleOutDSpinBox + << mMinSizeSpinBox + << mObstacleFactorDDBtn + << mObstacleFactorSlider + << mObstacleTypeComboBox + << mOffsetTypeComboBox + << mPalShowAllLabelsForLayerChkBx + << mPointAngleDDBtn + << mPointAngleSpinBox + << mPointOffsetAbove + << mPointOffsetAboveLeft + << mPointOffsetAboveRight + << mPointOffsetBelow + << mPointOffsetBelowLeft + << mPointOffsetBelowRight + << mPointOffsetDDBtn + << mPointOffsetLeft + << mPointOffsetOver + << mPointOffsetRight + << mPointOffsetUnitsDDBtn + << mPointOffsetXSpinBox + << mPointOffsetYSpinBox + << mPointPositionOrderDDBtn + << mPointQuadOffsetDDBtn + << mPreviewBackgroundBtn + << mPreviewSizeSlider + << mPreviewTextBtn + << mPreviewTextEdit + << mPriorityDDBtn + << mPrioritySlider + << mRepeatDistanceDDBtn + << mRepeatDistanceSpinBox + << mRepeatDistanceUnitDDBtn + << mScaleBasedVisibilityChkBx + << mScaleBasedVisibilityDDBtn + << mScaleBasedVisibilityMaxDDBtn + << mScaleBasedVisibilityMaxSpnBx + << mScaleBasedVisibilityMinDDBtn + << mScaleBasedVisibilityMinSpnBx + << mShadowBlendCmbBx + << mShadowBlendDDBtn + << mShadowColorBtn + << mShadowColorDDBtn + << mShadowDrawChkBx + << mShadowDrawDDBtn + << mShadowOffsetAngleDDBtn + << mShadowOffsetAngleSpnBx + << mShadowOffsetDDBtn + << mShadowOffsetGlobalChkBx + << mShadowOffsetSpnBx + << mShadowOffsetUnitsDDBtn + << mShadowRadiusAlphaChkBx + << mShadowRadiusDDBtn + << mShadowRadiusDblSpnBx + << mShadowRadiusUnitsDDBtn + << mShadowScaleDDBtn + << mShadowScaleSpnBx + << mShadowTranspDDBtn + << mShadowTranspSlider + << mShadowTranspSpnBx + << mShadowUnderCmbBx + << mShadowUnderDDBtn + << mShapeBlendCmbBx + << mShapeBlendModeDDBtn + << mShapeBorderColorBtn + << mShapeBorderColorDDBtn + << mShapeBorderUnitsDDBtn + << mShapeBorderWidthDDBtn + << mShapeBorderWidthSpnBx + << mShapeDrawChkBx + << mShapeDrawDDBtn + << mShapeFillColorBtn + << mShapeFillColorDDBtn + << mShapeOffsetDDBtn + << mShapeOffsetUnitsDDBtn + << mShapeOffsetXSpnBx + << mShapeOffsetYSpnBx + << mShapePenStyleCmbBx + << mShapePenStyleDDBtn + << mShapeRadiusDDBtn + << mShapeRadiusUnitsDDBtn + << mShapeRadiusXDbSpnBx + << mShapeRadiusYDbSpnBx + << mShapeRotationCmbBx + << mShapeRotationDDBtn + << mShapeRotationDblSpnBx + << mShapeRotationTypeDDBtn + << mShapeSVGParamsBtn + << mShapeSVGPathDDBtn + << mShapeSVGPathLineEdit + << mShapeSVGSelectorBtn + << mShapeSizeCmbBx + << mShapeSizeTypeDDBtn + << mShapeSizeUnitsDDBtn + << mShapeSizeXDDBtn + << mShapeSizeXSpnBx + << mShapeSizeYDDBtn + << mShapeSizeYSpnBx + << mShapeTranspDDBtn + << mShapeTranspSlider + << mShapeTranspSpinBox + << mShapeTypeCmbBx + << mShapeTypeDDBtn + << mShowLabelDDBtn + << mWrapCharDDBtn + << mZIndexDDBtn + << mZIndexSpinBox + << spinBufferSize + << wrapCharacterEdit + << stackedPlacement + << mCentroidRadioVisible + << mCentroidRadioWhole + << mDirectSymbRadioBtnAbove + << mDirectSymbRadioBtnBelow + << mDirectSymbRadioBtnLR + << mUpsidedownRadioAll + << mUpsidedownRadioDefined + << mUpsidedownRadioOff + << radAroundCentroid + << radAroundPoint + << radLineCurved + << radLineHorizontal + << radLineParallel + << radOverCentroid + << radOverPoint + << radPolygonFree + << radPolygonHorizontal + << radPolygonPerimeter + << radPredefinedOrder + << mFieldExpressionWidget; + connectValueChanged( widgets, SLOT( updatePreview() ) ); + + connect( mQuadrantBtnGrp, SIGNAL( buttonClicked( int ) ), this, SLOT( updatePreview() ) ); + + mOptionsTab->setCurrentIndex( 0 ); +} + +void QgsLabelingGui::setDockMode( bool enabled ) +{ + mOptionsTab->setVisible( enabled ); + mLabelingOptionsListFrame->setVisible( !enabled ); + groupBox_mPreview->setVisible( !enabled ); + mDockMode = enabled; +} + +void QgsLabelingGui::connectValueChanged( QList widgets, const char *slot ) +{ + Q_FOREACH ( QWidget* widget, widgets ) + { + if ( QgsDataDefinedButton* w = qobject_cast( widget ) ) + { + connect( w, SIGNAL( dataDefinedActivated( bool ) ), this, slot ); + connect( w, SIGNAL( dataDefinedChanged( QString ) ), this, slot ); + } + else if ( QgsFieldExpressionWidget* w = qobject_cast( widget ) ) + { + connect( w, SIGNAL( fieldChanged( QString ) ), this, slot ); + } + else if ( QComboBox* w = qobject_cast( widget ) ) + { + connect( w, SIGNAL( currentIndexChanged( int ) ), this, slot ); + } + else if ( QSpinBox* w = qobject_cast( widget ) ) + { + connect( w, SIGNAL( valueChanged( int ) ), this, slot ); + } + else if ( QDoubleSpinBox* w = qobject_cast( widget ) ) + { + connect( w , SIGNAL( valueChanged( double ) ), this, slot ); + } + else if ( QgsColorButtonV2* w = qobject_cast( widget ) ) + { + connect( w, SIGNAL( colorChanged( QColor ) ), this, slot ); + } + else if ( QCheckBox* w = qobject_cast( widget ) ) + { + connect( w, SIGNAL( toggled( bool ) ), this, slot ); + } + else if ( QRadioButton* w = qobject_cast( widget ) ) + { + connect( w, SIGNAL( toggled( bool ) ), this, slot ); + } + else if ( QLineEdit* w = qobject_cast( widget ) ) + { + connect( w, SIGNAL( textEdited( QString ) ), this, slot ); + } + } +} + +void QgsLabelingGui::setLayer( QgsMapLayer* mapLayer ) +{ + if ( !mapLayer || mapLayer->type() != QgsMapLayer::VectorLayer ) + { + setEnabled( false ); + return; + } + else + { + setEnabled( true ); + } + + QgsVectorLayer *layer = qobject_cast( mapLayer ); + mLayer = layer ; + init(); } void QgsLabelingGui::init() { + // show/hide options based upon geometry type + chkMergeLines->setVisible( mLayer->geometryType() == QGis::Line ); + mDirectSymbolsFrame->setVisible( mLayer->geometryType() == QGis::Line ); + mMinSizeFrame->setVisible( mLayer->geometryType() != QGis::Point ); + mPolygonObstacleTypeFrame->setVisible( mLayer->geometryType() == QGis::Polygon ); + mPolygonFeatureOptionsFrame->setVisible( mLayer->geometryType() == QGis::Polygon ); + + // field combo and expression button + mFieldExpressionWidget->setLayer( mLayer ); + QgsDistanceArea myDa; + myDa.setSourceCrs( mLayer->crs().srsid() ); + myDa.setEllipsoidalMode( QgisApp::instance()->mapCanvas()->mapSettings().hasCrsTransformEnabled() ); + myDa.setEllipsoid( QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ) ); + mFieldExpressionWidget->setGeomCalculator( myDa ); + + // set placement methods page based on geometry type + switch ( mLayer->geometryType() ) + { + case QGis::Point: + stackedPlacement->setCurrentWidget( pagePoint ); + break; + case QGis::Line: + stackedPlacement->setCurrentWidget( pageLine ); + break; + case QGis::Polygon: + stackedPlacement->setCurrentWidget( pagePolygon ); + break; + case QGis::NoGeometry: + break; + case QGis::UnknownGeometry: + qFatal( "unknown geometry type unexpected" ); + } + + if ( mLayer->geometryType() == QGis::Point ) + { + // follow placement alignment is only valid for point layers + mFontMultiLineAlignComboBox->addItem( tr( "Follow label placement" ) ); + } + // load labeling settings from layer QgsPalLayerSettings lyr; if ( mSettings ) @@ -332,6 +620,7 @@ void QgsLabelingGui::init() mLabelingFrame->setEnabled( mMode == Labels ); // set the current field or add the current expression to the bottom of the list + mFieldExpressionWidget->setRow( -1 ); mFieldExpressionWidget->setField( lyr.fieldName ); // populate placement options @@ -555,7 +844,6 @@ void QgsLabelingGui::init() updateUi(); // should come after data defined button setup } - QgsLabelingGui::~QgsLabelingGui() { QSettings settings; @@ -573,6 +861,7 @@ void QgsLabelingGui::blockInitSignals( bool block ) mPlacePolygonBtnGrp->blockSignals( block ); } + void QgsLabelingGui::optionsStackedWidget_CurrentChanged( int indx ) { mLabelingOptionsListWidget->blockSignals( true ); @@ -1251,6 +1540,15 @@ void QgsLabelingGui::blockFontChangeSignals( bool blk ) void QgsLabelingGui::updatePreview() { + // In dock mode we don't have a preview we + // just let stuff know we have changed because + // there might be live updates connected. + if ( mLayer && mDockMode ) + { + emit widgetChanged(); + return; + } + scrollPreview(); lblFontPreview->setFont( mRefFont ); QFont previewFont = lblFontPreview->font(); diff --git a/src/app/qgslabelinggui.h b/src/app/qgslabelinggui.h index 29bbf622566..f944372944e 100644 --- a/src/app/qgslabelinggui.h +++ b/src/app/qgslabelinggui.h @@ -48,7 +48,14 @@ class APP_EXPORT QgsLabelingGui : public QWidget, private Ui::QgsLabelingGuiBase void setLabelMode( LabelMode mode ); + signals: + void widgetChanged(); + public slots: + void setLayer( QgsMapLayer* layer ); + void setDockMode( bool enabled ); + void connectValueChanged( QList widgets, const char* slot ); + void init(); void collapseSample( bool collapse ); void apply(); @@ -121,6 +128,7 @@ class APP_EXPORT QgsLabelingGui : public QWidget, private Ui::QgsLabelingGuiBase // background reference font QFont mRefFont; + bool mDockMode; int mPreviewSize; int mMinPixelLimit; diff --git a/src/app/qgslabelingwidget.cpp b/src/app/qgslabelingwidget.cpp index 15f20673b6e..a15f8c92c7f 100644 --- a/src/app/qgslabelingwidget.cpp +++ b/src/app/qgslabelingwidget.cpp @@ -12,6 +12,10 @@ * (at your option) any later version. * * * ***************************************************************************/ + +#include +#include + #include "qgslabelingwidget.h" #include "qgslabelengineconfigdialog.h" @@ -31,14 +35,68 @@ QgsLabelingWidget::QgsLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canva connect( mEngineSettingsButton, SIGNAL( clicked() ), this, SLOT( showEngineConfigDialog() ) ); mLabelModeComboBox->setCurrentIndex( -1 ); + mLabelGui = new QgsLabelingGui( nullptr, mCanvas, nullptr, this ); + mStackedWidget->addWidget( mLabelGui ); connect( mLabelModeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( labelModeChanged( int ) ) ); + connect( mLabelGui, SIGNAL( widgetChanged() ), this, SIGNAL( widgetChanged() ) ); + setLayer( layer ); +} + +void QgsLabelingWidget::resetSettings() +{ + if ( mOldSettings ) + { + mLayer->setLabeling( mOldSettings ); + if ( mOldSettings->type() == "simple" ) + { + mOldPalSettings.writeToLayer( mLayer ); + } + } + setLayer( mLayer ); +} + + +void QgsLabelingWidget::setLayer( QgsMapLayer* mapLayer ) +{ + if ( !mapLayer || mapLayer->type() != QgsMapLayer::VectorLayer ) + { + setEnabled( false ); + return; + } + else + { + setEnabled( true ); + } + + QgsVectorLayer *layer = qobject_cast( mapLayer ); + mLayer = layer; + if ( mLayer->labeling() ) + { + QDomDocument doc; + QDomElement oldSettings = mLayer->labeling()->save( doc ); + mOldSettings = QgsAbstractVectorLayerLabeling::create( oldSettings ); + mOldPalSettings.readFromLayer( mLayer ); + } + else + mOldSettings = nullptr; adaptToLayer(); } +void QgsLabelingWidget::setDockMode( bool enabled ) +{ + mDockMode = enabled; + mLabelGui->setDockMode( mDockMode ); +} + void QgsLabelingWidget::adaptToLayer() { + if ( !mLayer ) + return; + + QgsDebugMsg( QString( "Setting up for layer %1" ).arg( mLayer->name() ) ); + mLabelModeComboBox->setCurrentIndex( -1 ); // pick the right mode of the layer @@ -72,7 +130,7 @@ void QgsLabelingWidget::writeSettingsToLayer() } else { - qobject_cast( mWidget )->writeSettingsToLayer(); + mLabelGui->writeSettingsToLayer(); } } @@ -92,46 +150,32 @@ void QgsLabelingWidget::labelModeChanged( int index ) if ( index < 0 ) return; - if ( index != 2 ) - { - if ( QgsLabelingGui* widgetSimple = qobject_cast( mWidget ) ) - { - // lighter variant - just change the mode of existing widget - if ( index == 3 ) - widgetSimple->setLabelMode( QgsLabelingGui::ObstaclesOnly ); - else - widgetSimple->setLabelMode( static_cast< QgsLabelingGui::LabelMode >( index ) ); - return; - } - } - - // in general case we need to recreate the widget - - if ( mWidget ) - mStackedWidget->removeWidget( mWidget ); - - delete mWidget; - mWidget = nullptr; - if ( index == 2 ) { - mWidget = new QgsRuleBasedLabelingWidget( mLayer, mCanvas, this ); + if ( mWidget ) + mStackedWidget->removeWidget( mWidget ); + + delete mWidget; + mWidget = nullptr; + + QgsRuleBasedLabelingWidget* ruleWidget = new QgsRuleBasedLabelingWidget( mLayer, mCanvas, this, mDockMode ); + connect( ruleWidget, SIGNAL( widgetChanged() ), this, SIGNAL( widgetChanged() ) ); + mWidget = ruleWidget; + mStackedWidget->addWidget( mWidget ); + mStackedWidget->setCurrentWidget( mWidget ); } else { - QgsLabelingGui* w = new QgsLabelingGui( mLayer, mCanvas, nullptr, this ); if ( index == 3 ) - w->setLabelMode( QgsLabelingGui::ObstaclesOnly ); + mLabelGui->setLabelMode( QgsLabelingGui::ObstaclesOnly ); else - w->setLabelMode( static_cast< QgsLabelingGui::LabelMode >( index ) ); + mLabelGui->setLabelMode( static_cast< QgsLabelingGui::LabelMode >( index ) ); - w->init(); - mWidget = w; + mLabelGui->setLayer( mLayer ); + mStackedWidget->setCurrentWidget( mLabelGui ); } - - mStackedWidget->addWidget( mWidget ); - mStackedWidget->setCurrentWidget( mWidget ); + emit widgetChanged(); } void QgsLabelingWidget::showEngineConfigDialog() diff --git a/src/app/qgslabelingwidget.h b/src/app/qgslabelingwidget.h index c72f4756095..b5b1724c99f 100644 --- a/src/app/qgslabelingwidget.h +++ b/src/app/qgslabelingwidget.h @@ -4,11 +4,14 @@ #include #include +#include class QgsLabelingGui; class QgsMapCanvas; class QgsRuleBasedLabelingWidget; +class QgsAbstractVectorLayerLabeling; class QgsVectorLayer; +class QgsMapLayer; /** * Master widget for configuration of labeling of a vector layer @@ -20,6 +23,8 @@ class QgsLabelingWidget : public QWidget, private Ui::QgsLabelingWidget QgsLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canvas, QWidget* parent = nullptr ); public slots: + void setLayer( QgsMapLayer *layer ); + void setDockMode( bool enabled ); //! save config to layer void writeSettingsToLayer(); @@ -29,6 +34,11 @@ class QgsLabelingWidget : public QWidget, private Ui::QgsLabelingWidget //! reload the settings shown in the dialog from the current layer void adaptToLayer(); + void resetSettings(); + + signals: + void widgetChanged(); + protected slots: void labelModeChanged( int index ); void showEngineConfigDialog(); @@ -37,7 +47,12 @@ class QgsLabelingWidget : public QWidget, private Ui::QgsLabelingWidget QgsVectorLayer* mLayer; QgsMapCanvas* mCanvas; + bool mDockMode; + QWidget* mWidget; + QgsLabelingGui* mLabelGui; + QgsAbstractVectorLayerLabeling* mOldSettings; + QgsPalLayerSettings mOldPalSettings; }; #endif // QGSLABELINGWIDGET_H diff --git a/src/app/qgsmapstylingwidget.cpp b/src/app/qgsmapstylingwidget.cpp new file mode 100644 index 00000000000..6153bbbe875 --- /dev/null +++ b/src/app/qgsmapstylingwidget.cpp @@ -0,0 +1,113 @@ +#include +#include +#include +#include +#include + +#include "qgsapplication.h" +#include "qgslabelingwidget.h" +#include "qgsmapstylingwidget.h" +#include "qgsmapcanvas.h" +#include "qgsmaplayer.h" + +QgsMapStylingWidget::QgsMapStylingWidget( QgsMapCanvas* canvas, QWidget *parent ) : + QWidget( parent ), mMapCanvas( canvas ), mBlockAutoApply( false ), mCurrentLayer( nullptr ) +{ + QBoxLayout* layout = new QVBoxLayout(); + layout->setContentsMargins( 0, 0, 0, 0 ); + this->setLayout( layout ); + + mStackedWidget = new QStackedWidget( this ); + mMapStyleTabs = new QTabWidget( this ); + mMapStyleTabs->setDocumentMode( true ); + mNotSupportedPage = mStackedWidget->addWidget( new QLabel( "Not supported currently" ) ); + mVectorPage = mStackedWidget->addWidget( mMapStyleTabs ); + + layout->addWidget( mStackedWidget ); + mButtonBox = new QDialogButtonBox( QDialogButtonBox::Reset | QDialogButtonBox::Apply ); + mLiveApplyCheck = new QCheckBox( "Live update" ); + mLiveApplyCheck->setChecked( true ); + + QHBoxLayout* bottomLayout = new QHBoxLayout( ); + bottomLayout->addWidget( mButtonBox ); + bottomLayout->addWidget( mLiveApplyCheck ); + layout->addLayout( bottomLayout ); + + mLabelingWidget = new QgsLabelingWidget( 0, mMapCanvas, this ); + mLabelingWidget->setDockMode( true ); + connect( mLabelingWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) ); + + // Only labels for now but styles and diagrams will come later +// int styleTabIndex = mMapStyleTabs->addTab( new QWidget(), QgsApplication::getThemeIcon( "propertyicons/symbology.png" ), "Styles" ); + mLabelTabIndex = mMapStyleTabs->addTab( mLabelingWidget, QgsApplication::getThemeIcon( "labelingSingle.svg" ), "Labeling" ); +// int diagramTabIndex = mMapStyleTabs->addTab( new QWidget(), QgsApplication::getThemeIcon( "propertyicons/diagram.png" ), "Diagrams" ); +// mMapStyleTabs->setTabEnabled( styleTabIndex, false ); +// mMapStyleTabs->setTabEnabled( diagramTabIndex, false ); + mMapStyleTabs->setCurrentIndex( mLabelTabIndex ); + + connect( mLiveApplyCheck, SIGNAL( toggled( bool ) ), mButtonBox->button( QDialogButtonBox::Apply ), SLOT( setDisabled( bool ) ) ); + + connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) ); + connect( mButtonBox->button( QDialogButtonBox::Reset ), SIGNAL( clicked() ), this, SLOT( resetSettings() ) ); + + mButtonBox->button( QDialogButtonBox::Apply )->setEnabled( false ); + mButtonBox->button( QDialogButtonBox::Reset )->setEnabled( false ); + +} + +void QgsMapStylingWidget::setLayer( QgsMapLayer *layer ) +{ + if ( !layer ) + return; + + mBlockAutoApply = true; + + mCurrentLayer = layer; + + if ( layer->type() == QgsMapLayer::VectorLayer ) + { + mStackedWidget->setCurrentIndex( mVectorPage ); + // TODO Once there is support for more then just labels + // we need to add a check for the just the current tab + mMapStyleTabs->setCurrentIndex( mLabelTabIndex ); + mLabelingWidget->setLayer( layer ); + } + else if ( layer->type() == QgsMapLayer::RasterLayer ) + { + mStackedWidget->setCurrentIndex( mNotSupportedPage ); + } + else if ( layer->type() == QgsMapLayer::PluginLayer ) + { + mStackedWidget->setCurrentIndex( mNotSupportedPage ); + } + + mBlockAutoApply = false; + + mButtonBox->button( QDialogButtonBox::Reset )->setEnabled( false ); +} + +void QgsMapStylingWidget::apply() +{ + if ( mStackedWidget->currentIndex() == mVectorPage && + mMapStyleTabs->currentIndex() == mLabelTabIndex ) + { + mLabelingWidget->apply(); + mButtonBox->button( QDialogButtonBox::Reset )->setEnabled( true ); + emit styleChanged( mCurrentLayer ); + } +} + +void QgsMapStylingWidget::autoApply() +{ + if ( mLiveApplyCheck->isChecked() && !mBlockAutoApply ) + apply(); +} + +void QgsMapStylingWidget::resetSettings() +{ + if ( mStackedWidget->currentIndex() == mVectorPage && + mMapStyleTabs->currentIndex() == mLabelTabIndex ) + { + mLabelingWidget->resetSettings(); + } +} diff --git a/src/app/qgsmapstylingwidget.h b/src/app/qgsmapstylingwidget.h new file mode 100644 index 00000000000..60ba01bbeaa --- /dev/null +++ b/src/app/qgsmapstylingwidget.h @@ -0,0 +1,46 @@ +#ifndef QGSMAPSTYLESDOCK_H +#define QGSMAPSTYLESDOCK_H + +#include +#include +#include +#include +#include + +class QgsLabelingWidget; +class QgsMapLayer; +class QgsMapCanvas; + + +class APP_EXPORT QgsMapStylingWidget : public QWidget +{ + Q_OBJECT + public: + explicit QgsMapStylingWidget( QgsMapCanvas *canvas, QWidget *parent = 0 ); + QgsMapLayer* layer() { return mCurrentLayer; } + + signals: + void styleChanged( QgsMapLayer* layer ); + + public slots: + void setLayer( QgsMapLayer* layer ); + void apply(); + void autoApply(); + void resetSettings(); + + private: + int mNotSupportedPage; + int mVectorPage; + int mLabelTabIndex; + QgsMapCanvas* mMapCanvas; + bool mBlockAutoApply; + QgsMapLayer* mCurrentLayer; + QStackedWidget* mStackedWidget; + QTabWidget *mMapStyleTabs; + QgsLabelingWidget *mLabelingWidget; + QDialogButtonBox* mButtonBox; + QCheckBox* mLiveApplyCheck; + +}; + +#endif // QGSMAPSTYLESDOCK_H diff --git a/src/app/qgsrulebasedlabelingwidget.cpp b/src/app/qgsrulebasedlabelingwidget.cpp index 8e9bff1e18b..b211c27831d 100644 --- a/src/app/qgsrulebasedlabelingwidget.cpp +++ b/src/app/qgsrulebasedlabelingwidget.cpp @@ -24,12 +24,14 @@ #include #include -QgsRuleBasedLabelingWidget::QgsRuleBasedLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canvas, QWidget* parent ) +QgsRuleBasedLabelingWidget::QgsRuleBasedLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canvas, QWidget* parent, bool dockMode ) : QWidget( parent ) , mLayer( layer ) , mCanvas( canvas ) , mRootRule( nullptr ) , mModel( nullptr ) + , mRuleProps( nullptr ) + , mDockMode( dockMode ) { setupUi( this ); @@ -76,6 +78,11 @@ QgsRuleBasedLabelingWidget::~QgsRuleBasedLabelingWidget() delete mRootRule; } +void QgsRuleBasedLabelingWidget::setDockMode( bool enabled ) +{ + mDockMode = enabled; +} + void QgsRuleBasedLabelingWidget::writeSettingsToLayer() { // also clear old-style labeling config @@ -86,31 +93,83 @@ void QgsRuleBasedLabelingWidget::writeSettingsToLayer() void QgsRuleBasedLabelingWidget::addRule() { - QgsRuleBasedLabeling::Rule* newrule = new QgsRuleBasedLabeling::Rule( new QgsPalLayerSettings ); + if ( mRuleProps ) + mStackedWidget->removeWidget( mRuleProps ); - QgsLabelingRulePropsDialog dlg( newrule, mLayer, this, mCanvas ); - if ( dlg.exec() ) + delete mRuleProps; + mRuleProps = nullptr; + + // TODO Delete rule + QgsRuleBasedLabeling::Rule* newrule = new QgsRuleBasedLabeling::Rule( new QgsPalLayerSettings ); + mRuleProps = new QgsLabelingRulePropsDialog( newrule, mLayer, this, mCanvas, mDockMode ); + mRuleProps->setCurrentMode( QgsLabelingRulePropsDialog::Adding ); + + mStackedWidget->addWidget( mRuleProps ); + mStackedWidget->setCurrentWidget( mRuleProps ); + + connect( mRuleProps, SIGNAL( widgetChanged() ), this, SIGNAL( widgetChanged() ) ); + connect( mRuleProps, SIGNAL( accepted() ), this, SLOT( saveRule() ) ); + connect( mRuleProps, SIGNAL( rejected() ), this, SLOT( rejectRule() ) ); + addNewRule( newrule ); +} + +void QgsRuleBasedLabelingWidget::saveRuleEdit() +{ + QModelIndex index = viewRules->selectionModel()->currentIndex(); + mModel->updateRule( index.parent(), index.row() ); + if ( mRuleProps ) + mStackedWidget->removeWidget( mRuleProps ); + + delete mRuleProps; + mRuleProps = nullptr; + mStackedWidget->setCurrentIndex( 0 ); + emit widgetChanged(); +} + +void QgsRuleBasedLabelingWidget::saveRule() +{ + if ( mRuleProps ) + mStackedWidget->removeWidget( mRuleProps ); + + delete mRuleProps; + mRuleProps = nullptr; + mStackedWidget->setCurrentIndex( 0 ); + emit widgetChanged(); +} + +void QgsRuleBasedLabelingWidget::addNewRule( QgsRuleBasedLabeling::Rule* newrule ) +{ + if ( currentRule() ) { - QgsRuleBasedLabeling::Rule* current = currentRule(); - if ( current ) - { - // add after this rule - QModelIndex currentIndex = viewRules->selectionModel()->currentIndex(); - mModel->insertRule( currentIndex.parent(), currentIndex.row() + 1, newrule ); - } - else - { - // append to root rule - int rows = mModel->rowCount(); - mModel->insertRule( QModelIndex(), rows, newrule ); - } + // add after this rule + QModelIndex currentIndex = viewRules->selectionModel()->currentIndex(); + mModel->insertRule( currentIndex.parent(), currentIndex.row() + 1, newrule ); + viewRules->selectionModel()->select( mModel->index( currentIndex.row() + 1, 0 ), QItemSelectionModel::ClearAndSelect ); } else { - delete newrule; + // append to root rule + int rows = mModel->rowCount(); + mModel->insertRule( QModelIndex(), rows, newrule ); + viewRules->selectionModel()->select( mModel->index( rows, 0 ), QItemSelectionModel::ClearAndSelect ); } } +void QgsRuleBasedLabelingWidget::rejectRule() +{ + if ( mRuleProps->currentMode() == QgsLabelingRulePropsDialog::Adding ) + removeRule(); + + mStackedWidget->setCurrentIndex( 0 ); + + if ( mRuleProps ) + mStackedWidget->removeWidget( mRuleProps ); + + delete mRuleProps; + mRuleProps = nullptr; + emit widgetChanged(); +} + void QgsRuleBasedLabelingWidget::editRule() { editRule( viewRules->selectionModel()->currentIndex() ); @@ -120,14 +179,24 @@ void QgsRuleBasedLabelingWidget::editRule( const QModelIndex& index ) { if ( !index.isValid() ) return; - QgsRuleBasedLabeling::Rule* rule = mModel->ruleForIndex( index ); - QgsLabelingRulePropsDialog dlg( rule, mLayer, this, mCanvas ); - if ( dlg.exec() ) - { - // model should know about the change and emit dataChanged signal for the view - mModel->updateRule( index.parent(), index.row() ); - } + if ( mRuleProps ) + mStackedWidget->removeWidget( mRuleProps ); + + delete mRuleProps; + mRuleProps = nullptr; + + QgsRuleBasedLabeling::Rule* rule = mModel->ruleForIndex( index ); + mRuleProps = new QgsLabelingRulePropsDialog( rule, mLayer, this, mCanvas, mDockMode ); + mRuleProps->setCurrentMode( QgsLabelingRulePropsDialog::Editing ); + + connect( mRuleProps, SIGNAL( widgetChanged() ), this, SIGNAL( widgetChanged() ) ); + + mStackedWidget->addWidget( mRuleProps ); + mStackedWidget->setCurrentWidget( mRuleProps ); + + connect( mRuleProps, SIGNAL( accepted() ), this, SLOT( saveRuleEdit() ) ); + connect( mRuleProps, SIGNAL( rejected() ), this, SLOT( rejectRule() ) ); } void QgsRuleBasedLabelingWidget::removeRule() @@ -142,6 +211,7 @@ void QgsRuleBasedLabelingWidget::removeRule() } // make sure that the selection is gone viewRules->selectionModel()->clear(); + emit widgetChanged(); } void QgsRuleBasedLabelingWidget::copy() @@ -154,6 +224,7 @@ void QgsRuleBasedLabelingWidget::copy() QMimeData* mime = mModel->mimeData( indexlist ); QApplication::clipboard()->setMimeData( mime ); + emit widgetChanged(); } void QgsRuleBasedLabelingWidget::paste() @@ -166,6 +237,7 @@ void QgsRuleBasedLabelingWidget::paste() else index = indexlist.first(); mModel->dropMimeData( mime, Qt::CopyAction, index.row(), index.column(), index.parent() ); + emit widgetChanged(); } QgsRuleBasedLabeling::Rule* QgsRuleBasedLabelingWidget::currentRule() @@ -550,8 +622,8 @@ void QgsRuleBasedLabelingModel::updateRule( const QModelIndex& parent, int row ) ///////// -QgsLabelingRulePropsDialog::QgsLabelingRulePropsDialog( QgsRuleBasedLabeling::Rule* rule, QgsVectorLayer* layer, QWidget* parent, QgsMapCanvas* mapCanvas ) - : QDialog( parent ), mRule( rule ), mLayer( layer ), mLabelingGui( nullptr ), mSettings( nullptr ), mMapCanvas( mapCanvas ) +QgsLabelingRulePropsDialog::QgsLabelingRulePropsDialog( QgsRuleBasedLabeling::Rule* rule, QgsVectorLayer* layer, QWidget* parent, QgsMapCanvas* mapCanvas, bool dockMode ) + : QDialog( parent ), mRule( rule ), mLayer( layer ), mLabelingGui( nullptr ), mSettings( nullptr ), mMapCanvas( mapCanvas ), mDockMode( dockMode ) { setupUi( this ); #ifdef Q_OS_MAC @@ -588,17 +660,21 @@ QgsLabelingRulePropsDialog::QgsLabelingRulePropsDialog( QgsRuleBasedLabeling::Ru mSettings = new QgsPalLayerSettings; } - mLabelingGui = new QgsLabelingGui( mLayer, mMapCanvas, mSettings, this ); + mLabelingGui = new QgsLabelingGui( nullptr, mMapCanvas, mSettings, this ); + mLabelingGui->setDockMode( mDockMode ); mLabelingGui->layout()->setContentsMargins( 0, 0, 0, 0 ); QVBoxLayout* l = new QVBoxLayout; l->addWidget( mLabelingGui ); groupSettings->setLayout( l ); mLabelingGui->setLabelMode( QgsLabelingGui::Labels ); - mLabelingGui->init(); + mLabelingGui->setLayer( mLayer ); connect( btnExpressionBuilder, SIGNAL( clicked() ), this, SLOT( buildExpression() ) ); connect( btnTestFilter, SIGNAL( clicked() ), this, SLOT( testFilter() ) ); + connect( editFilter, SIGNAL( textEdited( QString ) ), this, SIGNAL( widgetChanged() ) ); + connect( mLabelingGui, SIGNAL( widgetChanged() ), this, SIGNAL( widgetChanged() ) ); + connect( this, SIGNAL( widgetChanged() ), this, SLOT( updateRule() ) ); QSettings settings; restoreGeometry( settings.value( "/Windows/QgsLabelingRulePropsDialog/geometry" ).toByteArray() ); @@ -686,7 +762,7 @@ void QgsLabelingRulePropsDialog::buildExpression() editFilter->setText( dlg.expressionText() ); } -void QgsLabelingRulePropsDialog::accept() +void QgsLabelingRulePropsDialog::updateRule() { mRule->setFilterExpression( editFilter->text() ); mRule->setDescription( editDescription->text() ); @@ -694,6 +770,10 @@ void QgsLabelingRulePropsDialog::accept() mRule->setScaleMinDenom( groupScale->isChecked() ? mScaleRangeWidget->minimumScaleDenom() : 0 ); mRule->setScaleMaxDenom( groupScale->isChecked() ? mScaleRangeWidget->maximumScaleDenom() : 0 ); mRule->setSettings( groupSettings->isChecked() ? new QgsPalLayerSettings( mLabelingGui->layerSettings() ) : nullptr ); +} +void QgsLabelingRulePropsDialog::accept() +{ + updateRule(); QDialog::accept(); } diff --git a/src/app/qgsrulebasedlabelingwidget.h b/src/app/qgsrulebasedlabelingwidget.h index 6a77653aa72..f98713519a5 100644 --- a/src/app/qgsrulebasedlabelingwidget.h +++ b/src/app/qgsrulebasedlabelingwidget.h @@ -72,27 +72,37 @@ class APP_EXPORT QgsRuleBasedLabelingModel : public QAbstractItemModel }; +class QgsLabelingRulePropsDialog; + class QgsRuleBasedLabelingWidget : public QWidget, private Ui::QgsRuleBasedLabelingWidget { Q_OBJECT public: - QgsRuleBasedLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canvas, QWidget* parent = nullptr ); + QgsRuleBasedLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canvas, QWidget* parent = nullptr, bool dockMode = false ); ~QgsRuleBasedLabelingWidget(); //! save config to layer void writeSettingsToLayer(); + void setDockMode( bool enabled ); signals: + void widgetChanged(); protected slots: + void saveRuleEdit(); void addRule(); + void saveRule(); + void rejectRule(); void editRule(); void editRule( const QModelIndex& index ); void removeRule(); void copy(); void paste(); + private: + void addNewRule( QgsRuleBasedLabeling::Rule* newrule ); + protected: QgsRuleBasedLabeling::Rule* currentRule(); @@ -102,10 +112,12 @@ class QgsRuleBasedLabelingWidget : public QWidget, private Ui::QgsRuleBasedLabel QgsRuleBasedLabeling::Rule* mRootRule; QgsRuleBasedLabelingModel* mModel; + QgsLabelingRulePropsDialog* mRuleProps; QAction* mCopyAction; QAction* mPasteAction; QAction* mDeleteAction; + bool mDockMode; }; @@ -120,14 +132,29 @@ class APP_EXPORT QgsLabelingRulePropsDialog : public QDialog, private Ui::QgsLab Q_OBJECT public: - QgsLabelingRulePropsDialog( QgsRuleBasedLabeling::Rule* rule, QgsVectorLayer* layer, QWidget* parent = nullptr, QgsMapCanvas* mapCanvas = nullptr ); + enum Mode + { + Adding, + Editing + }; + + QgsLabelingRulePropsDialog( QgsRuleBasedLabeling::Rule* rule, QgsVectorLayer* layer, + QWidget* parent = nullptr, QgsMapCanvas* mapCanvas = nullptr, + bool dockMode = false ); ~QgsLabelingRulePropsDialog(); QgsRuleBasedLabeling::Rule* rule() { return mRule; } + Mode currentMode() { return mCurrentMode; } + void setCurrentMode( Mode currentMode ) { mCurrentMode = currentMode; } + + signals: + void widgetChanged(); + public slots: void testFilter(); void buildExpression(); + void updateRule(); void accept() override; protected: @@ -138,6 +165,8 @@ class APP_EXPORT QgsLabelingRulePropsDialog : public QDialog, private Ui::QgsLab QgsPalLayerSettings* mSettings; // a clone of original settings QgsMapCanvas* mMapCanvas; + bool mDockMode; + Mode mCurrentMode; }; diff --git a/src/gui/qgisgui.cpp b/src/gui/qgisgui.cpp index 894a4989102..58b1d7cbfa5 100644 --- a/src/gui/qgisgui.cpp +++ b/src/gui/qgisgui.cpp @@ -200,5 +200,4 @@ namespace QgisGui return QFontDialog::getFont( &ok, initial, nullptr, title ); #endif } - } // end of QgisGui namespace diff --git a/src/gui/qgsfieldexpressionwidget.h b/src/gui/qgsfieldexpressionwidget.h index 873110a627c..2f60ddfaf68 100644 --- a/src/gui/qgsfieldexpressionwidget.h +++ b/src/gui/qgsfieldexpressionwidget.h @@ -127,6 +127,9 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget //! convenience slot to connect QgsMapLayerComboBox layer signal void setLayer( QgsMapLayer* layer ); + //! sets the current row in the widget + void setRow( int row ) { mCombo->setCurrentIndex( row ); } + //! sets the current field or expression in the widget void setField( const QString &fieldName ); diff --git a/src/ui/qgslabelingguibase.ui b/src/ui/qgslabelingguibase.ui index c4e14846b25..3e9f3f7452a 100644 --- a/src/ui/qgslabelingguibase.ui +++ b/src/ui/qgslabelingguibase.ui @@ -6,7 +6,7 @@ 0 0 - 640 + 508 600 @@ -14,16 +14,7 @@ Layer labeling settings - - 0 - - - 0 - - - 0 - - + 0 @@ -44,16 +35,7 @@ QFrame::Raised - - 0 - - - 0 - - - 0 - - + 0 @@ -112,7 +94,7 @@ 0 0 - 614 + 487 300 @@ -332,22 +314,110 @@ QFrame::Raised - - 0 - - - 0 - - - 0 - - - 0 - 0 + + 0 + + + + + 0 + 0 + + + + QTabWidget::North + + + QTabWidget::Rounded + + + 0 + + + + 20 + 20 + + + + Qt::ElideNone + + + true + + + false + + + + + :/images/themes/default/mIconFieldText.svg:/images/themes/default/mIconFieldText.svg + + + + + + + + + :/images/themes/default/propertyicons/labelformatting.svg:/images/themes/default/propertyicons/labelformatting.svg + + + + + + + + + :/images/themes/default/propertyicons/labelbuffer.svg:/images/themes/default/propertyicons/labelbuffer.svg + + + + + + + + + :/images/themes/default/propertyicons/labelbackground.svg:/images/themes/default/propertyicons/labelbackground.svg + + + + + + + + + :/images/themes/default/propertyicons/labelshadow.svg:/images/themes/default/propertyicons/labelshadow.svg + + + + + + + + + :/images/themes/default/propertyicons/labelplacement.svg:/images/themes/default/propertyicons/labelplacement.svg + + + + + + + + + :/images/themes/default/mIconRenderingEnabled.png:/images/themes/default/mIconRenderingEnabled.png + + + + + + + + Qt::Horizontal @@ -500,7 +570,7 @@ - QFrame::StyledPanel + QFrame::NoFrame QFrame::Raised @@ -525,28 +595,9 @@ - + 0 - - 0 - - - 0 - - - 0 - - - - - text-decoration: underline; - - - Text style - - - @@ -560,8 +611,8 @@ 0 0 - 594 - 398 + 465 + 385 @@ -592,19 +643,10 @@ - + 0 - - 0 - - - 0 - - - 0 - - + @@ -656,7 +698,7 @@ - + @@ -681,7 +723,7 @@ - + @@ -694,7 +736,7 @@ - + true @@ -716,7 +758,7 @@ - + true @@ -726,7 +768,7 @@ - + @@ -742,7 +784,7 @@ - + @@ -770,42 +812,42 @@ - + ... - + ... - + ... - + ... - + ... - + @@ -814,16 +856,7 @@ - - 0 - - - 0 - - - 0 - - + 0 @@ -873,7 +906,7 @@ - + @@ -886,14 +919,14 @@ - + ... - + @@ -909,21 +942,21 @@ - + ... - + Spacing - + @@ -945,14 +978,14 @@ - + Blend mode - + @@ -1004,7 +1037,7 @@ - + @@ -1186,17 +1219,17 @@ - + - + ... - + @@ -1209,19 +1242,10 @@ - + - - 0 - - - 0 - - - 0 - - + 0 @@ -1247,16 +1271,32 @@ font-style: italic; - + false - + + + + + + 0 + 0 + + + + Text + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + @@ -1281,25 +1321,13 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 - - - text-decoration: underline; - + - Text formatting + Formatting @@ -1316,8 +1344,8 @@ font-style: italic; 0 0 - 594 - 398 + 465 + 366 @@ -1500,16 +1528,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -1575,16 +1594,7 @@ font-style: italic; 0 - - 0 - - - 0 - - - 0 - - + 0 @@ -1686,16 +1696,7 @@ font-style: italic; 0 - - 0 - - - 0 - - - 0 - - + 0 @@ -1740,16 +1741,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -1926,28 +1918,9 @@ font-style: italic; - + 0 - - 0 - - - 0 - - - 0 - - - - - text-decoration: underline; - - - Text buffer - - - @@ -1961,8 +1934,8 @@ font-style: italic; 0 0 - 594 - 398 + 465 + 385 @@ -1980,14 +1953,14 @@ font-style: italic; - + ... - + @@ -2000,7 +1973,7 @@ font-style: italic; - + Qt::Horizontal @@ -2013,7 +1986,7 @@ font-style: italic; - + @@ -2115,16 +2088,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -2282,6 +2246,22 @@ font-style: italic; + + + + + 0 + 0 + + + + Buffer + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + @@ -2305,28 +2285,9 @@ font-style: italic; - + 0 - - 0 - - - 0 - - - 0 - - - - - text-decoration: underline; - - - Background - - - @@ -2340,8 +2301,8 @@ font-style: italic; 0 0 - 578 - 697 + 448 + 589 @@ -2359,20 +2320,7 @@ font-style: italic; - - - - - 0 - 0 - - - - Draw background - - - - + Qt::Horizontal @@ -2385,14 +2333,27 @@ font-style: italic; - + + + + + 0 + 0 + + + + Draw background + + + + ... - + QFrame::NoFrame @@ -2545,16 +2506,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -2877,16 +2829,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -3112,6 +3055,13 @@ font-style: italic; + + + + Background + + + @@ -3135,28 +3085,9 @@ font-style: italic; - + 0 - - 0 - - - 0 - - - 0 - - - - - text-decoration: underline; - - - Drop shadow - - - @@ -3170,8 +3101,8 @@ font-style: italic; 0 0 - 578 - 424 + 465 + 385 @@ -3189,20 +3120,7 @@ font-style: italic; - - - - - 0 - 0 - - - - Draw drop shadow - - - - + Qt::Horizontal @@ -3215,14 +3133,27 @@ font-style: italic; - + + + + + 0 + 0 + + + + Draw drop shadow + + + + ... - + @@ -3602,6 +3533,13 @@ font-style: italic; + + + + Shadow + + + @@ -3625,22 +3563,16 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 - - - text-decoration: underline; + + + + 0 + 0 + Placement @@ -3660,8 +3592,8 @@ font-style: italic; 0 0 - 578 - 899 + 448 + 758 @@ -3692,16 +3624,7 @@ font-style: italic; QFrame::Sunken - - 0 - - - 0 - - - 0 - - + 0 @@ -3713,20 +3636,11 @@ font-style: italic; QFrame::Sunken - 0 + 1 - - 0 - - - 0 - - - 0 - - + 0 @@ -3779,16 +3693,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -3831,16 +3736,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -3924,16 +3820,7 @@ font-style: italic; QFrame::Raised - - 0 - - - 0 - - - 0 - - + 0 @@ -4008,16 +3895,7 @@ font-style: italic; QFrame::Raised - - 0 - - - 0 - - - 0 - - + 0 @@ -4097,21 +3975,12 @@ font-style: italic; QFrame::Raised - - 0 - - - 0 - - - 0 - - - 0 - 12 + + 0 + @@ -4176,21 +4045,12 @@ font-style: italic; QFrame::Raised - - 0 - - - 0 - - - 0 - - - 0 - 12 + + 0 + @@ -4216,16 +4076,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -4238,16 +4089,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -4503,16 +4345,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -4525,16 +4358,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -4587,21 +4411,12 @@ font-style: italic; QFrame::Raised - - 0 - - - 0 - - - 0 - - - 0 - 12 + + 0 + @@ -4706,16 +4521,7 @@ font-style: italic; QFrame::Raised - - 0 - - - 0 - - - 0 - - + 0 @@ -4775,21 +4581,12 @@ font-style: italic; QFrame::Raised - - 0 - - - 0 - - - 0 - - - 0 - 12 + + 0 + @@ -4839,21 +4636,12 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - - 0 - 12 + + 0 + @@ -5090,16 +4878,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -5240,23 +5019,11 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 - - - text-decoration: underline; - + Rendering @@ -5274,9 +5041,9 @@ font-style: italic; 0 - -398 - 578 - 799 + 0 + 448 + 668 @@ -5642,16 +5409,7 @@ font-style: italic; QFrame::Raised - - 0 - - - 0 - - - 0 - - + 0 @@ -5749,16 +5507,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -5861,16 +5610,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -5927,16 +5667,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -5984,16 +5715,7 @@ font-style: italic; QFrame::Raised - - 0 - - - 0 - - - 0 - - + 0 @@ -6065,16 +5787,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -6135,16 +5848,7 @@ font-style: italic; QFrame::Raised - - 0 - - - 0 - - - 0 - - + 0 @@ -6198,16 +5902,7 @@ font-style: italic; - - 0 - - - 0 - - - 0 - - + 0 @@ -6256,34 +5951,39 @@ font-style: italic; + + QgsCollapsibleGroupBox + QGroupBox +
qgscollapsiblegroupbox.h
+ 1 +
QgsColorButtonV2 QToolButton
qgscolorbuttonv2.h
1
+ + QgsDataDefinedButton + QToolButton +
qgsdatadefinedbutton.h
+
QgsDoubleSpinBox QDoubleSpinBox
qgsdoublespinbox.h
- - QgsSpinBox - QSpinBox -
qgsspinbox.h
-
- - QgsCollapsibleGroupBox - QGroupBox -
qgscollapsiblegroupbox.h
- 1 -
QgsFieldExpressionWidget QWidget
qgsfieldexpressionwidget.h
1
+ + QgsSpinBox + QSpinBox +
qgsspinbox.h
+
QgsUnitSelectionWidget QWidget @@ -6295,11 +5995,6 @@ font-style: italic; QComboBox
qgsblendmodecombobox.h
- - QgsDataDefinedButton - QToolButton -
qgsdatadefinedbutton.h
-
QgsPenJoinStyleComboBox QComboBox @@ -6565,5 +6260,21 @@ font-style: italic; + + mOptionsTab + currentChanged(int) + mLabelStackedWidget + setCurrentIndex(int) + + + 164 + 205 + + + 689 + 277 + + + diff --git a/src/ui/qgslabelingrulepropsdialog.ui b/src/ui/qgslabelingrulepropsdialog.ui index 137c3e9e26b..00d412cfb2a 100644 --- a/src/ui/qgslabelingrulepropsdialog.ui +++ b/src/ui/qgslabelingrulepropsdialog.ui @@ -14,96 +14,124 @@ Rule properties
+ + 0 + - - - QFormLayout::ExpandingFieldsGrow + + + QFrame::NoFrame - - - - Description + + true + + + + + 0 + 0 + 666 + 540 + + + + + 0 - - - - - - - - - Filter - - - - - - + + + QFormLayout::ExpandingFieldsGrow + + + + + Description + + + + + + + + + + Filter + + + + + + + + + + + + + 0 + 0 + + + + ... + + + + + + + Test + + + + + + - + + + Scale range + + + true + + + false + + + + + + + + + + + + + + + + + - + 0 0 - - ... + + Labels - - - - - - Test + + true - - - - - - - Scale range - - - true - - - false - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - Labels - - - true - +
@@ -112,7 +140,7 @@ Qt::Horizontal
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok + QDialogButtonBox::Cancel|QDialogButtonBox::Save
@@ -130,8 +158,6 @@ editFilter btnExpressionBuilder btnTestFilter - groupScale - groupSettings buttonBox diff --git a/src/ui/qgslabelingwidget.ui b/src/ui/qgslabelingwidget.ui index 25421d9165a..c63da1f3413 100644 --- a/src/ui/qgslabelingwidget.ui +++ b/src/ui/qgslabelingwidget.ui @@ -97,6 +97,16 @@ + + + + 12 + + + 0 + + +
diff --git a/src/ui/qgsrulebasedlabelingwidget.ui b/src/ui/qgsrulebasedlabelingwidget.ui index 21fa1c50001..b11bd7bda96 100644 --- a/src/ui/qgsrulebasedlabelingwidget.ui +++ b/src/ui/qgsrulebasedlabelingwidget.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 300 + 457 + 372
@@ -15,92 +15,106 @@ 0
- - - Qt::ActionsContextMenu + + + 0 - - true - - - QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked - - - true - - - QAbstractItemView::InternalMove - - - QAbstractItemView::ExtendedSelection - - - true - - - 100 - + + + + 0 + + + + + Qt::ActionsContextMenu + + + true + + + QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked + + + true + + + QAbstractItemView::InternalMove + + + QAbstractItemView::ExtendedSelection + + + true + + + 100 + + + + + + + + + Add rule + + + + + + + :/images/themes/default/symbologyAdd.svg:/images/themes/default/symbologyAdd.svg + + + + + + + Edit rule + + + + + + + :/images/themes/default/symbologyEdit.png:/images/themes/default/symbologyEdit.png + + + + + + + Remove rule + + + + + + + :/images/themes/default/symbologyRemove.svg:/images/themes/default/symbologyRemove.svg + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + - - - - - - Add rule - - - - - - - :/images/themes/default/symbologyAdd.svg:/images/themes/default/symbologyAdd.svg - - - - - - - Edit rule - - - - - - - :/images/themes/default/symbologyEdit.png:/images/themes/default/symbologyEdit.png - - - - - - - Remove rule - - - - - - - :/images/themes/default/symbologyRemove.svg:/images/themes/default/symbologyRemove.svg - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - -