QGIS API Documentation 3.37.0-Master (fa0c88a90b0)
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
35class GUI_EXPORT QgsColorDialog : public QDialog, private Ui::QgsColorDialogBase
36{
37
38 Q_OBJECT
39
40 public:
41
48 QgsColorDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags,
49 const QColor &color = QColor() );
50
55 QColor color() const;
56
61 void setTitle( const QString &title );
62
68 void setAllowOpacity( bool allowOpacity );
69
78 static QColor getColor( const QColor &initialColor, QWidget *parent, const QString &title = QString(),
79 bool allowOpacity = false );
80
81 signals:
82
87 void currentColorChanged( const QColor &color );
88
89 public slots:
90
95 void setColor( const QColor &color );
96
97 protected:
98
99 void closeEvent( QCloseEvent *e ) override;
100
101 private slots:
102
103 void mButtonBox_accepted();
104 void mButtonBox_rejected();
105 void mButtonBox_clicked( QAbstractButton *button );
106 void discardColor();
107 void showHelp();
108
109 private:
110
111 QColor mPreviousColor;
112
113 bool mAllowOpacity = true;
114
115};
116
117#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