Commit a71c6cdd authored by Halla Rempt's avatar Halla Rempt

BUG:351271 Fix layout of the color options page

Form layout instead of grid layout, set enabled on reading config
and the random opacity checkbox now has space for its label.
parent 25a275fb
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>460</width>
<height>321</height>
<width>509</width>
<height>320</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -22,143 +22,16 @@
<height>320</height>
</size>
</property>
<widget class="QWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>220</y>
<width>424</width>
<height>52</height>
</rect>
</property>
<layout class="QGridLayout" name="chboxGridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="colorPerParticleCHBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Color per particle</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>58</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="fillBackgroundCHBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>If checked, grid brush fill every particle's background with background color. The background of particle is rectangle of grid width and height and by default it is transparent.</string>
</property>
<property name="text">
<string>Fill background</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="sampleInputCHBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Sample Input layer</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="mixBgColorCHBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mix with background color</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>58</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QCheckBox" name="randomHSVCHBox">
<property name="geometry">
<rect>
<x>1</x>
<y>1</y>
<width>110</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Random HSV</string>
</property>
</widget>
<widget class="QWidget" name="hsvWidget" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>1</x>
<y>28</y>
<width>451</width>
<height>155</height>
</rect>
</property>
<widget class="QWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>441</width>
<height>131</height>
</rect>
</property>
<layout class="QGridLayout" name="hsvGridLayout" columnstretch="0,1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="randomHSVCHBox">
<property name="text">
<string>Random HSV</string>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
......@@ -169,6 +42,16 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KisSliderSpinBox" name="hueSlider" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
......@@ -179,6 +62,16 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KisSliderSpinBox" name="saturationSlider" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
......@@ -189,31 +82,133 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KisSliderSpinBox" name="valueSlider" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>10</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="randomOpacityCHBox">
<property name="text">
<string>Random opacity</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="chboxGridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="colorPerParticleCHBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Color per particle</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KisSliderSpinBox" name="hueSlider" native="true"/>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>58</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="KisSliderSpinBox" name="saturationSlider" native="true"/>
<item row="0" column="2">
<widget class="QCheckBox" name="fillBackgroundCHBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>If checked, grid brush fill every particle's background with background color. The background of particle is rectangle of grid width and height and by default it is transparent.</string>
</property>
<property name="text">
<string>Fill background</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KisSliderSpinBox" name="valueSlider" native="true"/>
<item row="1" column="0">
<widget class="QCheckBox" name="sampleInputCHBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Sample Input layer</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="mixBgColorCHBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mix with background color</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>58</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<widget class="QCheckBox" name="randomOpacityCHBox">
<property name="geometry">
<rect>
<x>1</x>
<y>187</y>
<width>130</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Random opacity</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>114</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
......
......@@ -49,7 +49,7 @@ KisColorOption::KisColorOption()
setObjectName("KisColorOption");
// ui
connect(m_options->randomHSVCHBox, SIGNAL(toggled(bool)), m_options->hsvWidget, SLOT(setEnabled(bool)));
connect(m_options->randomHSVCHBox, SIGNAL(toggled(bool)), SLOT(setEnabled(bool)));
// settings
connect(m_options->randomOpacityCHBox, SIGNAL(toggled(bool)), SLOT(emitSettingChanged()));
connect(m_options->randomHSVCHBox, SIGNAL(toggled(bool)), SLOT(emitSettingChanged()));
......@@ -91,12 +91,19 @@ void KisColorOption::readOptionSetting(const KisPropertiesConfiguration* setting
m_options->valueSlider->setValue(setting->getInt(COLOROP_VALUE));
m_options->randomOpacityCHBox->setChecked(setting->getBool(COLOROP_USE_RANDOM_OPACITY));
m_options->randomHSVCHBox->setChecked(setting->getBool(COLOROP_USE_RANDOM_HSV));
setEnabled(setting->getBool(COLOROP_USE_RANDOM_HSV));
m_options->sampleInputCHBox->setChecked(setting->getBool(COLOROP_SAMPLE_COLOR));
m_options->fillBackgroundCHBox->setChecked(setting->getBool(COLOROP_FILL_BG));
m_options->colorPerParticleCHBox->setChecked(setting->getBool(COLOROP_COLOR_PER_PARTICLE));
m_options->mixBgColorCHBox->setChecked(setting->getBool(COLOROP_MIX_BG_COLOR));
}
void KisColorOption::setEnabled(bool enabled)
{
m_options->hueSlider->setEnabled(!enabled);
m_options->saturationSlider->setEnabled(!enabled);
m_options->valueSlider->setEnabled(!enabled);
}
bool KisColorOption::useRandomOpacity() const
{
......
......@@ -38,6 +38,7 @@ class KisColorOptionsWidget;
class PAINTOP_EXPORT KisColorOption : public KisPaintOpOption
{
Q_OBJECT
public:
KisColorOption();
~KisColorOption();
......@@ -57,7 +58,14 @@ public:
void writeOptionSetting(KisPropertiesConfiguration* setting) const;
void readOptionSetting(const KisPropertiesConfiguration* setting);
private Q_SLOTS:
void setEnabled(bool);
private:
KisColorOptionsWidget * m_options;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment