diff options
author | A-Team <ateam@pad.test.qt.nokia.com> | 2010-10-20 22:00:14 (GMT) |
---|---|---|
committer | A-Team <ateam@pad.test.qt.nokia.com> | 2010-10-20 22:00:14 (GMT) |
commit | dd97db856bc19d648d7faa3aac4e27576dcb2512 (patch) | |
tree | 0bb9fde945a0d3883e6fa3291f807c8827bbb48c /src/gui | |
parent | e4b0fe70c6435bb860df526d615dfdf53dfb5abd (diff) | |
parent | 80f031dfca7c161de4461514dfd8d9d664ea2f03 (diff) | |
download | Qt-dd97db856bc19d648d7faa3aac4e27576dcb2512.zip Qt-dd97db856bc19d648d7faa3aac4e27576dcb2512.tar.gz Qt-dd97db856bc19d648d7faa3aac4e27576dcb2512.tar.bz2 |
Merge branch '4.7-upstream' into 4.7-doc
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 19 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_x11.cpp | 21 | ||||
-rw-r--r-- | src/gui/widgets/qmainwindow.cpp | 2 |
3 files changed, 32 insertions, 10 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 2b6aaf5..7ab49cb 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -3322,8 +3322,7 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim */ void QGraphicsItem::clearFocus() { - if (hasFocus()) - d_ptr->clearFocusHelper(/* giveFocusToParent = */ true); + d_ptr->clearFocusHelper(/* giveFocusToParent = */ true); } /*! @@ -3337,8 +3336,14 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent) QGraphicsItem *p = parent; while (p) { if (p->flags() & QGraphicsItem::ItemIsFocusScope) { - p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false, - /* focusFromHide = */ false); + if (p->d_ptr->focusScopeItem == q_ptr) { + p->d_ptr->focusScopeItem = 0; + if (!q_ptr->hasFocus()) //if it has focus, focusScopeItemChange is called elsewhere + focusScopeItemChange(false); + } + if (q_ptr->hasFocus()) + p->d_ptr->setFocusHelper(Qt::OtherFocusReason, /* climb = */ false, + /* focusFromHide = */ false); return; } p = p->d_ptr->parent; @@ -3346,10 +3351,10 @@ void QGraphicsItemPrivate::clearFocusHelper(bool giveFocusToParent) } } - // Invisible items with focus must explicitly clear subfocus. - clearSubFocus(q_ptr); - if (q_ptr->hasFocus()) { + // Invisible items with focus must explicitly clear subfocus. + clearSubFocus(q_ptr); + // If this item has the scene's input focus, clear it. scene->setFocusItem(0); } diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index a7aa2ce..9bf6cc8 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -1891,6 +1891,18 @@ QFontEngine *QFontDatabase::loadXlfd(int screen, int script, const QFontDef &req return fe; } +#if (defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6)) && defined(Q_CC_GNU) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3) +#define NEEDS_GCC_BUG_WORKAROUND +#endif + +#ifdef NEEDS_GCC_BUG_WORKAROUND +static inline void gccBugWorkaround(const QFontDef &req) +{ + char buffer[8]; + snprintf(buffer, 8, "%f", req.pixelSize); +} +#endif + /*! \internal Loads a QFontEngine for the specified \a script that matches the QFontDef \e request member variable. @@ -1902,9 +1914,15 @@ void QFontDatabase::load(const QFontPrivate *d, int script) // normalize the request to get better caching QFontDef req = d->request; if (req.pixelSize <= 0) - req.pixelSize = floor(qt_pixelSize(req.pointSize, d->dpi) * 100 + 0.5) / 100; + req.pixelSize = qFloor(qt_pixelSize(req.pointSize, d->dpi) * 100.0 + 0.5) * 0.01; if (req.pixelSize < 1) req.pixelSize = 1; + +#ifdef NEEDS_GCC_BUG_WORKAROUND + // req.pixelSize ends up with a bogus value unless this workaround is called + gccBugWorkaround(req); +#endif + if (req.weight == 0) req.weight = QFont::Normal; if (req.stretch == 0) @@ -1940,7 +1958,6 @@ void QFontDatabase::load(const QFontPrivate *d, int script) #ifndef QT_NO_FONTCONFIG } else if (X11->has_fontconfig) { fe = loadFc(d, script, req); - if (fe != 0 && fe->fontDef.pixelSize != req.pixelSize && mainThread && qt_is_gui_used) { QFontEngine *xlfdFontEngine = loadXlfd(d->screen, script, req); if (xlfdFontEngine->fontDef.family == fe->fontDef.family) { diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index d971f61..2731182 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -504,7 +504,7 @@ void QMainWindow::setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle) */ QMenuBar *QMainWindow::menuBar() const { - QMenuBar *menuBar = qobject_cast<QMenuBar *>(d_func()->layout->menuBar()); + QMenuBar *menuBar = qobject_cast<QMenuBar *>(layout()->menuBar()); if (!menuBar) { QMainWindow *self = const_cast<QMainWindow *>(this); menuBar = new QMenuBar(self); |