diff options
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qabstractitemmodel.cpp | 56 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 13 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication_p.h | 7 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian_p.h | 1 |
5 files changed, 79 insertions, 0 deletions
diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index b0503be..3660a3c 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -2530,6 +2530,62 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star condition is true, in which case you should abort your move operation. + \table 80% + \row + \o \inlineimage modelview-move-rows-1.png Moving rows to another parent + \o Specify the first and last row numbers for the span of rows in + the source parent you want to move in the model. Also specify + the row in the destination parent to move the span to. + + For example, as shown in the diagram, we move three rows from + row 2 to 4 in the source, so \a sourceFirst is 2 and \a sourceLast is 4. + We move those items to above row 2 in the destination, so \a destinationRow is 2. + + \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 6 + + This moves the three rows rows 2, 3, and 4 in the source to become 2, 3 and 4 in + the destination. Other affected siblings are displaced accordingly. + \row + \o \inlineimage modelview-move-rows-2.png Moving rows to append to another parent + \o To append rows to another parent, move them to after the last row. + + For example, as shown in the diagram, we move three rows to a + collection of 6 existing rows (ending in row 5), so \a destinationStart is 6: + + \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 7 + + This moves the target rows to the end of the target parent as 6, 7 and 8. + \row + \o \inlineimage modelview-move-rows-3.png Moving rows in the same parent up + \o To move rows within the same parent, specify the row to move them to. + + For example, as shown in the diagram, we move one item from row 2 to row 0, + so \a sourceFirst and \a sourceLast are 2 and \a destinationChild is 0. + + \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 8 + + Note that other rows may be displaced accordingly. Note also that when moving + items within the same parent you should not attempt invalid or no-op moves. In + the above example, item 2 is at row 2 before the move, so it can not be moved + to row 2 (where it is already) or row 3 (no-op as row 3 means above row 3, where + it is already) + + \row + \o \inlineimage modelview-move-rows-4.png Moving rows in the same parent down + \o To move rows within the same parent, specify the row to move them to. + + For example, as shown in the diagram, we move one item from row 2 to row 4, + so \a sourceFirst and \a sourceLast are 2 and \a destinationChild is 4. + + \snippet doc/src/snippets/code/src_corelib_kernel_qabstractitemmodel.cpp 9 + + Note that other rows may be displaced accordingly. + \endtable + + \note This function emits the rowsAboutToBeInserted() signal which + connected views (or proxies) must handle before the data is inserted. + Otherwise, the views may end up in an invalid state. + \sa endMoveRows() \since 4.6 diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 609e6b3..4e6e6b9 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -63,6 +63,7 @@ #include <qvarlengtharray.h> #include <private/qfactoryloader_p.h> #include <private/qfunctions_p.h> +#include <private/qlocale_p.h> #ifdef Q_OS_SYMBIAN # include <exception> @@ -521,6 +522,9 @@ QCoreApplication::QCoreApplication(int &argc, char **argv) QFactoryLoader::refreshAll(); #endif +#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE) + d_func()->symbianInit(); +#endif } // ### move to QCoreApplicationPrivate constructor? @@ -597,6 +601,15 @@ void QCoreApplication::init() qt_startup_hook(); } +#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE) +void QCoreApplicationPrivate::symbianInit() +{ + if (!environmentChangeNotifier) + environmentChangeNotifier.reset(new QEnvironmentChangeNotifier); +} +#endif + + /*! Destroys the QCoreApplication object. */ diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 77188d3..e066137 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -65,6 +65,9 @@ QT_BEGIN_NAMESPACE typedef QList<QTranslator*> QTranslatorList; +#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE) +class QEnvironmentChangeNotifier; +#endif class QAbstractEventDispatcher; class Q_CORE_EXPORT QCoreApplicationPrivate : public QObjectPrivate @@ -113,6 +116,10 @@ public: bool aboutToQuitEmitted; QString cachedApplicationDirPath; QString cachedApplicationFilePath; +#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE) + QScopedPointer<QEnvironmentChangeNotifier> environmentChangeNotifier; + void symbianInit(); +#endif static bool isTranslatorInstalled(QTranslator *translator); diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index a6d486e..687a6d9 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -1105,3 +1105,5 @@ void CQtActiveScheduler::Error(TInt aError) const } QT_END_NAMESPACE + +#include "moc_qeventdispatcher_symbian_p.cpp" diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 05758ca..bc42753 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -221,6 +221,7 @@ public: // from CActiveScheduler class Q_CORE_EXPORT QEventDispatcherSymbian : public QAbstractEventDispatcher { + Q_OBJECT Q_DECLARE_PRIVATE(QAbstractEventDispatcher) public: |