summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-15 11:15:16 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-15 11:15:16 (GMT)
commitf7650a4a05171f759e12f80ca636cc9ffa210142 (patch)
treeae1b0204e3325866ba59063768bcbcd47ce96704 /src
parentb4b45ecbd79f6dfcbc1a0c1a11b06cec880acdf4 (diff)
parent9da13ea53aec6d841ba7f416531d6c52d4368df4 (diff)
downloadQt-f7650a4a05171f759e12f80ca636cc9ffa210142.zip
Qt-f7650a4a05171f759e12f80ca636cc9ffa210142.tar.gz
Qt-f7650a4a05171f759e12f80ca636cc9ffa210142.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fixes tooltips for QGraphicsProxyWidget.
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsproxywidget.cpp31
-rw-r--r--src/gui/graphicsview/qgraphicsproxywidget_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp6
-rw-r--r--src/gui/kernel/qtooltip.cpp4
4 files changed, 41 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp
index 2132526..bdd41cd 100644
--- a/src/gui/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp
@@ -897,6 +897,29 @@ bool QGraphicsProxyWidget::event(QEvent *event)
}
break;
}
+#ifndef QT_NO_TOOLTIP
+ case QEvent::GraphicsSceneHelp: {
+ // Propagate the help event (for tooltip) to the widget under mouse
+ if (d->lastWidgetUnderMouse) {
+ QGraphicsSceneHelpEvent *he = static_cast<QGraphicsSceneHelpEvent *>(event);
+ QPoint pos = d->mapToReceiver(mapFromScene(he->scenePos()), d->lastWidgetUnderMouse).toPoint();
+ QHelpEvent e(QEvent::ToolTip, pos, he->screenPos());
+ QApplication::sendEvent(d->lastWidgetUnderMouse, &e);
+ event->setAccepted(e.isAccepted());
+ return e.isAccepted();
+ }
+ break;
+ }
+ case QEvent::ToolTipChange: {
+ // Propagate tooltip change to the widget
+ if (!d->tooltipChangeMode) {
+ d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::ProxyToWidgetMode;
+ d->widget->setToolTip(toolTip());
+ d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
+ }
+ break;
+ }
+#endif
default:
break;
}
@@ -952,6 +975,14 @@ bool QGraphicsProxyWidget::eventFilter(QObject *object, QEvent *event)
d->styleChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
}
break;
+ case QEvent::ToolTipChange:
+ // Propagate tooltip change to the proxy.
+ if (!d->tooltipChangeMode) {
+ d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::WidgetToProxyMode;
+ setToolTip(d->widget->toolTip());
+ d->tooltipChangeMode = QGraphicsProxyWidgetPrivate::NoMode;
+ }
+ break;
default:
break;
}
diff --git a/src/gui/graphicsview/qgraphicsproxywidget_p.h b/src/gui/graphicsview/qgraphicsproxywidget_p.h
index 8aed363..0e29a7e 100644
--- a/src/gui/graphicsview/qgraphicsproxywidget_p.h
+++ b/src/gui/graphicsview/qgraphicsproxywidget_p.h
@@ -72,6 +72,7 @@ public:
enabledChangeMode(NoMode),
styleChangeMode(NoMode),
paletteChangeMode(NoMode),
+ tooltipChangeMode(NoMode),
focusFromWidgetToProxy(0)
{ }
void init();
@@ -117,6 +118,7 @@ public:
quint32 enabledChangeMode : 2;
quint32 styleChangeMode : 2;
quint32 paletteChangeMode : 2;
+ quint32 tooltipChangeMode : 2;
quint32 focusFromWidgetToProxy : 1;
quint32 proxyIsGivingFocus : 1;
};
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 6581727..b368a82 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -3772,6 +3772,12 @@ void QGraphicsScene::helpEvent(QGraphicsSceneHelpEvent *helpEvent)
QGraphicsItem *toolTipItem = 0;
for (int i = 0; i < itemsAtPos.size(); ++i) {
QGraphicsItem *tmp = itemsAtPos.at(i);
+ if (tmp->d_func()->isProxyWidget()) {
+ // if the item is a proxy widget, the event is forwarded to it
+ sendEvent(tmp, helpEvent);
+ if (helpEvent->isAccepted())
+ return;
+ }
if (!tmp->toolTip().isEmpty()) {
toolTipItem = tmp;
break;
diff --git a/src/gui/kernel/qtooltip.cpp b/src/gui/kernel/qtooltip.cpp
index 1343959..c8fcf45 100644
--- a/src/gui/kernel/qtooltip.cpp
+++ b/src/gui/kernel/qtooltip.cpp
@@ -168,9 +168,9 @@ QTipLabel *QTipLabel::instance = 0;
QTipLabel::QTipLabel(const QString &text, QWidget *w)
#ifndef QT_NO_STYLE_STYLESHEET
- : QLabel(w, Qt::ToolTip), styleSheetParent(0), widget(0)
+ : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), styleSheetParent(0), widget(0)
#else
- : QLabel(w, Qt::ToolTip), widget(0)
+ : QLabel(w, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), widget(0)
#endif
{
delete instance;