Skip to content

Commit

Permalink
Minor API improvements to QgsStyleManagerDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 5, 2018
1 parent 0ed1628 commit ca1c655
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
24 changes: 22 additions & 2 deletions python/gui/auto_generated/symbology/qgsstylemanagerdialog.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,40 @@

class QgsStyleManagerDialog : QDialog
{
%Docstring

A dialog allowing users to customise and populate a QgsStyle.
%End

%TypeHeaderCode
#include "qgsstylemanagerdialog.h"
%End
public:
QgsStyleManagerDialog( QgsStyle *style, QWidget *parent /TransferThis/ = 0 );

QgsStyleManagerDialog( QgsStyle *style, QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags() );
%Docstring
Constructor for QgsStyleManagerDialog, with the specified ``parent`` widget and window ``flags``.

The ``style`` argument specifies the linked QgsStyle database. Symbols and objects contained within
this style will be shown in the dialog, and changes made within the dialog will be applied to ``style``.
The ``style`` object must last for the lifetime of the dialog.
%End

static QString addColorRampStatic( QWidget *parent, QgsStyle *style,
QString RampType = QString() );
%Docstring
open add color ramp dialog, return color ramp's name if the ramp has been added
Opens the add color ramp dialog, returning the new color ramp's name if the ramp has been added.
%End

public slots:

void activate();
%Docstring
Raises, unminimizes and activates this window

.. versionadded:: 3.4
%End

void addItem();
void editItem();
void removeItem();
Expand Down
10 changes: 8 additions & 2 deletions src/gui/symbology/qgsstylemanagerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
#include "qgsapplication.h"
#include "qgslogger.h"

QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent )
: QDialog( parent )
QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent, Qt::WindowFlags flags )
: QDialog( parent, flags )
, mStyle( style )
{
setupUi( this );
Expand Down Expand Up @@ -602,6 +602,12 @@ QString QgsStyleManagerDialog::addColorRampStatic( QWidget *parent, QgsStyle *st
return name;
}

void QgsStyleManagerDialog::activate()
{
raise();
setWindowState( windowState() & ~Qt::WindowMinimized );
activateWindow();
}

bool QgsStyleManagerDialog::addColorRamp()
{
Expand Down
23 changes: 21 additions & 2 deletions src/gui/symbology/qgsstylemanagerdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,38 @@ class QgsStyle;
/**
* \ingroup gui
* \class QgsStyleManagerDialog
*
* A dialog allowing users to customise and populate a QgsStyle.
*/
class GUI_EXPORT QgsStyleManagerDialog : public QDialog, private Ui::QgsStyleManagerDialogBase
{
Q_OBJECT

public:
QgsStyleManagerDialog( QgsStyle *style, QWidget *parent SIP_TRANSFERTHIS = nullptr );

//! open add color ramp dialog, return color ramp's name if the ramp has been added
/**
* Constructor for QgsStyleManagerDialog, with the specified \a parent widget and window \a flags.
*
* The \a style argument specifies the linked QgsStyle database. Symbols and objects contained within
* this style will be shown in the dialog, and changes made within the dialog will be applied to \a style.
* The \a style object must last for the lifetime of the dialog.
*/
QgsStyleManagerDialog( QgsStyle *style, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );

/**
* Opens the add color ramp dialog, returning the new color ramp's name if the ramp has been added.
*/
static QString addColorRampStatic( QWidget *parent, QgsStyle *style,
QString RampType = QString() );

public slots:

/**
* Raises, unminimizes and activates this window
* \since QGIS 3.4
*/
void activate();

void addItem();
void editItem();
void removeItem();
Expand Down

0 comments on commit ca1c655

Please sign in to comment.