QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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 Q_OBJECT
38
39 public:
46 QgsColorDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, const QColor &color = QColor() );
47
52 QColor color() const;
53
58 void setTitle( const QString &title );
59
65 void setAllowOpacity( bool allowOpacity );
66
75 static QColor getColor( const QColor &initialColor, QWidget *parent, const QString &title = QString(), bool allowOpacity = false );
76
77 signals:
78
83 void currentColorChanged( const QColor &color );
84
85 public slots:
86
91 void setColor( const QColor &color );
92
93 protected:
94 void closeEvent( QCloseEvent *e ) override;
95
96 private slots:
97
98 void mButtonBox_accepted();
99 void mButtonBox_rejected();
100 void mButtonBox_clicked( QAbstractButton *button );
101 void discardColor();
102 void showHelp();
103
104 private:
105 QColor mPreviousColor;
106
107 bool mAllowOpacity = true;
108};
109
110#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