31 : QWidget(parent)
33{
34 m_d->colorTypeForegroundButton =
new QToolButton;
35 m_d->colorTypeForegroundButton->setCheckable(
true);
36 m_d->colorTypeForegroundButton->setChecked(
true);
37 m_d->colorTypeForegroundButton->setAutoExclusive(
true);
38 m_d->colorTypeForegroundButton->setAutoRaise(
true);
40 m_d->colorTypeForegroundButton->setToolTip(i18nc(
"Button to change the gradient stop type to foreground",
"Foreground color"));
41 connect(
m_d->colorTypeForegroundButton, &QToolButton::toggled,
42 [this](bool toggled)
43 {
44 if (toggled) {
45 setColorType(KisGradientWidgetsUtils::Foreground);
46 }
48 });
49
50 m_d->colorTypeBackgroundButton =
new QToolButton;
51 m_d->colorTypeBackgroundButton->setCheckable(
true);
52 m_d->colorTypeBackgroundButton->setAutoExclusive(
true);
53 m_d->colorTypeBackgroundButton->setAutoRaise(
true);
55 m_d->colorTypeBackgroundButton->setToolTip(i18nc(
"Button to change the gradient stop type to background",
"Background color"));
56 connect(
m_d->colorTypeBackgroundButton, &QToolButton::toggled,
57 [this](bool toggled)
58 {
59 if (toggled) {
60 setColorType(KisGradientWidgetsUtils::Background);
61 }
63 });
64
65 m_d->colorTypeCustomButton =
new QToolButton;
66 m_d->colorTypeCustomButton->setCheckable(
true);
67 m_d->colorTypeCustomButton->setAutoExclusive(
true);
68 m_d->colorTypeCustomButton->setAutoRaise(
true);
70 m_d->colorTypeCustomButton->setToolTip(i18nc(
"Button to change the gradient stop type to custom color",
"Custom color"));
71 connect(
m_d->colorTypeCustomButton, &QToolButton::toggled,
72 [this](bool toggled)
73 {
74 if (toggled) {
75 setColorType(KisGradientWidgetsUtils::Custom);
76 }
78 });
79
80 QWidget *colorTypeButtonsContainer = new QWidget;
81
82 m_d->transparentCheckBox =
new QCheckBox;
83 m_d->transparentCheckBox->setText(i18n(
"Transparent"));
84 m_d->transparentCheckBox->setProperty(
"isBeingUsed",
true);
86
88 m_d->colorButton->setVisible(
false);
90
94 i18nc("{n} is the number value, % is the percent sign", "Opacity: {n}%"));
95 m_d->opacitySlider->setVisible(
false);
97
101 i18nc("{n} is the number value, % is the percent sign", "Position: {n}%"));
103
104 QHBoxLayout *colorTypeButtonsLayout = new QHBoxLayout;
105 colorTypeButtonsLayout->setContentsMargins(0, 0, 0, 0);
106 colorTypeButtonsLayout->setSpacing(0);
107 colorTypeButtonsLayout->addWidget(
m_d->colorTypeForegroundButton);
108 colorTypeButtonsLayout->addWidget(
m_d->colorTypeBackgroundButton);
109 colorTypeButtonsLayout->addWidget(
m_d->colorTypeCustomButton);
110 colorTypeButtonsContainer->setLayout(colorTypeButtonsLayout);
111
112 QHBoxLayout *mainLayout = new QHBoxLayout;
113 mainLayout->setContentsMargins(0, 0, 0, 0);
114 mainLayout->setSpacing(5);
115 mainLayout->addWidget(colorTypeButtonsContainer);
116 mainLayout->addWidget(
m_d->transparentCheckBox);
117 mainLayout->addWidget(
m_d->colorButton);
118 mainLayout->addWidget(
m_d->opacitySlider);
119 mainLayout->addStretch();
120 mainLayout->addWidget(
m_d->positionSlider);
121 setLayout(mainLayout);
122
123 setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
124}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
void setRange(qreal newMinimum, qreal newMaximum, int newNumberOfDecimals=0, bool computeNewFastSliderStep=true)
Set the minimum and the maximum values of the range.
void transparentToggled(bool checked)
QScopedPointer< Private > m_d
void colorChanged(KoColor color)
void colorTypeChanged(KisGradientWidgetsUtils::ColorType type)
void positionChanged(qreal position)
void opacityChanged(qreal opacity)
QIcon loadIcon(const QString &name)
void setText(QSpinBox *spinBox, const QStringView textTemplate)