diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-07-06 11:55:39 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-07-07 20:35:05 +0200 |
commit | 471e4fcb226c4523efe93b1bdaf0db026495da94 (patch) | |
tree | bb963937b2446eb32d7632568433083a386f2c68 /src/gui/kernel | |
parent | 7f400522c39f6a1abf083dc1af49ea3109635cc8 (diff) |
Use QList instead of QVector in gui implementation
Task-number: QTBUG-84469
Change-Id: I366e845249203d80d640355a7780ac2f91a762f1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qaction.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qevent.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qhighdpiscaling_p.h | 8 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qplatformdialoghelper.cpp | 10 | ||||
-rw-r--r-- | src/gui/kernel/qplatformscreen.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qplatformsharedgraphicscache.cpp | 20 | ||||
-rw-r--r-- | src/gui/kernel/qshortcutmap.cpp | 24 |
9 files changed, 43 insertions, 43 deletions
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index 99a614ddd9..661ba53132 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -570,7 +570,7 @@ QActionGroup *QAction::actionGroup() const \sa QWidget::addAction(), QGraphicsWidget::addAction() */ -QVector<QObject*> QAction::associatedObjects() const +QList<QObject*> QAction::associatedObjects() const { Q_D(const QAction); return d->associatedObjects; diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index f068e6dc30..45e0f0f535 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -4487,7 +4487,7 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const Returns the raw, unfiltered positions for the touch point. The positions are in native screen coordinates. To get local coordinates you can use mapFromGlobal() of the QWindow returned by QTouchEvent::window(). - \note Returns an empty vector if the touch device's capabilities do not include QPointingDevice::RawPositions. + \note Returns an empty list if the touch device's capabilities do not include QPointingDevice::RawPositions. \note Native screen coordinates refer to the native orientation of the screen which, in case of mobile devices, is typically portrait. This means that on systems capable of screen orientation @@ -4496,7 +4496,7 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const \sa QPointingDevice::capabilities(), device(), window() */ -QVector<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const +QList<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const { return d->rawScreenPositions; } @@ -4654,7 +4654,7 @@ void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v) } /*! \internal */ -void QTouchEvent::TouchPoint::setRawScreenPositions(const QVector<QPointF> &positions) +void QTouchEvent::TouchPoint::setRawScreenPositions(const QList<QPointF> &positions) { if (d->ref.loadRelaxed() != 1) d = d->detach(); @@ -4933,7 +4933,7 @@ Qt::ApplicationState QApplicationStateChangeEvent::applicationState() const functions by value. This type actively prevents you from holding it in a QList, because doing so would - be very inefficient. Use a QVector instead, which has the same API as QList, but more + be very inefficient. Use a QList instead, which has the same API as QList, but more efficient storage. \sa QTouchEvent::TouchPoint diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 34331e3b0e..b66ecfdbf7 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -160,7 +160,7 @@ bool QGuiApplicationPrivate::highDpiScalingUpdated = false; QPointer<QWindow> QGuiApplicationPrivate::currentDragWindow; -QVector<QGuiApplicationPrivate::TabletPointData> QGuiApplicationPrivate::tabletDevicePoints; +QList<QGuiApplicationPrivate::TabletPointData> QGuiApplicationPrivate::tabletDevicePoints; QPlatformIntegration *QGuiApplicationPrivate::platform_integration = nullptr; QPlatformTheme *QGuiApplicationPrivate::platform_theme = nullptr; diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index 542506dcb0..2248a7f6a1 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -185,14 +185,14 @@ inline QMargins scale(const QMargins &margins, qreal scaleFactor, QPoint origin } template<typename T> -QList<T> scale(const QList<T> &vector, qreal scaleFactor, QPoint origin = QPoint(0, 0)) +QList<T> scale(const QList<T> &list, qreal scaleFactor, QPoint origin = QPoint(0, 0)) { if (!QHighDpiScaling::isActive()) - return vector; + return list; QList<T> scaled; - scaled.reserve(vector.size()); - for (const T &item : vector) + scaled.reserve(list.size()); + for (const T &item : list) scaled.append(scale(item, scaleFactor, origin)); return scaled; } diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 92737db8d3..baf1f8a2bf 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1050,8 +1050,8 @@ struct QModifKeyName { }; Q_DECLARE_TYPEINFO(QModifKeyName, Q_MOVABLE_TYPE); -Q_GLOBAL_STATIC(QVector<QModifKeyName>, globalModifs) -Q_GLOBAL_STATIC(QVector<QModifKeyName>, globalPortableModifs) +Q_GLOBAL_STATIC(QList<QModifKeyName>, globalModifs) +Q_GLOBAL_STATIC(QList<QModifKeyName>, globalPortableModifs) /*! Constructs a single key from the string \a str. @@ -1069,7 +1069,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma accel = std::move(accel).toLower(); bool nativeText = (format == QKeySequence::NativeText); - QVector<QModifKeyName> *gmodifs; + QList<QModifKeyName> *gmodifs; if (nativeText) { gmodifs = globalModifs(); if (gmodifs->isEmpty()) { @@ -1104,7 +1104,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma } - QVector<QModifKeyName> modifs; + QList<QModifKeyName> modifs; if (nativeText) { modifs << QModifKeyName(Qt::CTRL, QCoreApplication::translate("QShortcut", "Ctrl").toLower().append(QLatin1Char('+'))) << QModifKeyName(Qt::SHIFT, QCoreApplication::translate("QShortcut", "Shift").toLower().append(QLatin1Char('+'))) diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index 4c2e1af84d..e853fdbdcd 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -40,16 +40,16 @@ #include "qplatformdialoghelper.h" #include <QtCore/QCoreApplication> -#include <QtCore/QVariant> +#include <QtCore/QList> #if QT_CONFIG(regularexpression) #include <QtCore/QRegularExpression> #endif -#include <QtCore/QSharedData> #if QT_CONFIG(settings) #include <QtCore/QSettings> #endif +#include <QtCore/QSharedData> #include <QtCore/QUrl> -#include <QtCore/QVector> +#include <QtCore/QVariant> #include <QtGui/QColor> #include <algorithm> @@ -812,7 +812,7 @@ public: QString informativeText; QString detailedText; QPlatformDialogHelper::StandardButtons buttons; - QVector<QMessageDialogOptions::CustomButton> customButtons; + QList<QMessageDialogOptions::CustomButton> customButtons; int nextCustomButtonId; }; @@ -923,7 +923,7 @@ void QMessageDialogOptions::removeButton(int id) d->customButtons.removeOne(CustomButton(id)); } -const QVector<QMessageDialogOptions::CustomButton> &QMessageDialogOptions::customButtons() +const QList<QMessageDialogOptions::CustomButton> &QMessageDialogOptions::customButtons() { return d->customButtons; } diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp index e2890eda1e..b27792ae07 100644 --- a/src/gui/kernel/qplatformscreen.cpp +++ b/src/gui/kernel/qplatformscreen.cpp @@ -554,9 +554,9 @@ void QPlatformScreen::setPowerState(PowerState state) \since 5.9 */ -QVector<QPlatformScreen::Mode> QPlatformScreen::modes() const +QList<QPlatformScreen::Mode> QPlatformScreen::modes() const { - QVector<QPlatformScreen::Mode> list; + QList<QPlatformScreen::Mode> list; list.append({geometry().size(), refreshRate()}); return list; } diff --git a/src/gui/kernel/qplatformsharedgraphicscache.cpp b/src/gui/kernel/qplatformsharedgraphicscache.cpp index f6c4e3309e..971fb0f848 100644 --- a/src/gui/kernel/qplatformsharedgraphicscache.cpp +++ b/src/gui/kernel/qplatformsharedgraphicscache.cpp @@ -100,7 +100,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QPlatformSharedGraphicsCache::requestItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) + \fn void QPlatformSharedGraphicsCache::requestItems(const QByteArray &cacheId, const QList<quint32> &itemIds) Requests all the items in \a itemIds from the cache with the name \a cacheId. @@ -116,7 +116,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QPlatformSharedGraphicsCache::insertItems(const QByteArray &cacheId, const QVector<quint32> &itemIds, const QVector<QImage> &items) + \fn void QPlatformSharedGraphicsCache::insertItems(const QByteArray &cacheId, const QList<quint32> &itemIds, const QList<QImage> &items) Inserts the items in \a itemIds into the cache named \a cacheId. The appearance of each item is stored in \a items. The format of the QImage objects is expected to match the @@ -132,7 +132,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QPlatformSharedGraphicsCache::releaseItems(const QByteArray &cacheId, const QVector<quint32> &itemIds) + \fn void QPlatformSharedGraphicsCache::releaseItems(const QByteArray &cacheId, const QList<quint32> &itemIds) Releases the reference to the items in \a itemIds from the cache named \a cacheId. This should only be called when all references to the items have been released by the user, and they are no @@ -140,20 +140,20 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QPlatformSharedGraphicsCache::itemsMissing(const QByteArray &cacheId, const QVector<quint32> &itemIds) + \fn void QPlatformSharedGraphicsCache::itemsMissing(const QByteArray &cacheId, const QList<quint32> &itemIds) This signal is emitted when requestItems() has been called for one or more items in the cache named \a cacheId which are not yet available in the cache. The user is then expected to call insertItems() to update the cache with the respective items, at which point they will become available to all clients of the shared cache. - The vector \a itemIds contains the IDs of the items that need to be inserted into the cache. + The \a itemIds list contains the IDs of the items that need to be inserted into the cache. \sa itemsAvailable(), insertItems(), requestItems() */ /*! - \fn void QPlatformSharedGraphicsCache::itemsAvailable(const QByteArray &cacheId, void *bufferId, const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer) + \fn void QPlatformSharedGraphicsCache::itemsAvailable(const QByteArray &cacheId, void *bufferId, const QList<quint32> &itemIds, const QList<QPoint> &positionsInBuffer) This signal can be emitted at any time when either requestItems() or insertItems() has been called by the application for one or more items in the cache named \a cacheId, as long as @@ -167,8 +167,8 @@ QT_BEGIN_NAMESPACE initialization. If it is a OpenGLTexture, its texture ID can be requested using the textureIdForBuffer() function. The dimensions of the buffer are given by \a bufferSize. - The items provided by the cache are identified in the \a itemIds vector. The - \a positionsInBuffer vector contains the locations inside the buffer of each item. Each entry in + The items provided by the cache are identified in the \a itemIds list. The + \a positionsInBuffer list contains the locations inside the buffer of each item. Each entry in \a positionsInBuffer corresponds to an item in \a itemIds. The buffer and the items' locations within the buffer can be considered valid until an @@ -179,7 +179,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QPlatformSharedGraphicsCache::itemsUpdated(const QByteArray &cacheId, void *bufferId, const QVector<quint32> &itemIds, const QVector<QPoint> &positionsInBuffer) + \fn void QPlatformSharedGraphicsCache::itemsUpdated(const QByteArray &cacheId, void *bufferId, const QList<quint32> &itemIds, const QList<QPoint> &positionsInBuffer) This signal is similar in usage to the itemsAvailable() signal, but will be emitted when the location of a previously requested or inserted item has been updated. The application @@ -194,7 +194,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QPlatformSharedGraphicsCache::itemsInvalidated(const QByteArray &cacheId, const QVector<quint32> &itemIds) + \fn void QPlatformSharedGraphicsCache::itemsInvalidated(const QByteArray &cacheId, const QList<quint32> &itemIds) This signal is emitted when the items given by \a itemIds in the cache named \a cacheId have been removed from the cache and the previously reported information about them is considered diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index 2152418641..4b6368a749 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -42,7 +42,7 @@ #include "qkeysequence.h" #include "qdebug.h" #include "qevent.h" -#include "qvector.h" +#include "qlist.h" #include "qcoreapplication.h" #include <private/qkeymapper_p.h> #include <QtCore/qloggingcategory.h> @@ -122,15 +122,15 @@ public: } QShortcutMap *q_ptr; // Private's parent - QVector<QShortcutEntry> sequences; // All sequences! + QList<QShortcutEntry> sequences; // All sequences! int currentId; // Global shortcut ID number int ambigCount; // Index of last enabled ambiguous dispatch QKeySequence::SequenceMatch currentState; - QVector<QKeySequence> currentSequences; // Sequence for the current state - QVector<QKeySequence> newEntries; + QList<QKeySequence> currentSequences; // Sequence for the current state + QList<QKeySequence> newEntries; QKeySequence prevSequence; // Sequence for the previous identical match - QVector<const QShortcutEntry*> identicals; // Last identical matches + QList<const QShortcutEntry*> identicals; // Last identical matches }; @@ -413,7 +413,7 @@ bool QShortcutMap::hasShortcutForKeySequence(const QKeySequence &seq) const /*! \internal Returns the next state of the statemachine, based on the new key event \a e. - Matches are appended to the vector of identicals, + Matches are appended to the list of identicals, which can be access through matches(). \sa matches */ @@ -438,7 +438,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier bool partialFound = false; bool identicalDisabledFound = false; - QVector<QKeySequence> okEntries; + QList<QKeySequence> okEntries; int result = QKeySequence::NoMatch; for (int i = d->newEntries.count()-1; i >= 0 ; --i) { QShortcutEntry entry(d->newEntries.at(i)); // needed for searching @@ -506,7 +506,7 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e, int ignoredModifier Same as doing (the slower) \snippet code/src_gui_kernel_qshortcutmap.cpp 0 */ -void QShortcutMap::clearSequence(QVector<QKeySequence> &ksl) +void QShortcutMap::clearSequence(QList<QKeySequence> &ksl) { ksl.clear(); d_func()->newEntries.clear(); @@ -516,7 +516,7 @@ void QShortcutMap::clearSequence(QVector<QKeySequence> &ksl) Alters \a seq to the new sequence state, based on the current sequence state, and the new key event \a e. */ -void QShortcutMap::createNewSequences(QKeyEvent *e, QVector<QKeySequence> &ksl, int ignoredModifiers) +void QShortcutMap::createNewSequences(QKeyEvent *e, QList<QKeySequence> &ksl, int ignoredModifiers) { Q_D(QShortcutMap); QList<int> possibleKeys = QKeyMapper::possibleKeys(e); @@ -605,9 +605,9 @@ int QShortcutMap::translateModifiers(Qt::KeyboardModifiers modifiers) } /*! \internal - Returns the vector of QShortcutEntry's matching the last Identical state. + Returns the list of QShortcutEntry's matching the last Identical state. */ -QVector<const QShortcutEntry*> QShortcutMap::matches() const +QList<const QShortcutEntry*> QShortcutMap::matches() const { Q_D(const QShortcutMap); return d->identicals; @@ -630,7 +630,7 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e) // Find next const QShortcutEntry *current = nullptr, *next = nullptr; int i = 0, enabledShortcuts = 0; - QVector<const QShortcutEntry*> ambiguousShortcuts; + QList<const QShortcutEntry*> ambiguousShortcuts; while(i < d->identicals.size()) { current = d->identicals.at(i); if (current->enabled || !next){ |