QGIS API Documentation
4.3.0-Master (0cef2469b72)
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
class
QgsColorPickerHelper
;
28
35
36
class
GUI_EXPORT
QgsCompoundColorWidget
:
public
QgsPanelWidget
,
private
Ui::QgsCompoundColorWidgetBase
37
{
38
Q_OBJECT
39
40
public
:
42
enum
Layout
43
{
44
LayoutDefault
= 0,
45
LayoutVertical
,
46
};
47
54
QgsCompoundColorWidget
( QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
,
const
QColor &color = QColor(), Layout layout = LayoutDefault );
55
56
~QgsCompoundColorWidget
()
override
;
57
62
QColor color()
const
;
63
69
void
setAllowOpacity(
bool
allowOpacity );
70
77
void
setColorModelEditable(
bool
colorModelEditable );
78
84
void
setDiscarded
(
bool
discarded ) { mDiscarded = discarded; }
85
96
static
QgsUserColorScheme
*importUserPaletteFromFile( QWidget *parent );
97
108
static
QgsUserColorScheme
*createNewUserPalette( QWidget *parent );
109
120
static
bool
removeUserPalette(
QgsUserColorScheme
*scheme, QWidget *parent );
121
122
signals:
123
128
void
currentColorChanged
(
const
QColor &
color
);
129
130
public
slots:
131
136
void
setColor
(
const
QColor &
color
);
137
142
void
setPreviousColor
(
const
QColor &
color
);
143
144
protected
:
145
void
hideEvent
( QHideEvent *e )
override
;
146
147
private
slots:
148
149
void
onColorButtonGroupToggled(
int
,
bool
checked );
150
151
void
mAddColorToSchemeButton_clicked();
152
153
void
importPalette();
154
void
removePalette();
155
void
newPalette();
156
157
void
schemeIndexChanged(
int
index );
158
void
listSelectionChanged(
const
QItemSelection &selected,
const
QItemSelection &deselected );
159
160
void
mAddCustomColorButton_clicked();
161
162
void
mSampleButton_clicked();
163
void
mTabWidget_currentChanged(
int
index );
164
165
void
mActionShowInButtons_toggled(
bool
state );
166
171
void
_setColor(
const
QColor &
color
);
172
173
private
:
174
static
QScreen *findScreenAt( QPoint pos );
175
180
void
updateComponent();
181
182
QgsScreenHelper
*mScreenHelper =
nullptr
;
183
184
bool
mAllowAlpha =
true
;
185
186
int
mLastCustomColorIndex = 0;
187
188
bool
mDiscarded =
false
;
189
190
QList<QPair<QRadioButton *, QgsColorWidget::ColorComponent>> mRgbRadios;
191
QList<QPair<QRadioButton *, QgsColorWidget::ColorComponent>> mCmykRadios;
192
QButtonGroup *mCmykGroup =
nullptr
;
193
QButtonGroup *mRgbGroup =
nullptr
;
194
195
QgsColorPickerHelper
*mPickerHelper =
nullptr
;
196
200
void
saveSettings();
201
205
void
refreshSchemeComboBox();
206
210
static
QString gplFilePath();
211
213
void
updateActionsForCurrentScheme();
214
215
void
onColorPicked(
const
QColor &
color
);
216
void
onColorHovered(
const
QColor &
color
);
217
void
colorPickingCanceled();
218
219
friend
class
TestQgsCompoundColorWidget
;
220
};
221
222
#endif
// QGSCOMPOUNDCOLORWIDGET_H
QgsColorPickerHelper
A utility class for sampling colors from the screen.
Definition
qgscolorpickerhelper.h:44
QgsCompoundColorWidget
A custom QGIS widget for selecting a color, including options for selecting colors via hue wheel,...
Definition
qgscompoundcolorwidget.h:37
QgsCompoundColorWidget::Layout
Layout
Widget layout.
Definition
qgscompoundcolorwidget.h:43
QgsCompoundColorWidget::LayoutDefault
@ LayoutDefault
Use the default (rectangular) layout.
Definition
qgscompoundcolorwidget.h:44
QgsCompoundColorWidget::LayoutVertical
@ LayoutVertical
Use a narrower, vertically stacked layout.
Definition
qgscompoundcolorwidget.h:45
QgsCompoundColorWidget::currentColorChanged
void currentColorChanged(const QColor &color)
Emitted when the dialog's color changes.
QgsCompoundColorWidget::hideEvent
void hideEvent(QHideEvent *e) override
Definition
qgscompoundcolorwidget.cpp:768
QgsCompoundColorWidget::QgsCompoundColorWidget
QgsCompoundColorWidget(QWidget *parent=nullptr, const QColor &color=QColor(), Layout layout=LayoutDefault)
Constructor for QgsCompoundColorWidget.
Definition
qgscompoundcolorwidget.cpp:45
QgsCompoundColorWidget::setPreviousColor
void setPreviousColor(const QColor &color)
Sets the color to show in an optional "previous color" section.
Definition
qgscompoundcolorwidget.cpp:762
QgsCompoundColorWidget::TestQgsCompoundColorWidget
friend class TestQgsCompoundColorWidget
Definition
qgscompoundcolorwidget.h:219
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:84
QgsCompoundColorWidget::setColor
void setColor(const QColor &color)
Sets the current color for the dialog.
Definition
qgscompoundcolorwidget.cpp:717
QgsCompoundColorWidget::color
QColor color() const
Returns the current color for the dialog.
Definition
qgscompoundcolorwidget.cpp:333
QgsPanelWidget::QgsPanelWidget
QgsPanelWidget(QWidget *parent=nullptr)
Base class for any widget that can be shown as an inline panel.
Definition
qgspanelwidget.cpp:30
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:164
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