summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2009-09-16 13:18:04 (GMT)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2009-09-16 13:18:04 (GMT)
commit418d0345380140bc5e2ad77987cad6aa081c1878 (patch)
treef1ba6e763dff91d5044b656364d062499a49e637 /tools
parentbc7eb95302d9fac44c8e922b173a576aaa9606d5 (diff)
downloadQt-418d0345380140bc5e2ad77987cad6aa081c1878.zip
Qt-418d0345380140bc5e2ad77987cad6aa081c1878.tar.gz
Qt-418d0345380140bc5e2ad77987cad6aa081c1878.tar.bz2
Fix alpha setting in Designer's "Edit Palette" window
Use QColorDialog::getColor() instead of deprecated QColorDialog::getRgba(), which causes alpha value to get lost in the process. Task-number: QT-4494 Reviewed-by: Jarek Kobus <jkobus@trolltech.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/designer/src/lib/shared/stylesheeteditor.cpp7
-rw-r--r--tools/shared/qtgradienteditor/qtcolorbutton.cpp10
-rw-r--r--tools/shared/qtpropertybrowser/qteditorfactory.cpp8
3 files changed, 8 insertions, 17 deletions
diff --git a/tools/designer/src/lib/shared/stylesheeteditor.cpp b/tools/designer/src/lib/shared/stylesheeteditor.cpp
index c7668b1..b9f9ba2 100644
--- a/tools/designer/src/lib/shared/stylesheeteditor.cpp
+++ b/tools/designer/src/lib/shared/stylesheeteditor.cpp
@@ -240,13 +240,10 @@ void StyleSheetEditorDialog::slotAddGradient(const QString &property)
void StyleSheetEditorDialog::slotAddColor(const QString &property)
{
- bool ok;
- QRgb rgba = QColorDialog::getRgba(0xffffffff, &ok, this);
- if (!ok)
+ const QColor color = QColorDialog::getColor(0xffffffff, this, QString(), QColorDialog::ShowAlphaChannel);
+ if (!color.isValid())
return;
- QColor color;
- color.setRgba(rgba);
QString colorStr;
if (color.alpha() == 255) {
diff --git a/tools/shared/qtgradienteditor/qtcolorbutton.cpp b/tools/shared/qtgradienteditor/qtcolorbutton.cpp
index 1c29b66..5c38b52 100644
--- a/tools/shared/qtgradienteditor/qtcolorbutton.cpp
+++ b/tools/shared/qtgradienteditor/qtcolorbutton.cpp
@@ -68,14 +68,10 @@ public:
void QtColorButtonPrivate::slotEditColor()
{
- bool ok;
- const QRgb rgba = QColorDialog::getRgba(m_color.rgba(), &ok, q_ptr);
- if (!ok)
+ const QColor newColor = QColorDialog::getColor(m_color, q_ptr, QString(), QColorDialog::ShowAlphaChannel);
+ if (!newColor.isValid() || newColor == q_ptr->color())
return;
- const QColor c = QColor::fromRgba(rgba);
- if (c == q_ptr->color())
- return;
- q_ptr->setColor(c);
+ q_ptr->setColor(newColor);
emit q_ptr->colorChanged(m_color);
}
diff --git a/tools/shared/qtpropertybrowser/qteditorfactory.cpp b/tools/shared/qtpropertybrowser/qteditorfactory.cpp
index 18a596f..1be5ca6 100644
--- a/tools/shared/qtpropertybrowser/qteditorfactory.cpp
+++ b/tools/shared/qtpropertybrowser/qteditorfactory.cpp
@@ -2202,11 +2202,9 @@ void QtColorEditWidget::setValue(const QColor &c)
void QtColorEditWidget::buttonClicked()
{
- bool ok = false;
- QRgb oldRgba = m_color.rgba();
- QRgb newRgba = QColorDialog::getRgba(oldRgba, &ok, this);
- if (ok && newRgba != oldRgba) {
- setValue(QColor::fromRgba(newRgba));
+ const QColor newColor = QColorDialog::getColor(m_color, this, QString(), QColorDialog::ShowAlphaChannel);
+ if (newColor.isValid() && newColor != m_color) {
+ setValue(newColor);
emit valueChanged(m_color);
}
}