[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [krita/langkamp/stopgradienteditor] libs/ui: Port stop based gradient editor to KisColorButton
From:       Sven Langkamp <sven.langkamp () gmail ! com>
Date:       2016-09-11 15:33:52
Message-ID: E1bj6lU-0007xq-64 () code ! kde ! org
[Download RAW message or body]

Git commit a835c75899dde3e7a93ad2fba02657ccf645a304 by Sven Langkamp.
Committed on 11/09/2016 at 15:33.
Pushed by langkamp into branch 'langkamp/stopgradienteditor'.

Port stop based gradient editor to KisColorButton

M  +3    -4    libs/ui/forms/wdgstopgradienteditor.ui
M  +6    -6    libs/ui/kis_stopgradient_editor.cpp
M  +1    -1    libs/ui/kis_stopgradient_editor.h

http://commits.kde.org/krita/a835c75899dde3e7a93ad2fba02657ccf645a304

diff --git a/libs/ui/forms/wdgstopgradienteditor.ui b/libs/ui/forms/wdgstopgradienteditor.ui
index 694799a..5dc6ea2 100644
--- a/libs/ui/forms/wdgstopgradienteditor.ui
+++ b/libs/ui/forms/wdgstopgradienteditor.ui
@@ -54,7 +54,7 @@
    <item>
     <layout class="QGridLayout" name="gridLayout">
      <item row="0" column="0">
-      <widget class="KColorButton" name="colorButton">
+      <widget class="KisColorButton" name="colorButton">
        <property name="sizePolicy">
         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
          <horstretch>0</horstretch>
@@ -92,10 +92,9 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KColorButton</class>
+   <class>KisColorButton</class>
    <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-   <container>1</container>
+   <header>kis_color_button.h</header>
   </customwidget>
   <customwidget>
    <class>KisStopGradientSliderWidget</class>
diff --git a/libs/ui/kis_stopgradient_editor.cpp b/libs/ui/kis_stopgradient_editor.cpp
index dd1d2b9..9c33bf1 100644
--- a/libs/ui/kis_stopgradient_editor.cpp
+++ b/libs/ui/kis_stopgradient_editor.cpp
@@ -45,7 +45,7 @@ KisStopGradientEditor::KisStopGradientEditor(KoStopGradient* gradient, QWidget *
     nameedit->setText(gradient->name());
     connect(nameedit, SIGNAL(editingFinished()), this, SLOT(nameChanged()));
 
-    connect(colorButton, SIGNAL(changed(const QColor&)), SLOT(colorChanged(const QColor&)));
+    connect(colorButton, SIGNAL(changed(const KoColor&)), SLOT(colorChanged(const KoColor&)));
     
     opacitySlider->setRange(0.0, 1.0, 2);
     connect(opacitySlider, SIGNAL(valueChanged(qreal)), this, SLOT(opacityChanged(qreal)));
@@ -64,16 +64,16 @@ void KisStopGradientEditor::activate()
 
 void KisStopGradientEditor::stopChanged(int stop)
 {
-    QColor color = m_gradient->stops()[stop].second.toQColor();
-    opacitySlider->setValue(color.alphaF());
-    
-    color.setAlphaF(1.0);
+    KoColor color = m_gradient->stops()[stop].second;
+    opacitySlider->setValue(color.opacityF());
+   
+    color.setOpacity(1.0);
     colorButton->setColor(color);
     
     paramChanged();
 }
 
-void KisStopGradientEditor::colorChanged(const QColor& color)
+void KisStopGradientEditor::colorChanged(const KoColor& color)
 {
     QList<KoGradientStop> stops = m_gradient->stops();
 
diff --git a/libs/ui/kis_stopgradient_editor.h b/libs/ui/kis_stopgradient_editor.h
index 88f9eeb..c3017ca 100644
--- a/libs/ui/kis_stopgradient_editor.h
+++ b/libs/ui/kis_stopgradient_editor.h
@@ -35,7 +35,7 @@ private:
      KoStopGradient* m_gradient;
 private Q_SLOTS:
     void stopChanged(int stop);
-    void colorChanged(const QColor& color);
+    void colorChanged(const KoColor& color);
     void opacityChanged(qreal value);
     void nameChanged();
     void reverse();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic