summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@nokia.com>2012-08-17 11:10:15 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-20 15:52:51 +0200
commita03e815b6cf363cd6a2d82e36f0d90bcbd19972c (patch)
tree51d45fd72dc2bb7feff3279194eb6f4b8fa44451
parentdd121752e9e71c44f82f9417ce567af69bd9f457 (diff)
Enable QComboBox animation on Windows and fixing related bugs
QWidget:grab() has a default parameter (invalid rect). QRect() is the null rect and widget->grab(QRect()) returns an empty pixmap. QWidget:grab() has to be free of side effects and should not affect any dirty flags. Change-Id: I8ff558343c366769cd6c587e77f862668e8054f2 Task-number: QTBUG-25436 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
-rw-r--r--src/widgets/kernel/qwidget.cpp3
-rw-r--r--src/widgets/widgets/qcombobox.cpp2
-rw-r--r--src/widgets/widgets/qeffects.cpp2
3 files changed, 5 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index d41e80fad0..c2b78e8603 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -4757,6 +4757,7 @@ QPixmap QWidget::grab(const QRect &rectangle)
const QWidget::RenderFlags renderFlags = QWidget::DrawWindowBackground | QWidget::DrawChildren | QWidget::IgnoreMask;
+ const bool oldDirtyOpaqueChildren = d->dirtyOpaqueChildren;
QRect r(rectangle);
if (r.width() < 0 || r.height() < 0) {
// For grabbing widgets that haven't been shown yet,
@@ -4772,6 +4773,8 @@ QPixmap QWidget::grab(const QRect &rectangle)
if (!d->isOpaque)
res.fill(Qt::transparent);
render(&res, QPoint(), QRegion(r), renderFlags);
+
+ d->dirtyOpaqueChildren = oldDirtyOpaqueChildren;
return res;
}
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 916ec2ff09..82e005ec79 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -2470,7 +2470,7 @@ void QComboBox::showPopup()
const bool updatesEnabled = container->updatesEnabled();
#endif
-#if defined(Q_WS_WIN) && !defined(QT_NO_EFFECTS)
+#if !defined(QT_NO_EFFECTS)
bool scrollDown = (listRect.topLeft() == below);
if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo)
&& !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) && !window()->testAttribute(Qt::WA_DontShowOnScreen))
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index 452f04ea6b..c6e7154238 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -162,7 +162,7 @@ void QAlphaWidget::run(int time)
move(widget->geometry().x(),widget->geometry().y());
resize(widget->size().width(), widget->size().height());
- frontImage = widget->grab(QRect()).toImage();
+ frontImage = widget->grab().toImage();
backImage = QGuiApplication::primaryScreen()->grabWindow(QApplication::desktop()->winId(),
widget->geometry().x(), widget->geometry().y(),
widget->geometry().width(), widget->geometry().height()).toImage();