QGIS API Documentation  2.99.0-Master (19b062c)
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 #include "qgshelp.h"
25 
26 class QColor;
27 
36 class GUI_EXPORT QgsColorDialog : public QDialog, private Ui::QgsColorDialogBase
37 {
38 
39  Q_OBJECT
40 
41  public:
42 
49  QgsColorDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags,
50  const QColor &color = QColor() );
51 
56  QColor color() const;
57 
62  void setTitle( const QString &title );
63 
70  void setAllowOpacity( const bool allowOpacity );
71 
83  static QColor getLiveColor( const QColor &initialColor, QObject *updateObject, const char *updateSlot,
84  QWidget *parent = nullptr,
85  const QString &title = QString(),
86  const bool allowOpacity = true );
87 
97  static QColor getColor( const QColor &initialColor, QWidget *parent, const QString &title = QString(),
98  const bool allowOpacity = false );
99 
100  signals:
101 
106  void currentColorChanged( const QColor &color );
107 
108  public slots:
109 
114  void setColor( const QColor &color );
115 
116  protected:
117 
118  void closeEvent( QCloseEvent *e ) override;
119 
120  private slots:
121 
122  void mButtonBox_accepted();
123  void mButtonBox_rejected();
124  void mButtonBox_clicked( QAbstractButton *button );
125  void discardColor();
126  void showHelp();
127 
128  private:
129 
130  QColor mPreviousColor;
131 
132  bool mAllowOpacity = true;
133 
137  void saveSettings();
138 
139 };
140 
141 #endif // #ifndef QGSCOLORDIALOG_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
A custom QGIS dialog for selecting a color.