r15822 by jghali - make gradient editing in color palette work quite a bit better
scribus-commit
scribus-commit at lists.scribus.net
Tue Nov 9 02:05:34 CET 2010
Author: jghali
Date: Tue Nov 9 01:05:33 2010
New Revision: 15822
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15822
Log:
make gradient editing in color palette work quite a bit better
Modified:
branches/ScribusOIF/scribus/ui/cpalette.cpp
branches/ScribusOIF/scribus/ui/gradienteditor.cpp
branches/ScribusOIF/scribus/ui/gradienteditor.h
branches/ScribusOIF/scribus/ui/gradienteditor.ui
Modified: branches/ScribusOIF/scribus/ui/cpalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15822&path=/branches/ScribusOIF/scribus/ui/cpalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/cpalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/cpalette.cpp Tue Nov 9 01:05:33 2010
@@ -361,7 +361,9 @@
if (currentDoc)
{
VGradient gradient(gradEdit->gradient());
+ currentDoc->updateManager()->setUpdatesDisabled();
currentDoc->itemSelection_SetFillGradient(gradient);
+ currentDoc->updateManager()->setUpdatesEnabled();
}
}
@@ -370,7 +372,9 @@
if (currentDoc)
{
VGradient gradient(gradEditStroke->gradient());
+ currentDoc->updateManager()->setUpdatesDisabled();
currentDoc->itemSelection_SetLineGradient(gradient);
+ currentDoc->updateManager()->setUpdatesEnabled();
}
}
Modified: branches/ScribusOIF/scribus/ui/gradienteditor.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15822&path=/branches/ScribusOIF/scribus/ui/gradienteditor.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/gradienteditor.cpp (original)
+++ branches/ScribusOIF/scribus/ui/gradienteditor.cpp Tue Nov 9 01:05:33 2010
@@ -27,14 +27,17 @@
#include <QToolTip>
#include "util.h"
+// Note : use temporarily editingFinished() signal to track value changes in stopPos, stopOpacity and
+// stopShade spinboxes. valueChanged() cause focus problems in these widgets due to signals emitted
+// by ScribusDoc::itemSelection_SetFillGradient() and itemSelection_SetStrokeGradient()
GradientEditor::GradientEditor(QWidget *pa) : QFrame(pa)
{
setupUi(this);
- connect(Position, SIGNAL(valueChanged(int)), this, SLOT(changePos(int)));
+ connect(stopPos, SIGNAL(editingFinished()), this, SLOT(changePos()));
connect(stopColor , SIGNAL(activated(const QString &)), this, SLOT(setStopColor(const QString &)));
- connect(stopOpacity, SIGNAL(valueChanged(int)), this, SLOT(setStopTrans(int)));
- connect(stopShade , SIGNAL(valueChanged(int)), this, SLOT(setStopShade(int)));
+ connect(stopOpacity, SIGNAL(editingFinished()), this, SLOT(setStopTrans()));
+ connect(stopShade , SIGNAL(editingFinished()), this, SLOT(setStopShade()));
connect(Preview, SIGNAL(selectedStop(VColorStop*)), this, SLOT(slotDisplayStop(VColorStop*)));
connect(Preview, SIGNAL(currStep(double)), this, SLOT(setPos(double)));
connect(Preview, SIGNAL(currStep(double)), this, SIGNAL(gradientChanged()));
@@ -59,16 +62,16 @@
void GradientEditor::setPos(double p)
{
- disconnect(Position, SIGNAL(valueChanged(int)), this, SLOT(changePos(int)));
- Position->setValue(qRound(p * 100));
- connect(Position, SIGNAL(valueChanged(int)), this, SLOT(changePos(int)));
+ disconnect(stopPos, SIGNAL(editingFinished(int)), this, SLOT(changePos()));
+ stopPos->setValue(qRound(p * 100));
+ connect(stopPos, SIGNAL(editingFinished(int)), this, SLOT(changePos()));
}
void GradientEditor::setGradTrans(double val)
{
- disconnect(stopOpacity, SIGNAL(valueChanged(int)), this, SLOT(setStopTrans(int)));
+ disconnect(stopOpacity, SIGNAL(editingFinished(int)), this, SLOT(setStopTrans()));
stopOpacity->setValue(qRound(val * 100));
- connect(stopOpacity, SIGNAL(valueChanged(int)), this, SLOT(setStopTrans(int)));
+ connect(stopOpacity, SIGNAL(editingFinished(int)), this, SLOT(setStopTrans()));
}
void GradientEditor::slotDisplayStop(VColorStop* stop)
@@ -81,7 +84,7 @@
void GradientEditor::slotColor(QString name, int shade)
{
disconnect(stopColor, SIGNAL(activated(const QString &)), this, SLOT(setStopColor(const QString &)));
- disconnect(stopShade, SIGNAL(valueChanged(int)), this, SLOT(setStopShade(int)));
+ disconnect(stopShade, SIGNAL(editingFinished()), this, SLOT(setStopShade()));
stopShade->setValue(shade);
QString nam = name;
if (name == CommonStrings::None)
@@ -97,7 +100,7 @@
}
setCurrentComboItem(stopColor, nam);
connect(stopColor, SIGNAL(activated(const QString &)), this, SLOT(setStopColor(const QString &)));
- connect(stopShade, SIGNAL(valueChanged(int)), this, SLOT(setStopShade(int)));
+ connect(stopShade, SIGNAL(editingFinished()), this, SLOT(setStopShade()));
}
void GradientEditor::setGradientEditable(bool val)
@@ -105,12 +108,13 @@
stopShade->setEnabled(val);
stopOpacity->setEnabled(val);
stopColor->setEnabled(val);
- Position->setEnabled(val);
+ stopPos->setEnabled(val);
Preview->setGradientEditable(val);
}
-void GradientEditor::changePos(int v)
+void GradientEditor::changePos(/*int v*/)
{
+ int v = stopPos->value();
Preview->setActStep(static_cast<double>(v) / 100.0);
emit gradientChanged();
}
@@ -140,14 +144,16 @@
emit gradientChanged();
}
-void GradientEditor::setStopTrans(int val)
+void GradientEditor::setStopTrans(/*int val*/)
{
+ int val = stopOpacity->value();
Preview->setActTrans(static_cast<double>(val) / 100.0);
emit gradientChanged();
}
-void GradientEditor::setStopShade(int val)
+void GradientEditor::setStopShade(/*int val*/)
{
+ int val = stopShade->value();
Preview->setActColor(setColor(stopColor->currentText(), val), stopColor->currentText(), val);
emit gradientChanged();
}
@@ -165,7 +171,7 @@
void GradientEditor::languageChange()
{
Desc->setText( tr( "Position:" ) );
- Position->setSuffix( tr(" %") );
+ stopPos->setSuffix( tr(" %") );
}
bool GradientEditor::event(QEvent * event)
Modified: branches/ScribusOIF/scribus/ui/gradienteditor.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15822&path=/branches/ScribusOIF/scribus/ui/gradienteditor.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/gradienteditor.h (original)
+++ branches/ScribusOIF/scribus/ui/gradienteditor.h Tue Nov 9 01:05:33 2010
@@ -54,13 +54,13 @@
public slots:
void setPos(double);
- void changePos(int);
+ void changePos(/*int*/);
void slotColor(QString name, int shade);
void slotDisplayStop(VColorStop* stop);
void setGradTrans(double val);
void setStopColor(const QString &);
- void setStopTrans(int val);
- void setStopShade(int val);
+ void setStopTrans(/*int val*/);
+ void setStopShade(/*int val*/);
void languageChange();
signals:
Modified: branches/ScribusOIF/scribus/ui/gradienteditor.ui
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15822&path=/branches/ScribusOIF/scribus/ui/gradienteditor.ui
==============================================================================
--- branches/ScribusOIF/scribus/ui/gradienteditor.ui (original)
+++ branches/ScribusOIF/scribus/ui/gradienteditor.ui Tue Nov 9 01:05:33 2010
@@ -65,7 +65,7 @@
</widget>
</item>
<item row="1" column="1">
- <widget class="QSpinBox" name="Position">
+ <widget class="QSpinBox" name="stopPos">
<property name="suffix">
<string> %</string>
</property>
More information about the scribus-commit
mailing list