QGIS API Documentation 3.43.0-Master (c67cf405802)
qgscolordialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscolordialog.h - color selection dialog
3
4 ---------------------
5 begin : March 19, 2013
6 copyright : (C) 2013 by Larry Shaffer
7 email : larrys at dakcarto dot com
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef QGSCOLORDIALOG_H
18#define QGSCOLORDIALOG_H
19
20#include <QColorDialog>
21#include "ui_qgscolordialog.h"
22#include "qgis_gui.h"
23#include "qgis_sip.h"
24#include "qgsguiutils.h"
25
26class QColor;
27
37class GUI_EXPORT QgsColorDialog : public QDialog, private Ui::QgsColorDialogBase
38{
39 Q_OBJECT
40
41 public:
48 QgsColorDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, const QColor &color = QColor() );
49
54 QColor color() const;
55
60 void setTitle( const QString &title );
61
67 void setAllowOpacity( bool allowOpacity );
68
77 static QColor getColor( const QColor &initialColor, QWidget *parent, const QString &title = QString(), bool allowOpacity = false );
78
79 signals:
80
85 void currentColorChanged( const QColor &color );
86
87 public slots:
88
93 void setColor( const QColor &color );
94
95 protected:
96 void closeEvent( QCloseEvent *e ) override;
97
98 private slots:
99
100 void mButtonBox_accepted();
101 void mButtonBox_rejected();
102 void mButtonBox_clicked( QAbstractButton *button );
103 void discardColor();
104 void showHelp();
105
106 private:
107 QColor mPreviousColor;
108
109 bool mAllowOpacity = true;
110};
111
112#endif // #ifndef QGSCOLORDIALOG_H
A custom QGIS dialog for selecting a color.
void currentColorChanged(const QColor &color)
Emitted when the dialog's color changes.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53