Skip to content

Commit

Permalink
[Style dock] Move layer label inside widget
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Apr 20, 2016
1 parent 57d4dbf commit 1e5c992
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -5503,8 +5503,6 @@ void QgisApp::setMapStyleDockLayer( QgsMapLayer* layer )
// 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()
Expand Down
9 changes: 9 additions & 0 deletions src/app/qgsmapstylingwidget.cpp
Expand Up @@ -23,6 +23,9 @@ QgsMapStylingWidget::QgsMapStylingWidget( QgsMapCanvas* canvas, QWidget *parent
mNotSupportedPage = mStackedWidget->addWidget( new QLabel( "Not supported currently" ) );
mVectorPage = mStackedWidget->addWidget( mMapStyleTabs );

mLayerTitleLabel = new QLabel();
mLayerTitleLabel->setAlignment( Qt::AlignHCenter );
layout->addWidget( mLayerTitleLabel );
layout->addWidget( mStackedWidget );
mButtonBox = new QDialogButtonBox( QDialogButtonBox::Reset | QDialogButtonBox::Apply );
mLiveApplyCheck = new QCheckBox( "Live update" );
Expand Down Expand Up @@ -58,10 +61,16 @@ QgsMapStylingWidget::QgsMapStylingWidget( QgsMapCanvas* canvas, QWidget *parent
void QgsMapStylingWidget::setLayer( QgsMapLayer *layer )
{
if ( !layer )
{
mLayerTitleLabel->setText( "" );
mStackedWidget->setCurrentIndex( mNotSupportedPage );
return;
}

mBlockAutoApply = true;

mLayerTitleLabel->setText( layer->name() );

mCurrentLayer = layer;

if ( layer->type() == QgsMapLayer::VectorLayer )
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsmapstylingwidget.h
Expand Up @@ -2,6 +2,7 @@
#define QGSMAPSTYLESDOCK_H

#include <QWidget>
#include <QLabel>
#include <QTabWidget>
#include <QStackedWidget>
#include <QDialogButtonBox>
Expand Down Expand Up @@ -34,6 +35,7 @@ class APP_EXPORT QgsMapStylingWidget : public QWidget
int mLabelTabIndex;
QgsMapCanvas* mMapCanvas;
bool mBlockAutoApply;
QLabel* mLayerTitleLabel;
QgsMapLayer* mCurrentLayer;
QStackedWidget* mStackedWidget;
QTabWidget *mMapStyleTabs;
Expand Down

0 comments on commit 1e5c992

Please sign in to comment.