Minor API improvements to QgsStyleManagerDialog

This commit is contained in:
Nyall Dawson 2018-09-04 09:28:21 +10:00
parent 0ed1628814
commit ca1c655ec6
3 changed files with 51 additions and 6 deletions

View File

@ -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();

View File

@ -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()
{

View File

@ -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();