QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgscompoundcolorwidget.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgscompoundcolorwidget.h
3
------------------------
4
begin : April 2016
5
copyright : (C) 2016 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSCOMPOUNDCOLORWIDGET_H
17
#define QGSCOMPOUNDCOLORWIDGET_H
18
19
#include "ui_qgscompoundcolorwidget.h"
20
21
#include "
qgis.h
"
22
#include "qgis_gui.h"
23
#include "
qgis_sip.h
"
24
#include "
qgspanelwidget.h
"
25
26
class
QgsScreenHelper
;
27
34
35
class
GUI_EXPORT
QgsCompoundColorWidget
:
public
QgsPanelWidget
,
private
Ui::QgsCompoundColorWidgetBase
36
{
37
Q_OBJECT
38
39
public
:
41
enum
Layout
42
{
43
LayoutDefault
= 0,
44
LayoutVertical
,
45
};
46
53
QgsCompoundColorWidget
( QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
,
const
QColor &color = QColor(), Layout layout = LayoutDefault );
54
55
~QgsCompoundColorWidget
()
override
;
56
61
QColor color()
const
;
62
68
void
setAllowOpacity(
bool
allowOpacity );
69
76
void
setColorModelEditable(
bool
colorModelEditable );
77
83
void
setDiscarded
(
bool
discarded ) { mDiscarded = discarded; }
84
95
static
QgsUserColorScheme
*importUserPaletteFromFile( QWidget *parent );
96
107
static
QgsUserColorScheme
*createNewUserPalette( QWidget *parent );
108
119
static
bool
removeUserPalette(
QgsUserColorScheme
*scheme, QWidget *parent );
120
121
signals:
122
127
void
currentColorChanged
(
const
QColor &
color
);
128
129
public
slots:
130
135
void
setColor
(
const
QColor &
color
);
136
141
void
setPreviousColor
(
const
QColor &
color
);
142
143
protected
:
144
void
hideEvent
( QHideEvent *e )
override
;
145
146
void
mousePressEvent
( QMouseEvent *e )
override
;
147
148
void
mouseMoveEvent
( QMouseEvent *e )
override
;
149
150
void
mouseReleaseEvent
( QMouseEvent *e )
override
;
151
152
void
keyPressEvent
( QKeyEvent *e )
override
;
153
154
private
slots:
155
156
void
onColorButtonGroupToggled(
int
,
bool
checked );
157
158
void
mAddColorToSchemeButton_clicked();
159
160
void
importPalette();
161
void
removePalette();
162
void
newPalette();
163
164
void
schemeIndexChanged(
int
index );
165
void
listSelectionChanged(
const
QItemSelection &selected,
const
QItemSelection &deselected );
166
167
void
mAddCustomColorButton_clicked();
168
169
void
mSampleButton_clicked();
170
void
mTabWidget_currentChanged(
int
index );
171
172
void
mActionShowInButtons_toggled(
bool
state );
173
178
void
_setColor(
const
QColor &
color
);
179
180
private
:
181
static
QScreen *findScreenAt( QPoint pos );
182
187
void
updateComponent();
188
189
QgsScreenHelper
*mScreenHelper =
nullptr
;
190
191
bool
mAllowAlpha =
true
;
192
193
int
mLastCustomColorIndex = 0;
194
195
bool
mPickingColor =
false
;
196
197
bool
mDiscarded =
false
;
198
199
QList<QPair<QRadioButton *, QgsColorWidget::ColorComponent>> mRgbRadios;
200
QList<QPair<QRadioButton *, QgsColorWidget::ColorComponent>> mCmykRadios;
201
QButtonGroup *mCmykGroup =
nullptr
;
202
QButtonGroup *mRgbGroup =
nullptr
;
203
207
void
saveSettings();
208
215
void
stopPicking( QPoint eventPos,
bool
takeSample =
true
);
216
222
QColor averageColor(
const
QImage &image )
const
;
223
229
QColor sampleColor( QPoint point )
const
;
230
234
void
refreshSchemeComboBox();
235
239
static
QString gplFilePath();
240
242
void
updateActionsForCurrentScheme();
243
244
friend
class
TestQgsCompoundColorWidget
;
245
};
246
247
#endif
// QGSCOMPOUNDCOLORWIDGET_H
QgsCompoundColorWidget
A custom QGIS widget for selecting a color, including options for selecting colors via hue wheel,...
Definition
qgscompoundcolorwidget.h:36
QgsCompoundColorWidget::Layout
Layout
Widget layout.
Definition
qgscompoundcolorwidget.h:42
QgsCompoundColorWidget::LayoutDefault
@ LayoutDefault
Use the default (rectangular) layout.
Definition
qgscompoundcolorwidget.h:43
QgsCompoundColorWidget::LayoutVertical
@ LayoutVertical
Use a narrower, vertically stacked layout.
Definition
qgscompoundcolorwidget.h:44
QgsCompoundColorWidget::currentColorChanged
void currentColorChanged(const QColor &color)
Emitted when the dialog's color changes.
QgsCompoundColorWidget::hideEvent
void hideEvent(QHideEvent *e) override
Definition
qgscompoundcolorwidget.cpp:776
QgsCompoundColorWidget::QgsCompoundColorWidget
QgsCompoundColorWidget(QWidget *parent=nullptr, const QColor &color=QColor(), Layout layout=LayoutDefault)
Constructor for QgsCompoundColorWidget.
Definition
qgscompoundcolorwidget.cpp:44
QgsCompoundColorWidget::mousePressEvent
void mousePressEvent(QMouseEvent *e) override
Definition
qgscompoundcolorwidget.cpp:782
QgsCompoundColorWidget::setPreviousColor
void setPreviousColor(const QColor &color)
Sets the color to show in an optional "previous color" section.
Definition
qgscompoundcolorwidget.cpp:770
QgsCompoundColorWidget::TestQgsCompoundColorWidget
friend class TestQgsCompoundColorWidget
Definition
qgscompoundcolorwidget.h:244
QgsCompoundColorWidget::setDiscarded
void setDiscarded(bool discarded)
Sets whether the widget's color has been "discarded" and the selected color should not be stored in t...
Definition
qgscompoundcolorwidget.h:83
QgsCompoundColorWidget::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *e) override
Definition
qgscompoundcolorwidget.cpp:840
QgsCompoundColorWidget::setColor
void setColor(const QColor &color)
Sets the current color for the dialog.
Definition
qgscompoundcolorwidget.cpp:725
QgsCompoundColorWidget::color
QColor color() const
Returns the current color for the dialog.
Definition
qgscompoundcolorwidget.cpp:328
QgsCompoundColorWidget::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *e) override
Definition
qgscompoundcolorwidget.cpp:856
QgsPanelWidget::QgsPanelWidget
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
Definition
qgspanelwidget.cpp:30
QgsPanelWidget::keyPressEvent
void keyPressEvent(QKeyEvent *event) override
Overridden key press event to handle the esc event on the widget.
Definition
qgspanelwidget.cpp:147
QgsScreenHelper
A utility class for dynamic handling of changes to screen properties.
Definition
qgsscreenhelper.h:36
QgsUserColorScheme
A color scheme which stores its colors in a gpl palette file within the "palettes" subfolder off the ...
Definition
qgscolorscheme.h:163
qgis.h
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
qgspanelwidget.h
Generated on
for QGIS API Documentation by
1.17.0