Krita Source Code Documentation
Loading...
Searching...
No Matches
KisGenericGradientEditor.cpp
Go to the documentation of this file.
1/*
2 * KDE. Krita Project.
3 *
4 * SPDX-FileCopyrightText: 2020 Deif Lou <ginoba@gmail.com>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#include <QVBoxLayout>
10#include <QHBoxLayout>
11#include <QPushButton>
12#include <QLabel>
13#include <QToolButton>
14#include <QWidgetAction>
15#include <QSlider>
16
17#include <KoStopGradient.h>
18#include <KoSegmentGradient.h>
21#include <KisGradientChooser.h>
22#include <kis_icon_utils.h>
24#include <kis_signals_blocker.h>
28#include <KisPopupButton.h>
29#include <QMenu>
30
31#include <ksharedconfig.h>
32#include <kconfiggroup.h>
33
35
37{
38public:
41
45 QPushButton *buttonAddGradient;
54
64
65 QSize cachedSizeHint, cachedMinimumSizeHint;
66
68 {
69 static bool editorWidthHintComputed = false;
70 static int editorWidthHint;
71 static int editorMinimumWidthHint;
72 if (!editorWidthHintComputed) {
73 KisStopGradientEditor stopGradientEditor(nullptr);
74 KisSegmentGradientEditor segmentGradientEditor(nullptr);
75 editorWidthHint = qMax(stopGradientEditor.sizeHint().width(), segmentGradientEditor.sizeHint().width());
76 editorMinimumWidthHint = qMax(stopGradientEditor.minimumSizeHint().width(), segmentGradientEditor.minimumSizeHint().width());
77 editorWidthHintComputed = true;
78 }
79
80 const bool presetChooserHidden = useGradientPresetChooserPopUp || !isGradientPresetChooserVisible;
81
82 cachedSizeHint = QSize(
83 qMax(widgetGradientPresetChooser->sizeHint().width(), editorWidthHint),
84
85 (presetChooserHidden ? 0 : widgetGradientPresetChooser->minimumHeight()) +
86 buttonConvertGradient->sizeHint().height() +
87 (widgetGradientEditor ? widgetGradientEditor->sizeHint().height() : 0) +
88 (presetChooserHidden ? 15 : 25) // spacing
89 );
90
91 cachedMinimumSizeHint = QSize(
92 qMax(widgetGradientPresetChooser->minimumSizeHint().width(), editorMinimumWidthHint),
93
94 (presetChooserHidden ? 0 : widgetGradientPresetChooser->minimumHeight()) +
95 buttonConvertGradient->minimumSizeHint().height() +
96 (widgetGradientEditor ? widgetGradientEditor->minimumSizeHint().height() : 0) +
97 (presetChooserHidden ? 15 : 25) // spacing
98 );
99 }
100};
101
103 : QWidget(parent)
104 , m_d(new Private)
105{
106 m_d->q = this;
107 m_d->gradient = nullptr;
108 m_d->canvasResourcesInterface = nullptr;
109 m_d->widgetGradientEditor = nullptr;
110
111 QVBoxLayout *layoutMain = new QVBoxLayout;
112 layoutMain->setContentsMargins(0, 0, 0, 0);
113 layoutMain->setSpacing(10);
114
115 QHBoxLayout *layoutButtons = new QHBoxLayout;
116 layoutButtons->setContentsMargins(0, 0, 0, 0);
117 layoutButtons->setSpacing(5);
118
119 m_d->buttonConvertGradient = new QPushButton(this);
120 m_d->labelConvertGradientWarning = new QLabel(this);
121 m_d->labelConvertGradientWarning->setPixmap(KisIconUtils::loadIcon("warning").pixmap(16, 16));
122 m_d->labelConvertGradientWarning->setToolTip(
123 i18nc(
124 "Warning text shown when converting from a segment gradient to a stop gradient",
125 "Converting a segment gradient to a stop gradient may cause loss of information"
126 )
127 );
128
129 m_d->widgetGradientPresetChooser = new KisGradientChooser(this);
130 m_d->widgetGradientPresetChooser->setNameLabelVisible(false);
131 m_d->widgetGradientPresetChooser->setEditOptionsVisible(false);
132
133 m_d->toolButtonGradientPresetChooser = new QToolButton(this);
134 m_d->toolButtonGradientPresetChooser->setText(
135 i18nc("Choose a preset gradient from the button popup", "Choose Gradient Preset")
136 );
137 m_d->toolButtonGradientPresetChooser->setPopupMode(QToolButton::InstantPopup);
138 m_d->widgetToolButtonGradientPresetChooser = new QWidget(this);
139 QVBoxLayout *layoutWidgetToolButtonGradientPresetChooser = new QVBoxLayout;
140 layoutWidgetToolButtonGradientPresetChooser->setContentsMargins(0, 0, 0, 0);
141 layoutWidgetToolButtonGradientPresetChooser->setSpacing(0);
142 m_d->widgetToolButtonGradientPresetChooser->setLayout(layoutWidgetToolButtonGradientPresetChooser);
143 QWidgetAction *widgetActionToolButtonGradientPresetChooser = new QWidgetAction(this);
144 widgetActionToolButtonGradientPresetChooser->setDefaultWidget(m_d->widgetToolButtonGradientPresetChooser);
145 m_d->toolButtonGradientPresetChooser->addAction(widgetActionToolButtonGradientPresetChooser);
146
147 m_d->buttonUpdateGradient = new QPushButton(this);
148 m_d->buttonUpdateGradient->setIcon(KisIconUtils::loadIcon("document-save"));
149 m_d->buttonUpdateGradient->setToolTip(
150 i18nc(
151 "Update the current gradient in the presets with the one in the generic gradient editor",
152 "Update the selected gradient preset with the current gradient"
153 )
154 );
155
156 m_d->buttonAddGradient = new QPushButton(this);
157 m_d->buttonAddGradient->setIcon(KisIconUtils::loadIcon("list-add"));
158 m_d->buttonAddGradient->setToolTip(
159 i18nc(
160 "Add the current gradient in the generic gradient editor to the presets",
161 "Add the current gradient to the presets"
162 )
163 );
164
165 m_d->toolButtonGradientPresetChooserOptions = new KisPopupButton(this);
166 m_d->toolButtonGradientPresetChooserOptions->setArrowVisible(false);
167 m_d->toolButtonGradientPresetChooserOptions->setAutoRaise(true);
168 m_d->toolButtonGradientPresetChooserOptions->setIcon(KisIconUtils::loadIcon("view-choose"));
169 m_d->actionUseGradientPresetChooserPopUp = new QAction(this);
170 m_d->actionUseGradientPresetChooserPopUp->setCheckable(true);
171 m_d->actionUseGradientPresetChooserPopUp->setText(
172 i18nc(
173 "Show the gradient preset chooser as a pop-up in a button or inline",
174 "Use a pop-up gradient preset chooser"
175 )
176 );
177 m_d->actionCompactGradientPresetChooserMode = new QAction(this);
178 m_d->actionCompactGradientPresetChooserMode->setCheckable(true);
179 m_d->actionCompactGradientPresetChooserMode->setText(
180 i18nc(
181 "Hide/show option widgets around the gradient preset chooser",
182 "Show compact gradient preset chooser"
183 )
184 );
185 QMenu *toolButtonGradientPresetChooserOptionsMenu = new QMenu;
186 toolButtonGradientPresetChooserOptionsMenu->addAction(m_d->actionUseGradientPresetChooserPopUp);
187 toolButtonGradientPresetChooserOptionsMenu->addAction(m_d->actionCompactGradientPresetChooserMode);
188 m_d->toolButtonGradientPresetChooserOptions->setPopupWidget(toolButtonGradientPresetChooserOptionsMenu);
189
190 layoutButtons->addWidget(m_d->buttonAddGradient, 0);
191 layoutButtons->addWidget(m_d->buttonUpdateGradient, 0);
192 layoutButtons->addWidget(m_d->buttonConvertGradient, 0);
193 layoutButtons->addWidget(m_d->labelConvertGradientWarning, 0);
194 layoutButtons->addStretch(1);
195 layoutButtons->addWidget(m_d->toolButtonGradientPresetChooser, 0);
196 layoutButtons->addWidget(m_d->toolButtonGradientPresetChooserOptions, 0);
197
198 layoutMain->addWidget(m_d->widgetGradientPresetChooser, 1);
199 layoutMain->addLayout(layoutButtons, 0);
200 layoutMain->addStretch();
201
202 setLayout(layoutMain);
203
204 m_d->compactMode = false;
205 m_d->isConvertGradientButtonVisible = true;
206 m_d->isUpdateGradientButtonVisible = true;
207 m_d->isAddGradientButtonVisible = true;
208 m_d->isGradientPresetChooserVisible = true;
209 m_d->isGradientPresetChooserOptionsButtonVisible = true;
210 m_d->useGradientPresetChooserPopUp = true;
211 m_d->compactGradientPresetChooserMode = false;
212 m_d->compactGradientEditorMode = false;
213
219
220 connect(
221 m_d->buttonConvertGradient,
222 SIGNAL(clicked()),
223 this,
225 );
226
227 connect(
228 m_d->buttonUpdateGradient,
229 SIGNAL(clicked()),
230 this,
232 );
233
234 connect(
235 m_d->buttonAddGradient,
236 SIGNAL(clicked()),
237 this,
239 );
240
241 connect(
242 m_d->widgetGradientPresetChooser,
243 SIGNAL(resourceClicked(KoResourceSP)),
244 this,
246 );
247
248 connect(
249 m_d->actionUseGradientPresetChooserPopUp,
250 SIGNAL(toggled(bool)),
251 this,
253 );
254
255 connect(
256 m_d->actionCompactGradientPresetChooserMode,
257 SIGNAL(toggled(bool)),
258 this,
260 );
261
262 m_d->updateCachedSizeHint();
263 setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
264}
265
268
270{
271 KConfigGroup configGroup(KSharedConfig::openConfig(), "GenericGradientEditor");
272 const QString pfx = prefix.isEmpty() ? QString("global/") : prefix + "/";
273
274 m_d->useGradientPresetChooserPopUp = configGroup.readEntry(pfx + "useGradientPresetChooserPopUp", m_d->useGradientPresetChooserPopUp);
275 m_d->compactGradientPresetChooserMode = configGroup.readEntry(pfx + "compactGradientPresetChooserMode", m_d->compactGradientPresetChooserMode);
276
278}
279
281{
282 KConfigGroup configGroup(KSharedConfig::openConfig(), "GenericGradientEditor");
283 const QString pfx = prefix.isEmpty() ? QString("global/") : prefix + "/";
284
285 configGroup.writeEntry(pfx + "useGradientPresetChooserPopUp", m_d->useGradientPresetChooserPopUp);
286 configGroup.writeEntry(pfx + "compactGradientPresetChooserMode", m_d->compactGradientPresetChooserMode);
287}
288
290{
291 if (m_d->gradient) {
292 return m_d->gradient->clone().dynamicCast<KoAbstractGradient>();
293 }
294 return nullptr;
295}
296
298{
299 return m_d->canvasResourcesInterface;
300}
301
303{
304 return m_d->compactMode;
305}
306
308{
309 return m_d->isConvertGradientButtonVisible;
310}
311
313{
314 return m_d->isUpdateGradientButtonVisible;
315}
316
318{
319 return m_d->isAddGradientButtonVisible;
320}
321
323{
324 return m_d->isGradientPresetChooserVisible;
325}
326
328{
329 return m_d->isGradientPresetChooserOptionsButtonVisible;
330}
331
333{
334 return m_d->useGradientPresetChooserPopUp;
335}
336
338{
339 return m_d->compactGradientPresetChooserMode;
340}
341
343{
344 return m_d->compactGradientEditorMode;
345}
346
348{
349 if (newGradient == m_d->gradient) {
350 return;
351 }
352
353 if (!newGradient || !newGradient->valid()) {
354 if (m_d->widgetGradientEditor) {
355 layout()->removeWidget(m_d->widgetGradientEditor);
356 delete m_d->widgetGradientEditor;
357 m_d->widgetGradientEditor = nullptr;
358 }
359 m_d->gradient = nullptr;
364 return;
365 }
366
367 m_d->gradient = newGradient->clone().staticCast<KoAbstractGradient>();
368 if (m_d->canvasResourcesInterface) {
369 m_d->gradient->updateVariableColors(m_d->canvasResourcesInterface);
370 }
371
372 QWidget *newGradientEditorWidget = nullptr;
373 if (m_d->gradient.dynamicCast<KoStopGradient>()) {
374 if (dynamic_cast<KisStopGradientEditor*>(m_d->widgetGradientEditor)) {
375 dynamic_cast<KisStopGradientEditor*>(m_d->widgetGradientEditor)->setGradient(m_d->gradient.dynamicCast<KoStopGradient>());
376 } else {
377 newGradientEditorWidget =
378 new KisStopGradientEditor(m_d->gradient.dynamicCast<KoStopGradient>(), nullptr, "", "", m_d->canvasResourcesInterface);
379 }
380 } else if (m_d->gradient.dynamicCast<KoSegmentGradient>()) {
381 if (dynamic_cast<KisSegmentGradientEditor*>(m_d->widgetGradientEditor)) {
382 dynamic_cast<KisSegmentGradientEditor*>(m_d->widgetGradientEditor)->setGradient(m_d->gradient.dynamicCast<KoSegmentGradient>());
383 } else {
384 newGradientEditorWidget =
385 new KisSegmentGradientEditor(m_d->gradient.dynamicCast<KoSegmentGradient>(), nullptr, "", "", m_d->canvasResourcesInterface);
386 }
387 }
388
389 if (newGradientEditorWidget) {
390 QWidget *oldGradientEditorWidget = m_d->widgetGradientEditor;
391 m_d->widgetGradientEditor = newGradientEditorWidget;
392 m_d->widgetGradientEditor->layout()->setContentsMargins(0, 0, 0, 0);
393 m_d->widgetGradientEditor->setMinimumSize(0, 0);
394 m_d->widgetGradientEditor->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
395 if (dynamic_cast<KisStopGradientEditor*>(m_d->widgetGradientEditor)) {
396 dynamic_cast<KisStopGradientEditor*>(m_d->widgetGradientEditor)->setCompactMode(m_d->compactGradientPresetChooserMode);
397 } else {
398 dynamic_cast<KisSegmentGradientEditor*>(m_d->widgetGradientEditor)->setCompactMode(m_d->compactGradientPresetChooserMode);
399 }
400 if (oldGradientEditorWidget) {
401 setUpdatesEnabled(false);
402 layout()->replaceWidget(oldGradientEditorWidget, m_d->widgetGradientEditor);
403 dynamic_cast<QVBoxLayout*>(layout())->setStretchFactor(m_d->widgetGradientEditor, 0);
404 layout()->activate();
405 delete oldGradientEditorWidget;
406 setUpdatesEnabled(true);
407 } else {
408 dynamic_cast<QVBoxLayout*>(layout())->insertWidget(
409 m_d->useGradientPresetChooserPopUp ? 1 : 2,
410 m_d->widgetGradientEditor,
411 0
412 );
413 }
414 connect(m_d->widgetGradientEditor, SIGNAL(sigGradientChanged()), this, SLOT(on_widgetGradientEditor_sigGradientChanged()));
419 }
420 m_d->updateCachedSizeHint();
421
422 Q_EMIT sigGradientChanged();
423}
424
426{
427 m_d->canvasResourcesInterface = newCanvasResourcesInterface;
428
429 if (dynamic_cast<KisStopGradientEditor*>(m_d->widgetGradientEditor)) {
430 dynamic_cast<KisStopGradientEditor*>(m_d->widgetGradientEditor)->setCanvasResourcesInterface(m_d->canvasResourcesInterface);
431 } else if (dynamic_cast<KisSegmentGradientEditor*>(m_d->widgetGradientEditor)) {
432 dynamic_cast<KisSegmentGradientEditor*>(m_d->widgetGradientEditor)->setCanvasResourcesInterface(m_d->canvasResourcesInterface);
433 }
434
435 m_d->widgetGradientPresetChooser->setCanvasResourcesInterface(newCanvasResourcesInterface);
436}
437
447
449{
450 m_d->isConvertGradientButtonVisible = visible;
452}
453
455{
456 m_d->isUpdateGradientButtonVisible = visible;
458}
459
461{
462 m_d->isAddGradientButtonVisible = visible;
464}
465
467{
468 m_d->isGradientPresetChooserVisible = visible;
470 m_d->updateCachedSizeHint();
471}
472
474{
475 m_d->isGradientPresetChooserOptionsButtonVisible = visible;
477}
478
480{
481 m_d->useGradientPresetChooserPopUp = use;
483 m_d->updateCachedSizeHint();
484}
485
487{
488 m_d->compactGradientPresetChooserMode = compact;
490 m_d->updateCachedSizeHint();
491}
492
494{
495 m_d->compactGradientEditorMode = compact;
497 m_d->updateCachedSizeHint();
498}
499
500
502{
503 return m_d->cachedSizeHint;
504}
505
507{
508 return m_d->cachedMinimumSizeHint;
509}
510
512{
513 if (e->type() == QEvent::StyleChange || e->type() == QEvent::FontChange) {
514 m_d->updateCachedSizeHint();
515 }
516 return QWidget::event(e);
517}
518
520{
521 bool isSegmentGradient = dynamic_cast<KisSegmentGradientEditor*>(m_d->widgetGradientEditor);
522
523 m_d->buttonConvertGradient->setVisible(!m_d->compactMode && m_d->isConvertGradientButtonVisible);
524 m_d->labelConvertGradientWarning->setVisible(!m_d->compactMode && m_d->isConvertGradientButtonVisible && isSegmentGradient);
525
526 m_d->buttonConvertGradient->setText(
527 m_d->gradient
528 ? isSegmentGradient
529 ? i18nc("Convert the segment gradient to a stop gradient", "Convert to Stop Gradient")
530 : i18nc("Convert the stop gradient to a segment gradient", "Convert to Segment Gradient")
531 : i18nc("A gradient wasn't set in the generic gradient editor", "No Gradient Set")
532 );
533
534 m_d->buttonConvertGradient->setEnabled(!m_d->gradient.isNull());
535}
536
538{
539 m_d->buttonUpdateGradient->setVisible(!m_d->compactMode && m_d->isUpdateGradientButtonVisible);
540 KoResourceSP selectedGradient = m_d->widgetGradientPresetChooser->currentResource();
541 m_d->buttonUpdateGradient->setEnabled(
542 m_d->gradient && selectedGradient &&
543 m_d->gradient->resourceId() == selectedGradient->resourceId() &&
544 !selectedGradient->permanent()
545 );
546}
547
549{
550 m_d->buttonAddGradient->setVisible(!m_d->compactMode && m_d->isAddGradientButtonVisible);
551 m_d->buttonAddGradient->setEnabled(m_d->gradient && !m_d->gradient->name().isEmpty());
552}
553
555{
556 m_d->widgetGradientPresetChooser->resourceItemChooser()->showImportExportBtns(!m_d->compactGradientPresetChooserMode);
557 m_d->widgetGradientPresetChooser->resourceItemChooser()->showStorageBtn(!m_d->compactGradientPresetChooserMode);
558 m_d->widgetGradientPresetChooser->resourceItemChooser()->showTaggingBar(!m_d->compactGradientPresetChooserMode);
559 m_d->widgetGradientPresetChooser->resourceItemChooser()->showViewModeBtn(!m_d->compactGradientPresetChooserMode);
560
561 {
562 int margin = !m_d->useGradientPresetChooserPopUp || m_d->compactGradientPresetChooserMode ? 0 : 10;
563 m_d->widgetGradientPresetChooser->setContentsMargins(margin, margin, margin, margin);
564
565 if (m_d->useGradientPresetChooserPopUp) {
566 if (!m_d->widgetToolButtonGradientPresetChooser->children().contains(m_d->widgetGradientPresetChooser)) {
567 layout()->removeWidget(m_d->widgetGradientPresetChooser);
568 m_d->widgetToolButtonGradientPresetChooser->layout()->addWidget(m_d->widgetGradientPresetChooser);
569 }
570 m_d->widgetGradientPresetChooser->setMinimumSize(
571 m_d->compactGradientPresetChooserMode ? 300 : 320,
572 m_d->compactGradientPresetChooserMode ? 300 : 320
573 );
574 m_d->widgetGradientPresetChooser->adjustSize();
575 } else {
576 if (!children().contains(m_d->widgetGradientPresetChooser)) {
577 m_d->widgetToolButtonGradientPresetChooser->layout()->removeWidget(m_d->widgetGradientPresetChooser);
578 static_cast<QVBoxLayout*>(layout())->insertWidget(0, m_d->widgetGradientPresetChooser, 1);
579 }
580 m_d->widgetGradientPresetChooser->setMinimumSize(
581 0,
582 m_d->compactGradientPresetChooserMode ? 100 : 200
583 );
584 m_d->widgetGradientPresetChooser->show();
585 }
586 }
587
588 m_d->toolButtonGradientPresetChooser->setVisible(
589 !m_d->compactMode &&
590 m_d->isGradientPresetChooserVisible &&
591 m_d->useGradientPresetChooserPopUp
592 );
593 m_d->toolButtonGradientPresetChooserOptions->setVisible(
594 !m_d->compactMode &&
595 m_d->isGradientPresetChooserVisible &&
596 m_d->isGradientPresetChooserOptionsButtonVisible
597 );
598 m_d->actionUseGradientPresetChooserPopUp->setChecked(m_d->useGradientPresetChooserPopUp);
599 m_d->actionCompactGradientPresetChooserMode->setChecked(m_d->compactGradientPresetChooserMode);
600}
601
603{
604 if (dynamic_cast<KisStopGradientEditor*>(m_d->widgetGradientEditor)) {
605 dynamic_cast<KisStopGradientEditor*>(m_d->widgetGradientEditor)->setCompactMode(m_d->compactGradientEditorMode);
606 }
607 else if (dynamic_cast<KisSegmentGradientEditor*>(m_d->widgetGradientEditor)) {
608 dynamic_cast<KisSegmentGradientEditor*>(m_d->widgetGradientEditor)->setCompactMode(m_d->compactGradientEditorMode);
609 }
610}
611
613{
614 if (m_d->gradient.dynamicCast<KoStopGradient>()) {
616 }
617 else if (m_d->gradient.dynamicCast<KoSegmentGradient>()) {
619 }
620}
621
623{
624 if (!m_d->gradient || !m_d->gradient->valid() || !(m_d->gradient->resourceId() > -1)) {
625 return;
626 }
627
628 KoResourceSP selectedGradient = m_d->widgetGradientPresetChooser->currentResource();
629 if (!selectedGradient ||
630 !(m_d->gradient->resourceId() == selectedGradient->resourceId()) ||
631 selectedGradient->permanent()) {
632 return;
633 }
634
635 m_d->gradient->updatePreview();
637}
638
640{
641 qDebug() << m_d->gradient << m_d->gradient->valid() << m_d->gradient->name();
642
643 if (!m_d->gradient || !m_d->gradient->valid() || m_d->gradient->name().isEmpty()) {
644 return;
645 }
646
647 m_d->gradient->updatePreview();
650}
651
656
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
This is a generic gradient editor widget.
void sigGradientChanged()
signal emitted when the gradient changes
KisGenericGradientEditor * q
QScopedPointer< Private > m_d
void setCompactGradientPresetChooserMode(bool compact)
Set if the gradient preset chooser must be shown without any controls other than the list view.
void setUpdateGradientButtonVisible(bool visible)
Set if the update gradient button must be shown.
void setGradientPresetChooserVisible(bool visible)
Set if the gradient preset chooser must be shown.
QSize minimumSizeHint() const override
void setCompactGradientEditorMode(bool compact)
Set if the internal gradient editor must use the compact mode.
void setConvertGradientButtonVisible(bool visible)
Set if the convert gradient button must be shown.
void setUseGradientPresetChooserPopUp(bool use)
Set if the gradient preset chooser must be shown as a pop-up clicking a button or embedded in the wid...
void setGradient(KoAbstractGradientSP newGradient)
Set the gradient.
void setAddGradientButtonVisible(bool visible)
Set if the add gradient button must be shown.
KisPopupButton * toolButtonGradientPresetChooserOptions
KoCanvasResourcesInterfaceSP canvasResourcesInterface
KisGenericGradientEditor(QWidget *parent=0)
Construct a new KisGenericGradientEditor widget.
void loadUISettings(const QString &prefix=QString())
Load the ui settings from the configuration.
void on_widgetGradientPresetChooser_resourceClicked(KoResourceSP resource)
void saveUISettings(const QString &prefix=QString())
Save the ui settings to the configuration.
void setGradientPresetChooserOptionsButtonVisible(bool visible)
Set if the button for the gradient preset chooser options must be shown.
KisGradientChooser * widgetGradientPresetChooser
void setCanvasResourcesInterface(KoCanvasResourcesInterfaceSP newCanvasResourcesInterface)
Set the canvas resources interface.
void setCompactMode(bool compact)
Set if the editor must show a reduced ui.
The KisResourceModel class provides the main access to resources. It is possible to filter the resour...
static bool addResourceWithUserInput(QWidget *widgetParent, KoResourceSP resource, QString storageLocation="")
static bool updateResourceWithUserInput(QWidget *widgetParent, KoResourceSP resource)
void setCanvasResourcesInterface(KoCanvasResourcesInterfaceSP canvasResourcesInterface)
KoStopGradientSP toStopGradient(const QGradientStops &gradient)
Convert a QGradientStop list to a KoStopGradientSP.
KoSegmentGradientSP toSegmentGradient(const QGradientStops &gradient)
Convert a QGradientStop list to a krita segment gradient.
QIcon loadIcon(const QString &name)
const QString Gradients
virtual void updateVariableColors(KoCanvasResourcesInterfaceSP canvasResourcesInterface)