Skip to content

Commit

Permalink
[FEATURE] Style manager opens non-modally
Browse files Browse the repository at this point in the history
Allows style manager dialog to be used alongside main QGIS window,
just like the layout manager.
  • Loading branch information
nyalldawson committed Sep 5, 2018
1 parent ca1c655 commit 41e2892
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -318,6 +318,7 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
#include "qgsnewnamedialog.h"
#include "qgsgui.h"
#include "qgsdatasourcemanagerdialog.h"
#include "qgsstylemanagerdialog.h"

#include "qgsuserprofilemanager.h"
#include "qgsuserprofile.h"
Expand Down Expand Up @@ -1511,6 +1512,9 @@ QgisApp::~QgisApp()
delete mVectorLayerTools;
delete mWelcomePage;

if ( mStyleManagerDialog )
delete mStyleManagerDialog;

deleteLayoutDesigners();
removeAnnotationItems();

Expand Down Expand Up @@ -2265,8 +2269,13 @@ void QgisApp::createActions()

void QgisApp::showStyleManager()
{
QgsStyleManagerDialog dlg( QgsStyle::defaultStyle(), this );
dlg.exec();
if ( !mStyleManagerDialog )
{
mStyleManagerDialog = new QgsStyleManagerDialog( QgsStyle::defaultStyle(), this, Qt::Window );
mStyleManagerDialog->setAttribute( Qt::WA_DeleteOnClose );
}
mStyleManagerDialog->show();
mStyleManagerDialog->activate();
}

void QgisApp::showPythonDialog()
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgisapp.h
Expand Up @@ -65,6 +65,7 @@ class QgsLayoutCustomDropHandler;
class QgsLayoutDesignerDialog;
class QgsLayoutDesignerInterface;
class QgsLayoutManagerDialog;
class QgsStyleManagerDialog;
class QgsMapCanvas;
class QgsMapCanvasDockWidget;
class QgsMapLayer;
Expand Down Expand Up @@ -2198,6 +2199,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QgsLayerStylingWidget *mMapStyleWidget = nullptr;

QPointer< QgsLayoutManagerDialog > mLayoutManagerDialog;
QPointer< QgsStyleManagerDialog > mStyleManagerDialog;

//! Persistent tile scale slider
QgsTileScaleWidget *mpTileScaleWidget = nullptr;
Expand Down Expand Up @@ -2254,6 +2256,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

QHash< QgsPrintLayout *, QgsMapLayerAction * > mAtlasFeatureActions;


std::unique_ptr<QgsMapLayerAction> mDuplicateFeatureAction;
std::unique_ptr<QgsMapLayerAction> mDuplicateFeatureDigitizeAction;

Expand Down
3 changes: 3 additions & 0 deletions src/gui/symbology/qgsstylemanagerdialog.cpp
Expand Up @@ -186,6 +186,9 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent,
mGroupTreeContextMenu->addAction( actnRemoveGroup );

tabItemType_currentChanged( 0 );

connect( mStyle, &QgsStyle::symbolSaved, this, &QgsStyleManagerDialog::populateList );
connect( mStyle, &QgsStyle::groupsModified, this, &QgsStyleManagerDialog::populateGroups );
}

void QgsStyleManagerDialog::onFinished()
Expand Down

1 comment on commit 41e2892

@mbernasocchi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Please sign in to comment.