summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorThorbjørn Martsum <tmartsum@gmail.com>2013-07-01 07:10:48 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-03 05:34:34 +0200
commit29570d8442cce4bd2756ba4949afecbf50d4368e (patch)
treeb8dabe3034c190fb61cb5781cbc809b2385dfc5e /src/widgets/kernel
parentee79d942714d28d517bd0f1f48d66b65d2026626 (diff)
QStyle - tooltip - add wakeDelay and sleepDelay as styleHints
In earlier patches we allowed the user to control the tooltip duration. However the user still couldn't control the wake delay and sleep delay. This patch changes that and is the final patch in solving: Task-number: QTBUG-1016 Change-Id: I5e2c719737634ad7f371ad03691744612472ae70 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qapplication.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index adccee9426..cb2eab8468 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1852,8 +1852,11 @@ bool QApplication::event(QEvent *e)
if (showToolTip) {
QHelpEvent e(QEvent::ToolTip, d->toolTipPos, d->toolTipGlobalPos);
QApplication::sendEvent(d->toolTipWidget, &e);
- if (e.isAccepted())
- d->toolTipFallAsleep.start(2000, this);
+ if (e.isAccepted()) {
+ QStyle *s = d->toolTipWidget->style();
+ int sleepDelay = s->styleHint(QStyle::SH_ToolTip_FallAsleepDelay, 0, d->toolTipWidget, 0);
+ d->toolTipFallAsleep.start(sleepDelay, this);
+ }
}
}
} else if (te->timerId() == d->toolTipFallAsleep.timerId()) {
@@ -2956,7 +2959,9 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
d->toolTipWidget = w;
d->toolTipPos = relpos;
d->toolTipGlobalPos = mouse->globalPos();
- d->toolTipWakeUp.start(d->toolTipFallAsleep.isActive()?20:700, this);
+ QStyle *s = d->toolTipWidget->style();
+ int wakeDelay = s->styleHint(QStyle::SH_ToolTip_WakeUpDelay, 0, d->toolTipWidget, 0);
+ d->toolTipWakeUp.start(d->toolTipFallAsleep.isActive() ? 20 : wakeDelay, this);
}
}