QGIS API Documentation  2.99.0-Master (f867b65)
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.h"
24 
25 class QColor;
26 
34 class GUI_EXPORT QgsColorDialog : public QDialog, private Ui::QgsColorDialogBase
35 {
36 
37  Q_OBJECT
38 
39  public:
40 
46  QgsColorDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags,
47  const QColor &color = QColor() );
48 
52  QColor color() const;
53 
57  void setTitle( const QString &title );
58 
64  void setAllowOpacity( const bool allowOpacity );
65 
76  static QColor getLiveColor( const QColor &initialColor, QObject *updateObject, const char *updateSlot,
77  QWidget *parent = nullptr,
78  const QString &title = QString(),
79  const bool allowOpacity = true );
80 
89  static QColor getColor( const QColor &initialColor, QWidget *parent, const QString &title = QString(),
90  const bool allowOpacity = false );
91 
92  signals:
93 
97  void currentColorChanged( const QColor &color );
98 
99  public slots:
100 
104  void setColor( const QColor &color );
105 
106  protected:
107 
108  void closeEvent( QCloseEvent *e ) override;
109 
110  private slots:
111 
112  void on_mButtonBox_accepted();
113  void on_mButtonBox_rejected();
114  void on_mButtonBox_clicked( QAbstractButton *button );
115  void discardColor();
116 
117  private:
118 
119  QColor mPreviousColor;
120 
121  bool mAllowOpacity;
122 
125  void saveSettings();
126 
127 };
128 
129 #endif // #ifndef QGSCOLORDIALOG_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
A custom QGIS dialog for selecting a color.