diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-03-24 09:39:52 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-03-24 09:51:32 (GMT) |
commit | 22d472c17167c4ca8df5678842768ab63b7baadd (patch) | |
tree | 9284e29c3ba3c8bb3a285c06a20a6e0541c4d33e /src/gui/graphicsview | |
parent | e773b0486a4784994a900c03a2620baf2775ac9d (diff) | |
download | Qt-22d472c17167c4ca8df5678842768ab63b7baadd.zip Qt-22d472c17167c4ca8df5678842768ab63b7baadd.tar.gz Qt-22d472c17167c4ca8df5678842768ab63b7baadd.tar.bz2 |
Do not cache the sizeHint() while we're in QGraphicsWidget's constructor.
Do not send a QFontChange event before the item has been polished. This
is because we cannot call a virtual function while we're in the ctor.
This is basically the same as how we do it in QWidget.
Task-number: 246215
Reviewed-by: alexis
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget.cpp | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget_p.cpp | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicswidget_p.h | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 5cc18f9..64ec0e7 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -1269,6 +1269,8 @@ bool QGraphicsWidget::event(QEvent *event) break; case QEvent::Polish: polishEvent(); + d->polished = true; + d->updateFont(d->font); break; case QEvent::WindowActivate: case QEvent::WindowDeactivate: diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index 641409d..789f8da 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -274,6 +274,8 @@ void QGraphicsWidgetPrivate::updateFont(const QFont &font) } } + if (!polished) + return; // Notify change. QEvent event(QEvent::FontChange); QApplication::sendEvent(q, &event); diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h index afa6812..455a129 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.h +++ b/src/gui/graphicsview/qgraphicswidget_p.h @@ -85,6 +85,7 @@ public: inheritedPaletteResolveMask(0), inheritedFontResolveMask(0), inSetGeometry(0), + polished(0), focusPolicy(Qt::NoFocus), focusNext(0), focusPrev(0), @@ -193,6 +194,7 @@ public: } quint32 attributes : 10; quint32 inSetGeometry : 1; + quint32 polished: 1; // Focus Qt::FocusPolicy focusPolicy; |