summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qabstractitemview.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.9' into devThiago Macieira2017-08-081-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/widgets/kernel/qwidget.cpp This merge also extends the expected output of the pairdiagnostics teamcity output (added in dev in commit c608ffc56ab37f9a9d5b9c34543126adb89e2b08) after the recent addition of the flowId attribute to the teamcity output (commit 8f036562119dd35ce51dc9230304d893b906bd37 in 5.9). Change-Id: I3868166e5efc45538544fffd14d8aba438f9173c
| * QAbstractItemView: fix nullptr violationRaschbauer, Reinhard2017-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If in a slot connected to QAbstractItemView::clicked QAbstractItemView::setModel(nullptr) is called the method QAbstractItemView::mouseReleaseEvent will cause a segmentation fault. The problem is that the method QAbstractItemView::model used in QAbstractItemView::mouseReleaseEvent will return a nullptr if a null model was set. The solution is to used d->model since it is always a valid model. (See line d->model = (model ? model : QAbstractItemModelPrivate::staticEmptyModel()); in method QAbstractItemView::setModel) Change-Id: I6f01bdeac64495ee4a76adcc7bf8da8a7719ef4d Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.9' into devOswald Buddenhagen2017-08-021-3/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp src/plugins/styles/mac/qmacstyle_mac.mm src/widgets/widgets/qdockarealayout.cpp src/widgets/widgets/qmainwindow.cpp src/widgets/widgets/qmainwindowlayout.cpp src/widgets/widgets/qmainwindowlayout_p.h tests/auto/corelib/tools/qlocale/tst_qlocale.cpp tests/auto/other/macnativeevents/BLACKLIST tests/auto/widgets/widgets/qmenu/BLACKLIST Change-Id: Ic8e724b80a65e7b1af25511b0e674d209265e567
| * Convert features.itemviews to QT_[REQUIRE_]CONFIGStephan Binner2017-07-251-3/+0
| | | | | | | | | | | | | | The QT_NO_ITEMVIEWS queries in corelib/ seem to had no effect at all. Change-Id: I494ee2309a96b0cf25de18781fc9a675878a2ee9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-07-191-1/+0
|\| | | | | | | | | | | | | | | Conflicts: src/corelib/io/qwindowspipewriter.cpp src/widgets/styles/qcommonstyle.cpp Change-Id: I0d33efdc4dc256e234abc490a18ccda72cd1d9e6
| * Convert features.treeview to QT_[REQUIRE_]CONFIGStephan Binner2017-07-151-1/+0
| | | | | | | | | | Change-Id: I4a036a0410615ac563b17f7715c47acccb8abfca Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devGabriel de Dietrich2017-07-131-1/+0
|\| | | | | | | | | | | | | Conflicts: src/widgets/widgets/qmainwindowlayout.cpp Change-Id: I306b4f5ad11bceb336c9091241b468d455fe6bb6
| * Convert features.tableview to QT_[REQUIRE_]CONFIGStephan Binner2017-07-111-1/+0
| | | | | | | | | | Change-Id: I7ab479deff7bbf3083d1efa196e0480b181548c5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-041-4/+3
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/util/util.pri tests/auto/corelib/thread/qthread/qthread.pro tests/auto/corelib/thread/qthread/tst_qthread.cpp Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
| * Convert features.statustip to QT_CONFIGStephan Binner2017-06-291-3/+3
| | | | | | | | | | Change-Id: Ic719ab93ed1802fcc713885ad0421cb44c7a998b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
| * Convert features.whatsthis to QT_[REQUIRE_]CONFIGStephan Binner2017-06-291-1/+0
| | | | | | | | | | | | | | Move feature definition to gui/configure.json Change-Id: I00b35c0e259d0a695d84a9bf6803eba74d41465a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | QAbstractItemView: add isPersistentEditorOpen()Marc Mutz2017-06-201-2/+15
| | | | | | | | | | | | | | | | | | | | [ChangeLog][QtWidgets][QAbstractItemView/QTreeWidget/QTableWidget/QListWidget] Added isPersistentEditorOpen(). Task-number: QTBUG-61139 Change-Id: I74997d9626812fed83591d32c503680575ec0f7c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | Typo-fix: s/looses/loses/gEdward Welbourne2017-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | When an archer lets go of the bow-string, she looses an arrow; when the hounds are straining at their leashes and the handler lets go, he looses the dogs. It's archaic usage now; we'd normally say "lets loose", "lets go" or "releases". In any case what was meant here was that something got lost; a widget loses focus or a network loses its connection. Change-Id: Ic1fbe9e1f76185bcb7caf034d6be97ebfeb2e270 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Martin Smith <martin.smith@qt.io>
* | Use list-initialization moreMarc Mutz2017-04-201-2/+1
|/ | | | | | | Fixes a few ugly code pieces I added over the years. Change-Id: I5c06b73e858add04ea184120c6df71720baf9be3 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-281-0/+1
|\ | | | | | | Change-Id: I4788bc037c55c48563ffd4ba9633a22aa1d12f22
| * Annotate more implicit fallthroughsAllan Sandfeld Jensen2017-03-271-0/+1
| | | | | | | | | | | | | | Reduces our number of gcc 7 warnings Change-Id: I792d658cbc11cad15cf45da3a36fc93fcdcc67ea Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-211-0/+1
|\| | | | | | | | | | | | | Conflicts: src/plugins/platforms/eglfs/eglfs-plugin.pro Change-Id: Id76cdbb41b7758572a3b8ea4dcb40d49bac968db
| * Fix item keeping hover highlight even when mouse has left itDan Cape2017-03-131-0/+1
| | | | | | | | | | | | | | | | | | | | Made change to clear the hover index when the mouse leaves the widget. This will ensure the component does not think the item still has the mouse over it. Task-number: QTBUG-46785 Change-Id: I34b7f0e171e9cf07ca23150af1b0e6e59a10a58a Reviewed-by: David Faure <david.faure@kdab.com>
* | Add feature.scrollerStephan Binner2017-03-011-3/+3
|/ | | | | Change-Id: I5313e1f5091d5764994525dae138e288e5125c59 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Change confusing Q_DEAD_CODE_FROM_QT4_FOO defineTor Arne Vestbø2016-10-141-1/+1
| | | | | | | | | | | | | | | | | | | Commit c5db8fc74 changed all instances of Q_WS_FOO to have the prefix Q_DEAD_CODE_FROM_QT4 instead, to make it clearer when reading the code that the code in question was a left-over from Qt4, when we used Q_WS_ defines instead of Q_OS_ defines. This worked well for cases of #ifdef Q_DEAD_CODE_FROM_QT4, but less so for cases of #ifndef Q_DEAD_CODE_FROM_QT4, where the code was actually unconditionally included. To make this even clearer, the defines have been replaced by checks for 1 or 0, with a comment describing how the code used to look in Qt4. The use of constants in the check also makes it easier for editors to parse the condition and show visually that the code is defined out. Change-Id: I152070d87334df7259b417cd5e17d7b7950379b7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-10-111-2/+7
|\ | | | | | | | | | | | | | | Conflicts: src/gui/image/qpixmap.cpp src/widgets/kernel/qformlayout.cpp Change-Id: I8a8391a202adf7f18464a22ddf0a6c4974eab692
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-081-2/+7
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qhttpnetworkconnection.cpp src/network/access/qhttpnetworkconnection_p.h Change-Id: I11f8641ef482efa8cee1b79977d19cc3182814b4
| | * QAbstractItemView: use only a 1x1 QRect for selecting on mouse pressFrank Reininghaus2016-10-071-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before commit f1e90768095be37419ba4bf3c69ec5c860bdbcb6, mousePressEvent called the virtual method setSelection(const QRect&, SelectionFlags) with the 1x1 rectangle which contains only the clicked QPoint, unless the SelectionFlag "Current" was set because Shift was pressed during the mouse press. Since that commit, the behavior has been changed such that the rectangle is the one that is spanned by the center of the clicked item and the clicked pixel. In theory, the result should be the same (i.e., only the clicked item should be selected), but * the code path in QListView::setSelection for 1x1 QRects is more efficient, and * using a larger QRect can cause problems with custom views, see the comments in QTBUG-18009 This commit ensures that the 1x1 QRect is used again, unless the SelectionFlag "Current" is used. Change-Id: I70dd70c083c20a3af6cd6095aa89a489756b505f Task-number: QTBUG-18009 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* | | fix build with various QT_NO_* definesNick Shaforostoff2016-08-261-0/+2
| | | | | | | | | | | | | | | | | | | | | Done-with: Andriy Gerasika <andriy.gerasika@gmail.com> Change-Id: I90883a491dbddb005c3d756c339e42285d50e437 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-091-3/+5
|\| | | | | | | | | | | Change-Id: I36e6b890b65d12bf6931757540bcc9c553b5eb8f
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-051-3/+5
| |\| | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: I6f3878b204464313aa2f9d988d3b35121d4d9867
| | * Don't call virtual functions with data from an old modelBogDan Vatra2016-08-041-2/+4
| | | | | | | | | | | | | | | | | | Change-Id: I4f1ec56ce722110042f72761bbc2976e580b7149 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | * QAbstractItemView: Fix UB (invalid downcast)Marc Mutz2016-07-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just use QWidgetPrivate::get() instead. Fixes UBSan error: qabstractitemview.cpp:3814:61: runtime error: downcast of address 0x2b859001aa70 which does not point to an object of type 'QAbstractItemView' 0x2b859001aa70: note: object is of type 'QWidget' Change-Id: I0460fd8a0681e122d440755ebf07018d273b93f8 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-08-011-0/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure 5.7 now supports clang on android; but dev re-worked configure src/gui/kernel/qevent.h One side renamed a parameter of a constructor; the other added an alternate constructor on the next line. Applied the rename to both for consistency. tests/auto/tools/moc/tst_moc.cpp Each side added a new test at the end. .qmake.conf Ignored 5.7's change to MODULE_VERSION. configure.json No conflict noticed by git; but changes in 5.7 were needed for the re-worked configure to accommodate 5.7's stricter handling of C++11. Change-Id: I9cda53836a32d7bf83828212c7ea00b1de3e09d2
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-011-0/+6
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: src/widgets/itemviews/qabstractitemview.cpp src/widgets/itemviews/qabstractitemview_p.h Change-Id: I54589b1365103cb1749186af92aab03a49c94b64
| | * QAbstractItemViewPrivate: de-inline hasEditor()Marc Mutz2016-07-271-0/+5
| | | | | | | | | | | | | | | | | | | | | This is in preparation of fixing a design problem with indexEditorHash. Change-Id: I6045ad3f15cd3087a894b96e9e068e42af7a1dea Reviewed-by: hjk <hjk@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-07-011-6/+5
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure configure.json Change-Id: Iba032d9a29c273da2585632bc6e22bbafb961808
| * | QAbstractItemView: use erase and std::remove_if with QListAnton Kudryavtsev2016-06-291-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | ... instead of using erase() in a loop, with quadratic complexity. Change-Id: Id9c70a0d1d27b5057e5bf64c315bd66cbcd67330 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-131-0/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config_help.txt configure mkspecs/features/uikit/sdk.prf src/corelib/global/qhooks.cpp src/corelib/io/qfilesystemwatcher.cpp src/corelib/io/qlockfile_unix.cpp src/corelib/tools/qalgorithms.h src/gui/kernel/qwindowsysteminterface.h src/gui/text/qtextdocument_p.cpp src/network/access/access.pri src/network/access/qnetworkaccessmanager.cpp src/network/access/qnetworkreplynsurlconnectionimpl.mm src/src.pro src/testlib/qtestcase.cpp src/widgets/kernel/qwidgetbackingstore_p.h src/widgets/styles/qwindowscestyle.cpp src/widgets/styles/qwindowsmobilestyle.cpp tests/auto/corelib/io/qdiriterator/qdiriterator.pro tests/auto/corelib/io/qfileinfo/qfileinfo.pro tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp tools/configure/configureapp.cpp Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-061-0/+3
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf config.tests/unix/nis/nis.cpp mkspecs/unsupported/freebsd-g++/qplatformdefs.h src/corelib/tools/qdatetime.cpp src/corelib/tools/qsimd.cpp src/corelib/tools/qsimd_p.h src/network/access/access.pri src/network/access/qnetworkreplynsurlconnectionimpl.mm src/network/access/qnetworkreplynsurlconnectionimpl_p.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/printsupport/windows/qwindowsprintdevice.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp tests/auto/network/access/qnetworkreply/BLACKLIST tests/auto/widgets/widgets/qopenglwidget/BLACKLIST Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
| | * QAbstractItemView: Reset the drop indicatorBłażej Szczygieł2016-05-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Always reset the drop indicator position and rect when drag action will be finished. This can prevent drawing the indicator in bad place when the next drag will be performed. Task-number: QTBUG-53541 Change-Id: I420207a0ede6f19f48472a8f0f723afe948de1c6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* | | QAbstractItemView - Fix docs to match behavior (SelectionMode)Thorbjørn Martsum2016-04-241-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can deselect the item in single selection mode. It was introduced in 28a21d98ef8d880a6dd86ee19dd803424bb5eae1 The motivation was QTBUG-8836 - and furthermore it was in many situations already possible to deselect the item by clicking in the viewport. A restore of selection by reacting on the signal QItemSelectionModel::selectionChanged is easily possible If the behavior was changed to follow the documentation, such a similar simply work-around to allow deselect would not be possible. Task-number: QTBUG-49217 Change-Id: I5466337dc547414d3e0c045ab35d618dba56c508 Reviewed-by: David Faure <david.faure@kdab.com>
* | QtBase: use erase and std::remove_if with QList and QVectorAnton Kudryavtsev2016-04-081-4/+8
| | | | | | | | | | | | | | ... instead of using removeAt in a loop, with quadratic complexity. Change-Id: I38b49e56b12c396db9fc0f1b75d8fb43c503a7f6 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-041-1/+5
|\| | | | | | | Change-Id: I35ca979395620e104e50b06366d0869433a4ffc2
| * QAbstractItemView: don't call restart() on invalid QElapsedTimerMarc Mutz2016-04-031-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In keyboardSearch(), QAbstractItemView unconditionally called QElapsedTimer::restart(). Calling restart() on an invalid QElapsedTimer is undefined behavior: qelapsedtimer_unix.cpp:192:9: runtime error: signed integer overflow: 3313808 - -9223372036854775808 cannot be represented in type 'long int' qelapsedtimer_unix.cpp:193:10: runtime error: signed integer overflow: 534150461 - -9223372036854775808 cannot be represented in type 'long int' qelapsedtimer_unix.cpp:194:17: runtime error: signed integer overflow: -9223372036851462000 * 1000000000 cannot be represented in type 'long long int' The code already checked the timer for validity, and did not use the return value of restart() in case of an invalid timer, but the check came too late. Fix by checking the return value of QElapsedTimer::isValid() earlier, and calling start() instead of restart() instead. Fix the same error in QTreeView, which has a c'n'p copy of the buggy code. Change-Id: I9751465394707d9348d5c05a0b1b2be147eceb2e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Simon Hausmann2016-03-241-0/+9
|\| | | | | | | Change-Id: I13c7ea6a74eb98606cf45702ae068101943bec6a
| * QAbstractItemView: trigger handlers (and redraw) when changing selection modelGiuseppe D'Angelo2016-03-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | The most visible problem is that changing selection model didn't update() the view, resulting in the old selection/current item still being drawn. In general trigger the handlers for when the selection/current item changes. Change-Id: Ib3b2ad70412e6a21a182d4c173e617710bcc630d Task-number: QTBUG-50535 Reviewed-by: Stephen Kelly <ske@ableton.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-211-1/+14
|\| | | | | | | | | | | | | | | | | Conflicts: src/widgets/styles/qgtkstyle_p.cpp tests/auto/corelib/io/qtextstream/test/test.pro tests/auto/corelib/plugin/plugin.pro Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
| * Fix QAbstractItemView dragged item pixmaps to be HighDPI aware.Alexandru Croitor2016-03-171-1/+14
| | | | | | | | | | | | | | | | | | | | When an item is rendered into a QPixmap sent to the QDrag implementation, make sure it's size is scaled with the current window's devicePixelRatio, so it does not appear blurry on high-dpi screens. Change-Id: Idf38c0993e8529aff7107ff1ac412de9cf10f311 Task-number: QTBUG-46068 Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
* | Add SH_ItemView_ScrollMode style hint and use it in QMacStyleGabriel de Dietrich2016-02-111-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On OS X, the default scrolling mode of item views should be per pixel instead of per item. We enforce this through a new style hint. On all other platforms, the behavior remains the same. It's still possible to override the style hint by using the regular scroll mode setters. Any subsequent style change will result in a no-op once the setters have been called and until the properties are reset. Some auto-tests had to be update to to take the new behavior into account. [ChangeLog][QtWidgets][Styles] Added SH_ItemView_ScrollMode style hint. [ChangeLog][QtWidgets][Item Views] Item views scroll per pixel on OS X now. [ChangeLog][QtWidgets][Item Views] QAbstractItemView::verticalScrollMode and QAbstractItemView::horizontalScrollMode are now resettable. Change-Id: I3f923275c99aa4389323b52fc1c5455fe71f8d73 Task-number: QTBUG-50102 Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Make use of new QHash::erase(const_iterator) overloadMarc Mutz2015-12-191-3/+2
| | | | | | | | | | | | | | | | | | | | Drive-by changes: - use auto for iterators - add Q_UNLIKELY for conditions leading to a qWarning etc Change-Id: Iff8f36d67c96674d354a501b26640f73c15ce58d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
* | QtWidgets: replace some index-based for loops with C++11 range-forMarc Mutz2015-12-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This needs to be handled a bit carefully, because Qt containers will detach upon being iteratoed over using range-for. In the cases of this patch, that cannot happen, because all containers are marked as const (either by this patch or before). Separate patches will deal with other situations. Apart from being more readable, range-for loops are also the most efficient for loop. This patch shaves almost 2K of text size off an optimized Linux AMD64 GCC 4.9 build. Change-Id: I53810c7b25420b4fd449d20c90c07503c5e76a66 Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | QAIV - allow users to control single step in ScrollPerPixel modeThorbjørn Lund Martsum2015-12-091-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The documentation says that we scroll one pixel, but changing the behavior in 934f06220391eb0e0ebf66a2eb037f48adb4c43c to do that was not well received. People were relying on the undocumented behavior - and the new behavior was considered to be a regression. (Nobody called setSingleStep since Qt in many cases provide a reasonable singleStep - which implied that their programs scrolled with 1 pixel which was quite slow). Furthermore getting the old behavior (auto set of single step) was nearly impossible. However the revert (done in 0e69230d02813f0b7a050645fb7e443bd504ab6a) gets us back to QScrollbar::setSingleStep not working in pixel scroll mode (even without it being documented - but we should also have a working API rather than documenting that it is not working) The previous approach was directly prevented Qt from changing single step (on e.g resize) at all. This patch only prevents Qt from changing when a user explicitly has called the function QScrollBar::setSingleStep (in pixel scroll mode). That is we expect that calls to setSingleStep means that the user actually wants to set the singleStep and doesn't want Qt to control that value. Furthermore it is possible to switch back to the automatically adjusted singlestep with QScrollBar::setSingleStep(-1). [ChangeLog][QtWidgets][QAbstractItemView] QTBUG-7232 - In ItemViews when scrollMode is set to scrollPerPixel, it is now possible to change the single step. Qt will automatically adjust the single step until setSingleStep is called. When setSingleStep is called it will however respect the set and stop doing automatic changes of the value. Calling setSingleStep(-1) will switch mode back to automatic adjust. Task-number: QTBUG-7232 Change-Id: Ibfe0caa9751d3bcc11bfc6e0654a3d1ac35ac8ae Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | QAbstractItemView: replace a QPair with a dedicated structMarc Mutz2015-12-071-3/+4
| | | | | | | | | | | | | | | | | | | | In a QPair, the member names {first, second} have no semantic value. A simple struct, while not as featureful as QPair, can be given meaningful member names, {rect, index}, in this case. Change-Id: If1e289ecee82a1cb020ac3a854efd2ec1096493b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>