Commit f1b0f0fe authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Made the interface of the Color To Alpha filter more friendly

1) Added a slider to the 'Threshold' parameter
2) Added a KColorButton button for choosing a color
3) Fixed application of the filter with "Enter" key

BUG:316985
parent 851a193f
......@@ -43,8 +43,11 @@ KisWdgColorToAlpha::KisWdgColorToAlpha(QWidget * parent)
{
m_widget = new Ui_WdgColorToAlphaBase();
m_widget->setupUi(this);
connect(m_widget->colorSelector, SIGNAL(colorChanged(const QColor&)), SIGNAL(sigConfigurationItemChanged()));
connect(m_widget->colorSelector, SIGNAL(colorChanged(const QColor&)), SLOT(slotColorSelectorChanged(const QColor&)));
connect(m_widget->intThreshold, SIGNAL(valueChanged(int)), SIGNAL(sigConfigurationItemChanged()));
connect(m_widget->btnCustomColor, SIGNAL(changed(const QColor&)), SLOT(slotCustomColorSelected(const QColor&)));
m_widget->btnCustomColor->setColor(Qt::white);
}
KisWdgColorToAlpha::~KisWdgColorToAlpha()
......@@ -63,7 +66,17 @@ void KisWdgColorToAlpha::setView(KisView2 *view)
void KisWdgColorToAlpha::slotFgColorChanged(const KoColor &color)
{
m_widget->colorSelector->setQColor(color.toQColor());
m_widget->btnCustomColor->setColor(color.toQColor());
}
void KisWdgColorToAlpha::slotColorSelectorChanged(const QColor &color)
{
m_widget->btnCustomColor->setColor(color);
}
void KisWdgColorToAlpha::slotCustomColorSelected(const QColor &color)
{
m_widget->colorSelector->setQColor(color);
emit sigConfigurationItemChanged();
}
......
......@@ -45,6 +45,8 @@ public:
private slots:
void slotFgColorChanged(const KoColor &color);
void slotColorSelectorChanged(const QColor &color);
void slotCustomColorSelected(const QColor &color);
private:
Ui_WdgColorToAlphaBase* m_widget;
......
......@@ -10,7 +10,10 @@
<height>254</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
......@@ -21,8 +24,36 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="KoTriangleColorSelector" name="colorSelector" native="true"/>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KoTriangleColorSelector" name="colorSelector" native="true"/>
</item>
<item>
<widget class="KColorButton" name="btnCustomColor">
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="textLabel1_2">
......@@ -35,48 +66,47 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="intThreshold">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>61</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="sldSecondaryThreshold">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>25</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="intThreshold">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>KColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
</customwidget>
<customwidget>
<class>KoTriangleColorSelector</class>
<extends>QWidget</extends>
......@@ -88,5 +118,38 @@
<include location="local">kcolorbutton.h</include>
</includes>
<resources/>
<connections/>
<connections>
<connection>
<sender>sldSecondaryThreshold</sender>
<signal>valueChanged(int)</signal>
<receiver>intThreshold</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>166</x>
<y>63</y>
</hint>
<hint type="destinationlabel">
<x>289</x>
<y>63</y>
</hint>
</hints>
</connection>
<connection>
<sender>intThreshold</sender>
<signal>valueChanged(int)</signal>
<receiver>sldSecondaryThreshold</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>289</x>
<y>63</y>
</hint>
<hint type="destinationlabel">
<x>166</x>
<y>63</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -58,10 +58,18 @@
</widget>
</item>
<item row="1" column="2">
<widget class="KPushButton" name="pushButtonOk"/>
<widget class="KPushButton" name="pushButtonOk">
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="KPushButton" name="pushButtonCancel"/>
<widget class="KPushButton" name="pushButtonCancel">
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
......
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