diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-20 18:32:18 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-20 18:32:18 (GMT) |
commit | 471638950e8e3a63ceb0474f3b792112ebb46aba (patch) | |
tree | 3ef1ade022144ed961b6ce3e0c66ce52d9d0bfbc /src/gui | |
parent | dfc61f6b59886f7d223722bf149342cdd46581a8 (diff) | |
parent | ef8cd7f2e68d6d34d70c3a12e82a67ed16b92b72 (diff) | |
download | Qt-471638950e8e3a63ceb0474f3b792112ebb46aba.zip Qt-471638950e8e3a63ceb0474f3b792112ebb46aba.tar.gz Qt-471638950e8e3a63ceb0474f3b792112ebb46aba.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fix crash when using fonts in non-gui QApplication
Deselect the current selection when the QItemSelectionModel::model is reset.
Autotest fix on macosx
Compile with gcc 4.0.1
improve Unicode Normalization autotest
more subtests for QChar
nano optimization of canonicalOrderHelper()
fix canonicalOrderHelper() for some corner case
use new QChar::requiresSurrogates() instead of hardcoded value
prevent fake normalization
prefer QChar::*surrogate() over hardcoded values
Fixed an assert in QMenu
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qicon.cpp | 3 | ||||
-rw-r--r-- | src/gui/itemviews/qitemselectionmodel.cpp | 25 | ||||
-rw-r--r-- | src/gui/itemviews/qitemselectionmodel.h | 1 | ||||
-rw-r--r-- | src/gui/itemviews/qitemselectionmodel_p.h | 3 | ||||
-rw-r--r-- | src/gui/styles/qcleanlooksstyle.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/qcommonstyle.cpp | 3 | ||||
-rw-r--r-- | src/gui/styles/qmacstyle_mac.mm | 2 | ||||
-rw-r--r-- | src/gui/styles/qplastiquestyle.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/qproxystyle.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/qstyle_p.h | 1 | ||||
-rw-r--r-- | src/gui/styles/qstylehelper.cpp | 3 | ||||
-rw-r--r-- | src/gui/styles/qwindowsstyle.cpp | 8 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_x11.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 12 |
14 files changed, 43 insertions, 31 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 7696632..a2f429a 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -55,7 +55,6 @@ #include "qcache.h" #include "qdebug.h" #include "private/qguiplatformplugin_p.h" -#include "private/qstylehelper_p.h" #ifdef Q_WS_MAC #include <private/qt_mac_p.h> @@ -67,6 +66,8 @@ #include "private/qkde_p.h" #endif +#include "private/qstylehelper_p.h" + #ifndef QT_NO_ICON QT_BEGIN_NAMESPACE diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp index f848321..fc99439 100644 --- a/src/gui/itemviews/qitemselectionmodel.cpp +++ b/src/gui/itemviews/qitemselectionmodel.cpp @@ -566,6 +566,8 @@ void QItemSelectionModelPrivate::initModel(QAbstractItemModel *model) q, SLOT(_q_layoutAboutToBeChanged())); QObject::connect(model, SIGNAL(layoutChanged()), q, SLOT(_q_layoutChanged())); + QObject::connect(model, SIGNAL(modelAboutToBeReset()), + q, SLOT(_q_modelAboutToBeReset())); } } @@ -896,6 +898,13 @@ void QItemSelectionModelPrivate::_q_layoutChanged() savedPersistentCurrentIndexes.clear(); } +void QItemSelectionModelPrivate::_q_modelAboutToBeReset() +{ + Q_Q(QItemSelectionModel); + q->clearSelection(); + clearCurrentIndex(); +} + /*! \class QItemSelectionModel @@ -1095,12 +1104,18 @@ void QItemSelectionModel::clear() { Q_D(QItemSelectionModel); clearSelection(); - QModelIndex previous = d->currentIndex; - d->currentIndex = QModelIndex(); + d->clearCurrentIndex(); +} + +void QItemSelectionModelPrivate::clearCurrentIndex() +{ + Q_Q(QItemSelectionModel); + QModelIndex previous = currentIndex; + currentIndex = QModelIndex(); if (previous.isValid()) { - emit currentChanged(d->currentIndex, previous); - emit currentRowChanged(d->currentIndex, previous); - emit currentColumnChanged(d->currentIndex, previous); + emit q->currentChanged(currentIndex, previous); + emit q->currentRowChanged(currentIndex, previous); + emit q->currentColumnChanged(currentIndex, previous); } } diff --git a/src/gui/itemviews/qitemselectionmodel.h b/src/gui/itemviews/qitemselectionmodel.h index 436514f..8682109 100644 --- a/src/gui/itemviews/qitemselectionmodel.h +++ b/src/gui/itemviews/qitemselectionmodel.h @@ -197,6 +197,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_rowsAboutToBeInserted(const QModelIndex&, int, int)) Q_PRIVATE_SLOT(d_func(), void _q_layoutAboutToBeChanged()) Q_PRIVATE_SLOT(d_func(), void _q_layoutChanged()) + Q_PRIVATE_SLOT(d_func(), void _q_modelAboutToBeReset()) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QItemSelectionModel::SelectionFlags) diff --git a/src/gui/itemviews/qitemselectionmodel_p.h b/src/gui/itemviews/qitemselectionmodel_p.h index 5afa90d..c2fe976 100644 --- a/src/gui/itemviews/qitemselectionmodel_p.h +++ b/src/gui/itemviews/qitemselectionmodel_p.h @@ -78,6 +78,7 @@ public: void _q_columnsAboutToBeInserted(const QModelIndex &parent, int start, int end); void _q_layoutAboutToBeChanged(); void _q_layoutChanged(); + void _q_modelAboutToBeReset(); inline void remove(QList<QItemSelectionRange> &r) { @@ -93,6 +94,8 @@ public: currentSelection.clear(); } + void clearCurrentIndex(); + QPointer<QAbstractItemModel> model; QItemSelection ranges; QItemSelection currentSelection; diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index d9f7df0..883f511 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -44,7 +44,6 @@ #if !defined(QT_NO_STYLE_CLEANLOOKS) || defined(QT_PLUGIN) -#include <private/qstylehelper_p.h> #include "qwindowsstyle_p.h" #include <qcombobox.h> #include <qpushbutton.h> @@ -67,6 +66,7 @@ #include <qtoolbar.h> #include <qwizard.h> #include <qlibrary.h> +#include <private/qstylehelper_p.h> #define CL_MAX(a,b) (a)>(b) ? (a):(b) // ### qMin/qMax does not work for vc6 #define CL_MIN(a,b) (a)<(b) ? (a):(b) // remove this when it is working diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 8036728..4978565 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -65,7 +65,6 @@ #include <qrubberband.h> #include <private/qcommonstylepixmaps_p.h> #include <private/qmath_p.h> -#include <private/qstylehelper_p.h> #include <qdebug.h> #include <qtextformat.h> #include <qwizard.h> @@ -88,6 +87,8 @@ # include <private/qt_cocoa_helpers_mac_p.h> #endif +#include <private/qstylehelper_p.h> + QT_BEGIN_NAMESPACE /*! diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index e065bcc..2e2f374 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -56,7 +56,6 @@ #include <private/qpaintengine_mac_p.h> #include <private/qpainter_p.h> #include <private/qprintengine_mac_p.h> -#include <private/qstylehelper_p.h> #include <qapplication.h> #include <qbitmap.h> #include <qcheckbox.h> @@ -101,6 +100,7 @@ #include <QtGui/qgraphicsproxywidget.h> #include <QtGui/qgraphicsview.h> #include <private/qt_cocoa_helpers_mac_p.h> +#include <private/qstylehelper_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index fbb5e4d..c8711f6 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -50,7 +50,6 @@ static const int ProgressBarFps = 25; static const int blueFrameWidth = 2; // with of line edit focus frame #include "qwindowsstyle_p.h" -#include <private/qstylehelper_p.h> #include <qapplication.h> #include <qbitmap.h> #include <qabstractitemview.h> @@ -88,6 +87,7 @@ static const int blueFrameWidth = 2; // with of line edit focus frame #include <qprocess.h> #include <qvarlengtharray.h> #include <limits.h> +#include <private/qstylehelper_p.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/styles/qproxystyle.cpp b/src/gui/styles/qproxystyle.cpp index 5235350..511c025 100644 --- a/src/gui/styles/qproxystyle.cpp +++ b/src/gui/styles/qproxystyle.cpp @@ -40,11 +40,11 @@ ****************************************************************************/ #include <qstyle.h> -#include <private/qstyle_p.h> #include <private/qproxystyle_p.h> #include <private/qapplication_p.h> #include "qproxystyle.h" #include "qstylefactory.h" +#include <private/qstyle_p.h> #if !defined(QT_NO_STYLE_PROXY) || defined(QT_PLUGIN) diff --git a/src/gui/styles/qstyle_p.h b/src/gui/styles/qstyle_p.h index 4729032..745092f 100644 --- a/src/gui/styles/qstyle_p.h +++ b/src/gui/styles/qstyle_p.h @@ -43,7 +43,6 @@ #define QSTYLE_P_H #include "private/qobject_p.h" -#include "private/qstylehelper_p.h" #include <QtGui/qstyle.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp index d09d7fa..ccdbf8c 100644 --- a/src/gui/styles/qstylehelper.cpp +++ b/src/gui/styles/qstylehelper.cpp @@ -39,8 +39,6 @@ ** ****************************************************************************/ -#include "qstylehelper_p.h" - #include <qstyleoption.h> #include <qpainter.h> #include <qpixmapcache.h> @@ -54,6 +52,7 @@ #include <private/qt_cocoa_helpers_mac_p.h> #endif +#include "qstylehelper_p.h" #include <qstringbuilder.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 1653baa..0314c6f 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -41,7 +41,6 @@ #include "qwindowsstyle.h" #include "qwindowsstyle_p.h" -#include <private/qstylehelper_p.h> #if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) @@ -70,13 +69,14 @@ #include <private/qmath_p.h> #include <qmath.h> - #ifdef Q_WS_X11 #include "qfileinfo.h" #include "qdir.h" #include <private/qt_x11_p.h> #endif +#include <private/qstylehelper_p.h> + QT_BEGIN_NAMESPACE #if defined(Q_WS_WIN) @@ -1911,7 +1911,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->setPen(discol); } - int xm = QWindowsStylePrivate::windowsItemFrame + checkcol + QWindowsStylePrivate::windowsItemHMargin; + int xm = int(QWindowsStylePrivate::windowsItemFrame) + checkcol + int(QWindowsStylePrivate::windowsItemHMargin); int xpos = menuitem->rect.x() + xm; QRect textRect(xpos, y + QWindowsStylePrivate::windowsItemVMargin, w - xm - QWindowsStylePrivate::windowsRightBorder - tab + 1, h - 2 * QWindowsStylePrivate::windowsItemVMargin); @@ -3223,7 +3223,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, int checkcol = qMax<int>(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column w += checkcol; - w += QWindowsStylePrivate::windowsRightBorder + 10; + w += int(QWindowsStylePrivate::windowsRightBorder) + 10; sz.setWidth(w); } break; diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index 3b2e4e9..a7aa2ce 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -78,6 +78,9 @@ QT_BEGIN_NAMESPACE extern double qt_pointSize(double pixelSize, int dpi); extern double qt_pixelSize(double pointSize, int dpi); +// from qapplication.cpp +extern bool qt_is_gui_used; + static inline void capitalize (char *s) { bool space = true; @@ -1938,7 +1941,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script) } else if (X11->has_fontconfig) { fe = loadFc(d, script, req); - if (fe != 0 && fe->fontDef.pixelSize != req.pixelSize) { + 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) { delete fe; @@ -1950,7 +1953,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script) #endif - } else if (mainThread) { + } else if (mainThread && qt_is_gui_used) { fe = loadXlfd(d->screen, script, req); } if (!fe) { diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index f84059d..7941c4e 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -983,19 +983,9 @@ bool QMenuPrivate::mouseEventTaken(QMouseEvent *e) return false; } -class ExceptionGuard -{ -public: - inline ExceptionGuard(bool *w = 0) : watched(w) { Q_ASSERT(!(*watched)); *watched = true; } - inline ~ExceptionGuard() { *watched = false; } - inline operator bool() { return *watched; } -private: - bool *watched; -}; - void QMenuPrivate::activateCausedStack(const QList<QPointer<QWidget> > &causedStack, QAction *action, QAction::ActionEvent action_e, bool self) { - ExceptionGuard guard(&activationRecursionGuard); + QBoolBlocker guard(activationRecursionGuard); #ifdef QT3_SUPPORT const int actionId = q_func()->findIdForAction(action); #endif |