Skip to content
Permalink
Browse files

Minor API improvements to QgsStyleManagerDialog

  • Loading branch information
nyalldawson committed Sep 5, 2018
1 parent 0ed1628 commit ca1c655ec6a9708d35bc19ee863b8c3069c5235a
@@ -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();
@@ -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 );
@@ -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()
{
@@ -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();

0 comments on commit ca1c655

Please sign in to comment.
You can’t perform that action at this time.