diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2011-07-07 06:59:55 (GMT) |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-07-07 06:59:55 (GMT) |
commit | b2799a705b6d7655bb23ec4121fd76ce8a94b344 (patch) | |
tree | db7e2a482ca35a40ca7cfb4f4999ec15396a8b55 /src/corelib | |
parent | 6415e22649dd8620728c8c32b918c7afb8efc4dc (diff) | |
parent | e6843c5a9cf4949e7521c1304bb5dc5d48fbc9be (diff) | |
download | Qt-b2799a705b6d7655bb23ec4121fd76ce8a94b344.zip Qt-b2799a705b6d7655bb23ec4121fd76ce8a94b344.tar.gz Qt-b2799a705b6d7655bb23ec4121fd76ce8a94b344.tar.bz2 |
Merge remote branch 'mainline/4.8'
Conflicts:
dist/changes-4.8.0
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/codecs/qtextcodec_symbian.cpp | 4 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 63 | ||||
-rw-r--r-- | src/corelib/kernel/qabstractitemmodel.cpp | 37 | ||||
-rw-r--r-- | src/corelib/kernel/qabstractitemmodel.h | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qscopedpointer.h | 4 |
6 files changed, 78 insertions, 37 deletions
diff --git a/src/corelib/codecs/qtextcodec_symbian.cpp b/src/corelib/codecs/qtextcodec_symbian.cpp index c8a7357..504a7c8 100644 --- a/src/corelib/codecs/qtextcodec_symbian.cpp +++ b/src/corelib/codecs/qtextcodec_symbian.cpp @@ -119,11 +119,13 @@ static const QSymbianCodecInitData codecsData[] = { { /*271082504*/ 271082504, 0, "portuguese_locking_gsm7ext\0" }, { /*271082505*/ 271082505, 0, "portuguese_locking_single\0" }, { /*271082506*/ 271082506, 0, "spanish_gsm7_single\0" }, + { /*271082762*/ 271082762, 0, "hkscs_2004\0" }, { /*271085624*/ 271085624, 114, "GB18030\0" }, { /*536929574*/ 536929574, 38, "EUC-KR\0" }, { /*536936703*/ 536936703, 0, "CP949\0" }, { /*536936705*/ 536936705, 37, "ISO-2022-KR\0csISO2022KR\0" }, - { /*536941517*/ 536941517, 36, "KS_C_5601-1987\0iso-ir-149\0KS_C_5601-1989\0KSC_5601\0Korean\0csKSC56011987\0" } + { /*536941517*/ 536941517, 36, "KS_C_5601-1987\0iso-ir-149\0KS_C_5601-1989\0KSC_5601\0Korean\0csKSC56011987\0" }, + { /*537124345*/ 537124345, 119, "KZ-1048\0" } }; diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1f5f537..9c7f1c6 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -536,6 +536,11 @@ namespace QT_NAMESPACE {} # define Q_COMPILER_LAMBDA # define Q_COMPILER_UNICODE_STRINGS # endif +# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 + /* C++0x features supported in GCC 4.6: */ +# define Q_COMPILER_CONSTEXPR +# endif + # endif /* IBM compiler versions are a bit messy. There are actually two products: @@ -1135,6 +1140,12 @@ redefine to built-in booleans to make autotests work properly */ # define QT_FASTCALL #endif +#ifdef Q_COMPILER_CONSTEXPR +# define Q_DECL_CONSTEXPR constexpr +#else +# define Q_DECL_CONSTEXPR +#endif + //defines the type for the WNDPROC on windows //the alignment needs to be forced for sse2 to not crash with mingw #if defined(Q_WS_WIN) @@ -1166,25 +1177,25 @@ typedef double qreal; */ template <typename T> -inline T qAbs(const T &t) { return t >= 0 ? t : -t; } +Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; } -inline int qRound(qreal d) +Q_DECL_CONSTEXPR inline int qRound(qreal d) { return d >= qreal(0.0) ? int(d + qreal(0.5)) : int(d - int(d-1) + qreal(0.5)) + int(d-1); } #if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN) -inline qint64 qRound64(double d) +Q_DECL_CONSTEXPR inline qint64 qRound64(double d) { return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); } #else -inline qint64 qRound64(qreal d) +Q_DECL_CONSTEXPR inline qint64 qRound64(qreal d) { return d >= qreal(0.0) ? qint64(d + qreal(0.5)) : qint64(d - qreal(qint64(d-1)) + qreal(0.5)) + qint64(d-1); } #endif template <typename T> -inline const T &qMin(const T &a, const T &b) { if (a < b) return a; return b; } +Q_DECL_CONSTEXPR inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; } template <typename T> -inline const T &qMax(const T &a, const T &b) { if (a < b) return b; return a; } +Q_DECL_CONSTEXPR inline const T &qMax(const T &a, const T &b) { return (a < b) ? b : a; } template <typename T> -inline const T &qBound(const T &min, const T &val, const T &max) +Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max) { return qMax(min, qMin(max, val)); } #ifdef QT3_SUPPORT @@ -1978,12 +1989,12 @@ inline bool operator!=(QBool b1, bool b2) { return !b1 != !b2; } inline bool operator!=(bool b1, QBool b2) { return !b1 != !b2; } inline bool operator!=(QBool b1, QBool b2) { return !b1 != !b2; } -static inline bool qFuzzyCompare(double p1, double p2) +Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2) { return (qAbs(p1 - p2) <= 0.000000000001 * qMin(qAbs(p1), qAbs(p2))); } -static inline bool qFuzzyCompare(float p1, float p2) +Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2) { return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); } @@ -1991,7 +2002,7 @@ static inline bool qFuzzyCompare(float p1, float p2) /*! \internal */ -static inline bool qFuzzyIsNull(double d) +Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) { return qAbs(d) <= 0.000000000001; } @@ -1999,7 +2010,7 @@ static inline bool qFuzzyIsNull(double d) /*! \internal */ -static inline bool qFuzzyIsNull(float f) +Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) { return qAbs(f) <= 0.00001f; } @@ -2267,9 +2278,9 @@ class QFlags int i; public: typedef Enum enum_type; - inline QFlags(const QFlags &f) : i(f.i) {} - inline QFlags(Enum f) : i(f) {} - inline QFlags(Zero = 0) : i(0) {} + Q_DECL_CONSTEXPR inline QFlags(const QFlags &f) : i(f.i) {} + Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(f) {} + Q_DECL_CONSTEXPR inline QFlags(Zero = 0) : i(0) {} inline QFlags(QFlag f) : i(f) {} inline QFlags &operator=(const QFlags &f) { i = f.i; return *this; } @@ -2280,18 +2291,18 @@ public: inline QFlags &operator^=(QFlags f) { i ^= f.i; return *this; } inline QFlags &operator^=(Enum f) { i ^= f; return *this; } - inline operator int() const { return i; } + Q_DECL_CONSTEXPR inline operator int() const { return i; } - inline QFlags operator|(QFlags f) const { QFlags g; g.i = i | f.i; return g; } - inline QFlags operator|(Enum f) const { QFlags g; g.i = i | f; return g; } - inline QFlags operator^(QFlags f) const { QFlags g; g.i = i ^ f.i; return g; } - inline QFlags operator^(Enum f) const { QFlags g; g.i = i ^ f; return g; } - inline QFlags operator&(int mask) const { QFlags g; g.i = i & mask; return g; } - inline QFlags operator&(uint mask) const { QFlags g; g.i = i & mask; return g; } - inline QFlags operator&(Enum f) const { QFlags g; g.i = i & f; return g; } - inline QFlags operator~() const { QFlags g; g.i = ~i; return g; } + Q_DECL_CONSTEXPR inline QFlags operator|(QFlags f) const { return QFlags(Enum(i | f.i)); } + Q_DECL_CONSTEXPR inline QFlags operator|(Enum f) const { return QFlags(Enum(i | f)); } + Q_DECL_CONSTEXPR inline QFlags operator^(QFlags f) const { return QFlags(Enum(i ^ f.i)); } + Q_DECL_CONSTEXPR inline QFlags operator^(Enum f) const { return QFlags(Enum(i ^ f)); } + Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const { return QFlags(Enum(i & mask)); } + Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const { return QFlags(Enum(i & mask)); } + Q_DECL_CONSTEXPR inline QFlags operator&(Enum f) const { return QFlags(Enum(i & f)); } + Q_DECL_CONSTEXPR inline QFlags operator~() const { return QFlags(Enum(~i)); } - inline bool operator!() const { return !i; } + Q_DECL_CONSTEXPR inline bool operator!() const { return !i; } inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == int(f) ); } }; @@ -2304,9 +2315,9 @@ inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) \ { return QIncompatibleFlag(int(f1) | f2); } #define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \ -inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \ +Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \ { return QFlags<Flags::enum_type>(f1) | f2; } \ -inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \ +Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \ { return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index b7ac6aa..ddf1fbb 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -1348,6 +1348,26 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, */ /*! + \since 4.8 + + This slot is called just after the internal data of a model is cleared + while it is being reset. + + This slot is provided the convenience of subclasses of concrete proxy + models, such as subclasses of QSortFilterProxyModel which maintain extra + data. + + \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 10 + + \sa modelAboutToBeReset(), modelReset() +*/ +void QAbstractItemModel::resetInternalData() +{ + +} + + +/*! Constructs an abstract item model with the given \a parent. */ QAbstractItemModel::QAbstractItemModel(QObject *parent) @@ -1747,18 +1767,19 @@ QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const Returns true if the data and action can be handled by the model; otherwise returns false. - Although the specified \a row, \a column and \a parent indicate the - location of an item in the model where the operation ended, it is the - responsibility of the view to provide a suitable location for where the - data should be inserted. + The specified \a row, \a column and \a parent indicate the location of an + item in the model where the operation ended. It is the responsibility of + the model to complete the action at the correct location. For instance, a drop action on an item in a QTreeView can result in new items either being inserted as children of the item specified by \a row, \a column, and \a parent, or as siblings of the item. - When row and column are -1 it means that it is up to the model to decide - where to place the data. This can occur in a tree when data is dropped on - a parent. Models will usually append the data to the parent in this case. + When \a row and \a column are -1 it means that the dropped data should be + considered as dropped directly on \a parent. Usually this will mean + appending the data as child items of \a parent. If \a row and column are + greater than or equal zero, it means that the drop occurred just before the + specified \a row and \a column in the specified \a parent. \sa supportedDropActions(), {Using drag and drop with item views} */ @@ -2888,6 +2909,7 @@ void QAbstractItemModel::reset() Q_D(QAbstractItemModel); emit modelAboutToBeReset(); d->invalidatePersistentIndexes(); + QMetaObject::invokeMethod(this, "resetInternalData"); emit modelReset(); } @@ -2930,6 +2952,7 @@ void QAbstractItemModel::endResetModel() { Q_D(QAbstractItemModel); d->invalidatePersistentIndexes(); + QMetaObject::invokeMethod(this, "resetInternalData"); emit modelReset(); } diff --git a/src/corelib/kernel/qabstractitemmodel.h b/src/corelib/kernel/qabstractitemmodel.h index c7af7a2..eab1475 100644 --- a/src/corelib/kernel/qabstractitemmodel.h +++ b/src/corelib/kernel/qabstractitemmodel.h @@ -303,6 +303,9 @@ protected: void setRoleNames(const QHash<int,QByteArray> &roleNames); +protected Q_SLOTS: + void resetInternalData(); + private: Q_DECLARE_PRIVATE(QAbstractItemModel) Q_DISABLE_COPY(QAbstractItemModel) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 88618c3..67dbadb 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2939,7 +2939,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal, \a receiver. Returns true if the connection is successfully broken; otherwise returns false. - This function provides the same posibilities like + This function provides the same possibilities like disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) but uses QMetaMethod to represent the signal and the method to be disconnected. @@ -2957,7 +2957,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal, QMetaMethod() may be used as wildcard in the meaning "any signal" or "any slot in receiving object". In the same way 0 can be used for \a receiver in the meaning "any receiving object". In this case - method shoud also be QMetaMethod(). \a sender parameter should be never 0. + method should also be QMetaMethod(). \a sender parameter should be never 0. \sa disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) */ diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index b15bcac..a24f62e 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -208,8 +208,10 @@ template <typename T, typename Cleanup = QScopedPointerArrayDeleter<T> > class QScopedArrayPointer : public QScopedPointer<T, Cleanup> { public: + inline QScopedArrayPointer() : QScopedPointer<T, Cleanup>(0) {} + template <typename D> - explicit inline QScopedArrayPointer(D *p = 0, typename QtPrivate::QScopedArrayEnsureSameType<T,D>::Type = 0) + explicit inline QScopedArrayPointer(D *p, typename QtPrivate::QScopedArrayEnsureSameType<T,D>::Type = 0) : QScopedPointer<T, Cleanup>(p) { } |