r21798 by jghali - #14654: The color picker does not change back to HSV after changing to LAB and back to RGB

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 1 13:31:41 UTC 2017


Author: jghali
Date: Wed Mar  1 13:31:41 2017
New Revision: 21798

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21798
Log:
#14654: The color picker does not change back to HSV after changing to LAB and back to RGB

Modified:
    trunk/Scribus/scribus/ui/cmykfw.cpp

Modified: trunk/Scribus/scribus/ui/cmykfw.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21798&path=/trunk/Scribus/scribus/ui/cmykfw.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/cmykfw.cpp	(original)
+++ trunk/Scribus/scribus/ui/cmykfw.cpp	Wed Mar  1 13:31:41 2017
@@ -7,30 +7,31 @@
 */
 #include "cmykfw.h"
 
+#include <QAction>
+#include <QByteArray>
+#include <QCheckBox>
+#include <QCursor>
+#include <QDomDocument>
+#include <QDir>
+#include <QFileInfo>
+#include <QFrame>
+#include <QGridLayout>
 #include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QGridLayout>
 #include <QLabel>
-#include <QFrame>
 #include <QLineEdit>
-#include <QCheckBox>
+#include <QMenu>
+#include <QMessageBox>
+#include <QPainter>
+#include <QPixmap>
 #include <QPushButton>
 #include <QStackedWidget>
+#include <QSignalBlocker>
 #include <QSlider>
-#include <QMenu>
-#include <QPainter>
-#include <QCursor>
-#include <QDir>
-#include <QFileInfo>
-#include <QMessageBox>
-#include <QDomDocument>
+#include <QSpacerItem>
 #include <QToolTip>
 #include <QTextStream>
-#include <QSpacerItem>
-#include <QByteArray>
-#include <QPixmap>
-#include <QAction>
 #include <QTreeWidget>
+#include <QVBoxLayout>
 #include <cstdlib>
 
 #include "colorchart.h"
@@ -573,6 +574,8 @@
 
 void CMYKChoose::selModel(const QString& mod)
 {
+	int h, s, v;
+
 	disconnect( CyanSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
 	disconnect( MagentaSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
 	disconnect( YellowSp, SIGNAL( valueChanged(double) ), this, SLOT( setValSLiders(double) ) );
@@ -641,8 +644,11 @@
 		MagentaSL->setPalette(sliderPix(300));
 		YellowSL->setPalette(sliderPix(60));
 		BlackSL->setPalette(sliderBlack());
+		ScColorEngine::getRGBColor(Farbe, m_doc).getHsv(&h, &s, &v);
+		setValues();
 		ColorMap->drawMode = 0;
-		setValues();
+		ColorMap->drawPalette(v);
+		ColorMap->setMark(h, s);
 	}
 	else if ((mod == tr("Web Safe RGB")) || (mod == tr("RGB")))
 	{
@@ -704,8 +710,11 @@
 		CyanSL->setPalette(sliderPix(0));
 		MagentaSL->setPalette(sliderPix(120));
 		YellowSL->setPalette(sliderPix(240));
+		ScColorEngine::getRGBColor(Farbe, m_doc).getHsv(&h, &s, &v);
+		setValues();
 		ColorMap->drawMode = 0;
-		setValues();
+		ColorMap->drawPalette(v);
+		ColorMap->setMark(h, s);
 	}
 	else if (mod == tr("Lab"))
 	{
@@ -1006,14 +1015,15 @@
 
 void CMYKChoose::setValues()
 {
-	CyanSp->blockSignals(true);
-	CyanSL->blockSignals(true);
-	MagentaSp->blockSignals(true);
-	MagentaSL->blockSignals(true);
-	YellowSp->blockSignals(true);
-	YellowSL->blockSignals(true);
-	BlackSp->blockSignals(true);
-	BlackSL->blockSignals(true);
+	QSignalBlocker cyanSpBlocker(CyanSp);
+	QSignalBlocker cyanSLBlocker(CyanSL);
+	QSignalBlocker magentaSpBlocker(MagentaSp);
+	QSignalBlocker magentaSLBlocker(MagentaSL);
+	QSignalBlocker yellowSpBlocker(YellowSp);
+	QSignalBlocker yellowSLBlocker(YellowSL);
+	QSignalBlocker blackSpBlocker(BlackSp);
+	QSignalBlocker blackSLBlocker(BlackSL);
+
 	if (Farbe.getColorModel() == colorModelCMYK)
 	{
 		CMYKColor cmyk;
@@ -1090,14 +1100,6 @@
 			YellowSL->setPalette(sliderPix(240));
 		}
 	}
-	CyanSp->blockSignals(false);
-	CyanSL->blockSignals(false);
-	MagentaSp->blockSignals(false);
-	MagentaSL->blockSignals(false);
-	YellowSp->blockSignals(false);
-	YellowSL->blockSignals(false);
-	BlackSp->blockSignals(false);
-	BlackSL->blockSignals(false);
 }
 
 void CMYKChoose::showEvent(QShowEvent * event)




More information about the scribus-commit mailing list