Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_shade_selector_lines_settings.cpp
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2010 Adam Celarek <kdedev at xibo dot at>
3
*
4
* SPDX-License-Identifier: LGPL-2.0-or-later
5
*/
6
7
#include "
kis_shade_selector_lines_settings.h
"
8
9
#include <QVBoxLayout>
10
11
#include <kconfig.h>
12
#include <kconfiggroup.h>
13
#include <ksharedconfig.h>
14
15
#include "
kis_shade_selector_line_combo_box.h
"
16
17
KisShadeSelectorLinesSettings::KisShadeSelectorLinesSettings
(QWidget *parent) :
18
QWidget(parent)
19
{
20
QVBoxLayout *l =
new
QVBoxLayout(
this
);
21
l->setContentsMargins(0, 0, 0, 0);
22
}
23
24
QString
KisShadeSelectorLinesSettings::toString
()
const
25
{
26
QStringList
result;
27
Q_FOREACH (
const
KisShadeSelectorLineComboBox
*
const
&i,
m_lineList
) {
28
result.append(i->
configuration
());
29
}
30
31
return
result.join(
';'
);
32
}
33
34
void
KisShadeSelectorLinesSettings::fromString
(
const
QString &stri)
35
{
36
QStringList
strili = stri.split(
';'
, Qt::SkipEmptyParts);
37
38
setLineCount
(strili.size());
39
for
(
int
i=0; i<strili.size(); i++) {
40
m_lineList
.at(i)->setConfiguration(strili.at(i));
41
}
42
}
43
44
void
KisShadeSelectorLinesSettings::updateSettings
()
45
{
46
KConfigGroup cfg = KSharedConfig::openConfig()->group(
"advancedColorSelector"
);
47
fromString
(cfg.readEntry(
"minimalShadeSelectorLineConfig"
,
"0|0.2|0|0"
));
48
49
Q_FOREACH (
KisShadeSelectorLineComboBox
*
const
&i,
m_lineList
) {
50
i->
updateSettings
();
51
}
52
}
53
54
void
KisShadeSelectorLinesSettings::setLineCount
(
int
count)
55
{
56
bool
emitSignal =
m_lineList
.size()!=count;
57
while
(count-
m_lineList
.size() > 0) {
58
m_lineList
.append(
new
KisShadeSelectorLineComboBox
(
this
));
59
m_lineList
.last()->setLineNumber(
m_lineList
.size()-1);
60
layout()->addWidget(
m_lineList
.last());
61
}
62
while
(count-
m_lineList
.size() < 0) {
63
layout()->removeWidget(
m_lineList
.last());
64
delete
m_lineList
.takeLast();
65
}
66
67
Q_FOREACH (
const
KisShadeSelectorLineComboBox
*
const
&i,
m_lineList
) {
68
connect
(
this
, SIGNAL(
setGradient
(
bool
)), i, SLOT(
setGradient
(
bool
)), Qt::UniqueConnection);
69
connect
(
this
, SIGNAL(
setPatches
(
bool
)), i, SLOT(
setPatches
(
bool
)), Qt::UniqueConnection);
70
connect
(
this
, SIGNAL(
setLineHeight
(
int
)), i, SLOT(
setLineHeight
(
int
)), Qt::UniqueConnection);
71
connect
(
this
, SIGNAL(
setPatchCount
(
int
)), i, SLOT(
setPatchCount
(
int
)), Qt::UniqueConnection);
72
}
73
74
if
(emitSignal)
75
Q_EMIT
lineCountChanged
(count);
76
}
connect
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisShadeSelectorLineComboBox
Definition
kis_shade_selector_line_combo_box.h:17
KisShadeSelectorLineComboBox::configuration
QString configuration() const
Definition
kis_shade_selector_line_combo_box.cpp:88
KisShadeSelectorLineComboBox::updateSettings
void updateSettings()
Definition
kis_shade_selector_line_combo_box.cpp:112
KisShadeSelectorLinesSettings::toString
QString toString() const
Definition
kis_shade_selector_lines_settings.cpp:24
KisShadeSelectorLinesSettings::KisShadeSelectorLinesSettings
KisShadeSelectorLinesSettings(QWidget *parent=0)
Definition
kis_shade_selector_lines_settings.cpp:17
KisShadeSelectorLinesSettings::setPatches
void setPatches(bool)
KisShadeSelectorLinesSettings::lineCountChanged
void lineCountChanged(int newLineCount)
KisShadeSelectorLinesSettings::setLineCount
void setLineCount(int count)
Definition
kis_shade_selector_lines_settings.cpp:54
KisShadeSelectorLinesSettings::fromString
void fromString(const QString &stri)
Definition
kis_shade_selector_lines_settings.cpp:34
KisShadeSelectorLinesSettings::setLineHeight
void setLineHeight(int height)
KisShadeSelectorLinesSettings::setGradient
void setGradient(bool)
KisShadeSelectorLinesSettings::m_lineList
QList< KisShadeSelectorLineComboBox * > m_lineList
Definition
kis_shade_selector_lines_settings.h:36
KisShadeSelectorLinesSettings::updateSettings
void updateSettings()
Definition
kis_shade_selector_lines_settings.cpp:44
KisShadeSelectorLinesSettings::setPatchCount
void setPatchCount(int count)
QList< QString >
kis_shade_selector_line_combo_box.h
kis_shade_selector_lines_settings.h
plugins
dockers
advancedcolorselector
kis_shade_selector_lines_settings.cpp
Generated at
2025-11-04 02:30:02+01:00
from
Krita
branch
master
, commit
c9dde2e79561a8aea4a7e8d9ac99c98a7bac9e52