QGIS API Documentation  2.99.0-Master (6a61179)
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 
23 class QColor;
24 
32 class GUI_EXPORT QgsColorDialog : public QDialog, private Ui::QgsColorDialogBase
33 {
34 
35  Q_OBJECT
36 
37  public:
38 
44  QgsColorDialog( QWidget *parent = nullptr, Qt::WindowFlags fl = QgisGui::ModalDialogFlags,
45  const QColor& color = QColor() );
46 
47  ~QgsColorDialog();
48 
52  QColor color() const;
53 
57  void setTitle( const QString& title );
58 
63  void setAllowAlpha( const bool allowAlpha );
64 
75  static QColor getLiveColor( const QColor& initialColor, QObject* updateObject, const char* updateSlot,
76  QWidget* parent = nullptr,
77  const QString& title = QString(),
78  const bool allowAlpha = true );
79 
88  static QColor getColor( const QColor &initialColor, QWidget *parent, const QString &title = QString(),
89  const bool allowAlpha = false );
90 
91  signals:
92 
96  void currentColorChanged( const QColor &color );
97 
98  public slots:
99 
103  void setColor( const QColor &color );
104 
105  protected:
106 
107  void closeEvent( QCloseEvent* e ) override;
108 
109  private slots:
110 
111  void on_mButtonBox_accepted();
112  void on_mButtonBox_rejected();
113  void on_mButtonBox_clicked( QAbstractButton * button );
114  void discardColor();
115 
116  private:
117 
118  QColor mPreviousColor;
119 
120  bool mAllowAlpha;
121 
124  void saveSettings();
125 
126 };
127 
128 #endif // #ifndef QGSCOLORDIALOG_H
static const Qt::WindowFlags ModalDialogFlags
Definition: qgisgui.h:50
A custom QGIS dialog for selecting a color.