const bool updatesEnabled = container->updatesEnabled();
-// windows are displayed immediately on this platform, which means that the window will
-// be visible before the call to container->show() returns. If updates are disabled at
-// this point we'll miss our chance at painting the popup menu before it's shown, causing
-// flicker since the window then displays the standard gray background.
+ bool scrollDown = (listRect.topLeft() == below);
+ if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo)
+ && !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) && !window()->testAttribute(Qt::WA_DontShowOnScreen)) {
+ qScrollEffect(container, scrollDown ? QEffects::DownScroll : QEffects::UpScroll, 150);
+ }
+
+ // windows are displayed immediately on this platform, which means that the window will
+ // be visible before the call to container->show() returns. If updates are disabled at
+ // this point we'll miss our chance at painting the popup menu before it's shown, causing
+ // flicker since the window then displays the standard gray background.
container->setUpdatesEnabled(false);
container->raise();
{
Q_OBJECT
public:
- QRollEffect(QWidget* w, Qt::WindowFlags f, DirFlags orient);
+ QRollEffect(QWidget* w, Qt::WindowFlags f, DirFlags orient, int duration);
void run();
static QRollEffect* q_roll = nullptr;
-QRollEffect::QRollEffect(QWidget* w, Qt::WindowFlags f, DirFlags orient)
+QRollEffect::QRollEffect(QWidget* w, Qt::WindowFlags f, DirFlags orient, int dur)
: QWidget(0, f),
widget(w),
+ duration(dur),
elapsed(0),
done(false),
orientation(orient)
if (orientation & (DownScroll|UpScroll)) {
dist += totalHeight - currentHeight;
}
- duration = qMin(qMax(dist/3, 50), 120);
+ if (!duration) {
+ duration = qMin(qMax(dist/3, 50), 120);
+ }
connect(&anim, SIGNAL(timeout()), this, SLOT(scroll()));
/*!
Scroll widget \a w. \a orient may be 1 (vertical), 2 (horizontal) or 3 (diagonal).
*/
-void qScrollEffect(QWidget* w, QEffects::DirFlags orient)
+void qScrollEffect(QWidget* w, QEffects::DirFlags orient, int duration)
{
if (q_roll) {
q_roll->deleteLater();
QApplication::sendPostedEvents(w, QEvent::Resize);
// those can be popups - they would steal the focus, but are disabled
- q_roll = new QRollEffect(w, Qt::ToolTip, orient);
+ q_roll = new QRollEffect(w, Qt::ToolTip, orient, duration);
}
/*!