summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-08-291-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cf53aa21bf0f8fbd13c0ce2d33ddf7bc63d0d76a and 3aaa5d6b32130d3eeac872a59a5a44bfb20dfd4a were reverted because of reconstruction in 5.7. defineTest(qtConfTest_checkCompiler) in configure.pri is smart enough to cover the case in a9474d1260a8c8cc9eae14f2984098919d9684e5. DirectWrite: Fix advances being scaled to 0 Since 131eee5cd, the stretch of a font can be 0, meaning "whatever the font provides". In combination with ec7fee96, this would cause advances in the DirectWrite engine to be scaled to 0, causing the QRawFont test to fail. Conflicts: configure mkspecs/features/uikit/device_destinations.sh mkspecs/features/uikit/xcodebuild.mk src/corelib/global/qglobal.cpp src/corelib/global/qnamespace.qdoc src/plugins/platforms/cocoa/qcocoamenuitem.h src/plugins/platforms/windows/qwindowsservices.cpp src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp src/widgets/kernel/qapplication.cpp tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp Change-Id: I4656d8133da7ee9fcc84ad3f1c7950f924432d1e
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-181-0/+1
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbintegration.cpp Change-Id: I2d71d06a55f730df19ace0dd3304238584a0497f
| | * ~QGraphicsProxyWidget: Remove event filter on widget before deleting itFriedemann Kleint2016-08-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Prevent events being received on the widget during its destruction phase. Task-number: QTBUG-55112 Change-Id: I0d990fc69eee06b7e5af3845aa3f7627e3e3d5b9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | fix build with various QT_NO_* definesNick Shaforostoff2016-08-261-2/+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 dev into 5.8Oswald Buddenhagen2016-08-221-1/+1
|\ \ \ | | | | | | | | | | | | Change-Id: I41ee7b50534b01cf042bed8bb8824ba2e5026a29
| * | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-161-1/+1
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/global/qglobal.cpp src/corelib/tools/qstring.cpp src/network/socket/qabstractsocket.cpp src/network/socket/qnativesocketengine_unix.cpp src/plugins/platforms/eglfs/api/qeglfsglobal.h Change-Id: Id5dfdbd30fa996f9b4b66a0b030b7d3b8c0ef288
| | * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-1/+1
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/io/qsettings.cpp src/corelib/itemmodels/qstringlistmodel.cpp tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp Change-Id: I1c6c306ef42c3c0234b19907914b19da706b4a03
| | | * Doc: Change instances of '(Mac) OS X' to 'macOS'Topi Reinio2016-08-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change the occurrences where the Mac platform is discussed to use a macro \macos, which expands to 'macOS'. This helps with adapting to future renaming. Update the instructions on mac-specific Q_OS_* macro usage. Add a \target for the old 'Qt for OS X' topic to keep links working for other documentation modules that try to link with the old name. Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | | | Support C++17 fallthrough attributeAllan Sandfeld Jensen2016-08-191-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | Replaces our mix of comments for annotating intended absence of break in switches with the C++17 attribute [[fallthrough]], or its earlier a clang extension counterpart. Change-Id: I4b2d0b9b5e4425819c7f1bf01608093c536b6d14 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-07-194-39/+39
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakebuiltins.cpp qmake/library/qmakeevaluator.cpp qmake/library/qmakeevaluator.h qmake/project.h QMakeEvaluator: * evaluateConditional(): one side changed return type, the other changed a parameter type. * split_value_list(): one side changed a parameter adjacent to where ... * expandVariableReferences(): ... the other killed one overload and changed the survivor src/corelib/io/qlockfile_unix.cpp One side changed a #if condition, the other moved NETBSD's part of what it controlled. src/corelib/tools/qdatetime.cpp One side fixed a reachable Q_UNREACHABLE in toMSecsSinceEpoch(), the other moved it from the private class to the public one, in the midst of the "short date-time" optimization, which confused diff entirely. One side changed a QStringLiteral to QLatin1String, the other rewrote adjoining code. src/network/kernel/qauthenticator.cpp Both rewrote a line, equivalently; kept the dev version. src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h One side changed #if-ery that the other removed. tools/configure/configureapp.cpp One side added a check to -target parsing; the other killed -target. tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml tests/auto/testlib/selftests/expected_cmptest.xunitxml Regenerated using generate_expected_output.py I note that quite a few other expected_* come out changed, now. There was no git-conflict in src/widgets/kernel/qformlayout.cpp but it didn't compile; one side removed some unused methods; the other found uses for one of them. Put FixedColumnMatrix<>::removeRow(int) back for its new user. Change-Id: I8cc2a71add48c0a848e13cfc47b5a7754e8ca584
| * | Widgets: use const (and const APIs) moreAnton Kudryavtsev2016-07-054-39/+39
| | | | | | | | | | | | | | | | | | | | | For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: Ia6cad50a10facf6fd4f73d1390edb8642a0aed32 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Add qtwidgetsglobal.h and qtwidgetsglobal_p.hLars Knoll2016-07-1430-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new modular configuration system requires one global header per module, that is included by all other files in this module. That header will later on #include the configuration file for Qt Widgets. For now it defines the Q_WIDGETS_EXPORT macro for this library. Change-Id: I6698989b952b9bac94d086d9f219e03c000f7d53 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-211-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qsysinfo.h src/corelib/kernel/qcoreapplication_win.cpp src/gui/text/qdistancefield.cpp src/gui/text/qdistancefield_p.h src/plugins/platforms/windows/qwindowsglcontext.cpp src/plugins/platforms/windows/qwindowsglcontext.h Change-Id: Ib3500acc2b28553bde06758cd9a2e19eb7fe2978
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-201-2/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And blacklisted a few tests in tst_QUdpSocket. Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtNative.java src/corelib/global/qglobal.cpp src/corelib/global/qsystemdetection.h src/corelib/io/qfileselector.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp tests/auto/network/socket/qudpsocket/BLACKLIST Task-number: QTBUG-54205 Change-Id: I11dd1c90186eb1b847d45be87a26041f61d89ef6
| | * Fixed developer build for MinGWOliver Wolff2016-06-151-2/+2
| | | | | | | | | | | | | | | | | | | | | 0 must not be used as a null pointer constant Change-Id: I082d0e99c105fb02980b9cf390e7f6e4c9ad0869 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Fix Infinite loop in QGraphicsScene::focusNextPrevChildJoão de Deus Morgado2016-06-071-1/+3
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-42915 Change-Id: Ie380e0d77453bcdb68e92dcffe8278f169da27bc Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-04-053-10/+11
|\| | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/corelib/ipc/ipc.pro src/plugins/platforms/xcb/qxcbbackingstore.cpp tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp Change-Id: Ia006e10ff1732fe78f90138c41f05b59b49486cf
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-043-10/+11
| |\| | | | | | | | | | Change-Id: I35ca979395620e104e50b06366d0869433a4ffc2
| | * QGraphicsView: clarify documentation for viewportTransformGiuseppe D'Angelo2016-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | d->matrix holds the scene->viewport transform, not vice versa. Change-Id: I997cbdfbf519f39f242cd0dbbd00621e59ec9307 Task-number: QTBUG-48705 Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
| | * QGraphics*Layout: fix memory leaksGiuseppe D'Angelo2016-04-012-9/+10
| | | | | | | | | | | | | | | | | | | | | Change-Id: I5f9d2ccc8912e3fa08e376b5f6b6450d22913406 Task-number: QTBUG-10768 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-03-224-0/+8
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure mkspecs/common/wince/qplatformdefs.h src/plugins/platforms/directfb/qdirectfbbackingstore.cpp src/plugins/platforms/xcb/qxcbbackingstore.cpp Change-Id: Ied4d31264a9afca9514b51a7eb1494c28712793c
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-214-0/+8
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/widgets/styles/qgtkstyle_p.cpp tests/auto/corelib/io/qtextstream/test/test.pro tests/auto/corelib/plugin/plugin.pro Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
| | * QtWidgets: includemocsMarc Mutz2016-03-184-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | A very simple way to save ~3KiB in test size and 440b in data size on GCC 5.3 Linux AMD64 release builds. Change-Id: I6619148cc497116b9772a00e1bc30d573a2b2534 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | QtWidgets: use new QRegion::begin()/end() instead of rect()Marc Mutz2016-03-023-20/+11
|/ / | | | | | | | | | | | | Saves ~600b in text size on optimized GCC 5.3 Linux AMD64 builds. Change-Id: Ib542a128982fc53638780945014d903f2cbee9c3 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Use QFlags::setFlag where prudent in qtbaseAndre Somers2016-02-123-29/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QFlags::setFlag is most useful to replace explicit constructs like if (condition) { someFlags |= TheConditionFlag; } else { someFlags &= ~TheConditionFlag; } with someFlags.setFlag(TheConditionFlag, condition); Change-Id: Ie4586681c83e0af812d5bbf14965aad51941a960 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Suppress memory allocation due to temporary containerSérgio Martins2016-02-111-1/+1
| | | | | | | | | | | | Change-Id: I337c3f7ed63444ac0950a30298eb619f462b7a16 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-111-0/+1
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qfilesystemwatcher_win.cpp src/corelib/plugin/plugin.pri src/plugins/platforms/cocoa/qcocoaaccessibility.mm tests/auto/corelib/tools/qlocale/tst_qlocale.cpp Change-Id: Id6824631252609a75eff8b68792e4d10095c8fc1
| * Doc: corrected minor link issuesNico Vertriest2016-02-051-0/+1
| | | | | | | | | | | | Task-number: QTBUG-43810 Change-Id: I98eafe0c7ed55f309640e8495c83ffcef355aa08 Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
* | QGraphicsItemAnimationPrivate::linearValueForStep(): pass vector by const-&Marc Mutz2016-02-081-21/+21
| | | | | | | | | | | | | | | | | | It's only read from. Avoids detach attempts in the many uses of front()/back(). Change-Id: I0fd5df77a6d3a9a37872e0ce28f5a2354aa8f957 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-021-2/+2
|\| | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test src/plugins/platforms/cocoa/qcocoahelpers.mm src/tools/qlalr/cppgenerator.cpp Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
| * Fix GCC 6 valid warnings about misleading indendationsThiago Macieira2016-01-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | It's currently producing a lot of false positives, but a few are actually valid. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69029, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69122 and some others. Change-Id: I24a735698d3c4a719fc9ffff1425f29d7b5a3458 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QGraphicsAnchorLayout: return a struct instead of a QListMarc Mutz2016-01-292-27/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... of QLists. The returned list was only ever exactly of size one or two, and two only if a local QList in the getGraphParts() function was not empty. Instead of using a QList to return those QLists, use a small struct of two QLists. This way, we avoid copying, memory allocations, and the code becomes a lot clearer, because we can give the members of the struct meaningful names, instead of at(0) and at(1). As a consequence, at the call site, the loop over the result can now be collapsed into an if. Saves ~1200b in text size on optimized GCC 5.3 Linux AMD64 builds. Change-Id: I5c2a3b3be0edcc418b310551abca51c410aca7c8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QGraphicsAnchorLayout: remove a misguided use of QLinkedListMarc Mutz2016-01-191-24/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSimplexConstraints are held in QList everywhere, yet one single function, getGraphParts(), used a temporary QLinkedList. It did so because the function repeatedly walks the list, erasing elements from it until no more elements have been removed. Thus, in O-terms, QLinkedList is the correct choice here. Sadly, O-notation completely ignores the per-element cost, and this is where QLinkedList suffers. By the time a QList has shifted all of its elements left once, the QLinkedList probably has just finished allocating its first node. So, use a QList instead. That, however, turns the it = erase(it) loop quadratic, so re-formulate the processing part as a lambda and use std::remove_if. Don't even erase until we know how many items to erase. As a benefit, we save the final conversion of the remaining items back to a QList, and we can use QList::op+ to build the initial list, reducing the number of allocations performed by that container to one. Also saves ~770b in text size on optimized GCC 5.3 Linux AMD64 builds. Change-Id: Iecf9e7961dd2b6b20039b9b0d472e32b3fae6994 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QtWidgets: replace uses of inefficient QList<QPair>s with QVectorsMarc Mutz2016-01-182-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | These QPairs are larger than a void*, so holding them in QLists is needlessly inefficient. Worse, the code could come to depend on the fragile property of (inefficient) QLists that references to elements therein never are invalidated. Fix by holding them in QVector instead. Change-Id: I3c205f5326cfd96482563078bdca1747d718457f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QGraphicsView: Graph: don't allocate QHashes on the heapMarc Mutz2016-01-171-26/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | ... just so you can observe their absence with QHash::value() returning nullptr. Instead, use find() + comparison to end() to detect presence or absence. Simplifies quite a bit of code. Change-Id: Ifd7921bfc8102677ea345ae37d38da31b8105426 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QGraphicsView: Graph: remove faulty const_iterator::op=Marc Mutz2016-01-171-1/+0
| | | | | | | | | | | | | | | | | | It failed to copy 'g'. Fix by letting the compiler generate one. Change-Id: Ie19fdacb8f27aef821be58c0b727c802d71bfe64 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QGraphicsView: Graph: don't compare pointers with op<Marc Mutz2016-01-171-2/+3
| | | | | | | | | | | | | | | | It's undefined behavior. Use std::less, which has defined behavior. Change-Id: I990d197590cf535c1cb5c055d0b6798e602446dc Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Updated license headersJani Heikkinen2016-01-1553-742/+1060
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.6' into devFrederik Gladhorn2016-01-081-1/+1
|\| | | | | | | | | | | Based on merge done by Liang Qi Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
| * Unbreak ubsan developer-buildMarc Mutz2016-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC 5.3's undefined-behavior sanitizer checks that the declared type of the object is a base class of the dynamic type of the object on each access to a member of a class type. It therefore requires the typeinfo for these types, which for polymorphic types is emitted in the TU where the vtable is emitted, too. QFileDialogPrivate is a polymorphic non-exported class, so this failed at link-time. Ditto for the other cases. Fix by autotest-exporting the classs. Also, where applicable, de-inline the dtors, so the vtable (and typeinfo) are pinned to one TU, and the ctor, just because it's the correct thing to do. Change-Id: I2b7dba776282a2809c80eb2bc36440d7d698f926 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QGraphicsView: replace some Q_FOREACH loops over const locals with C++11 ↵Marc Mutz2015-12-233-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | range-for This needs to be handled a bit carefully, because Qt containers will detach upon being iterated over using range-for. In the cases of this patch, that cannot happen, because all containers are local and marked as const (either by this patch or before). Separate patches will deal with other situations. Range-for loops are much more efficient than foreach loops. This patch shaves ~1.8KiB of text size off an optimized Linux AMD64 GCC 4.9 build. Change-Id: I5c58658937ac4323594161bf94a2fce3c5667914 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QGraphicsView: replace some Q_FOREACH loops over rvalues with C++11 range-forMarc Mutz2015-12-236-45/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This needs to be handled a bit carefully, because Qt containers will detach upon being iterated over using range-for. In the cases of this patch, that trivially cannot happen, because all containers are marked as const when being assigned the rvalues previously found on the rhs of the Q_FOREACH. The new code thus does exactly what the old code did: take a const copy, then iterate over it. Separate patches will deal with other situations. Range-for loops are much more efficient than foreach loops. This patch shaves almost 4K of text size off an optimized Linux AMD64 GCC 4.9 build. Change-Id: Ida868b77d078cbfa0516d17e98e6f0a86fcdb7a3 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Optimize a code path in QGraphicsScenePrivate::cancelGesturesForChildren()Marc Mutz2015-12-221-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If ev.isAccepted(), since list is gestures.toList(), the first foreach loop would clear 'gestures', one item at a time. The second foreach loop would then not execute at all. Make this case clearer by not executing either loop if ev.isAccepted(). Make it more performant by not iterating twice, but once, simply skipping those gestures in the second (remaining) loop which would have been removed by the first one. Also iterate over the equivalent QList instead of the QSet, because the former is way more efficient. Text size savings are present, but minimal. The runtime savings are signficant, of course. Change-Id: I3d5bfe99c5d3fcbe4c98816577846551c632f315 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QGraphicsSceneBspTreeIndex: simplify the code of items()Marc Mutz2015-12-221-16/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code dealt with a lot of special cases, probably to avoid detaching. But the only case where deep copies are avoided is if a) there're no freeItemIndexes b) there're no unindexedItems c) the sort order is neither AcendingOrder nor DescendingOrder, which is funny, since those are the only two values for Qt::SortOrder. The code checks for SortOrder(-1), but nowhere in Qt is such a sort order created. Ergo, the deep copy was _never_ avoided. So simplify the code by always building the result list from the two input lists by copying all non-null items. Saves over 2KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: I8e739fb78896b2ad0bec45d05e86a76fe1ede04a Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QGraphicsScene: don't build a temporary QList just to iterate over itMarc Mutz2015-12-221-7/+4
| | | | | | | | | | | | | | Iterate over the original list instead. Change-Id: I7be154c0e19074033df6f6e01f68d21a8904d2ee Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
* | QGraphicsScene: prevent lots of detaching d/t editing of copiesMarc Mutz2015-12-221-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QTouchEvent::touchPoints() returns a const-&, but the old code took a copy, over which it then iterated, modifying the touch points, causing (necessary) detaches of both the list and the touch points. Befriend QTouchEvent and modify the list in-place, avoiding all detaches in the likely case that QTouchPoint contains the only copy of the touch point list. This is all the more important as the function is called once for every item-under-mouse in sendTouchBeginEvent(). Port to C++11 range-for as a drive-by. Change-Id: I2f74d19845711d97e3566886123b5d18d55db74c Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
* | QtWidgets: de-inline some more virtual dtorsMarc Mutz2015-12-212-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Helps pinning the vtable to a single TU, which can prevent false negative RTTI (incl. dynamic_cast and catch()). But mostly because it's rather pointless to have dtors of polymophic function inline. Most of the time, the code will be called through the vtable indirection, anyway (which also means that an out-of-line copy of the code needs to exist in any case). The inline method will only be used when the compiler can prove the dynamic type of an object. Saves ~1.5KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Change-Id: Ic4ce96da559252c8abc29d880530c84035db2306 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QtWidgets: de-inline some Private ctorsMarc Mutz2015-12-216-97/+113
| | | | | | | | | | | | | | | | | | | | | | | | Saves ~7KiB text size on optimized GCC 4.9 Linux AMD64 builds. Drive-by fix: properly init QGraphicsProxyWidgetPrivate::proxyIsGivingFocus. Change-Id: Iac923f0f2a9cdc0349f706c5760883a210be36f3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | De-duplicate QGraphicsItemPrivate vtableMarc Mutz2015-12-182-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By making the destructor (usually the first non-inline, non-pure, virtual function, and therefore the trigger for most compilers to emit the vtable and type_info structures for the class in that TU) out-of-line, vtables and, more importantly, type_info structures for the class are pinned to a single TU. This prevents false negative dynamic_cast and catch evaluation. Since QGraphicsItemPrivate is already exported, users of this class are unaffected by the change, and since it's private API, we don't need to avoid adding code to the out-of-line destructor until Qt 6. Also saves ~2.5KiB in text size on optimized GCC 4.9 Linux AMD64 builds. Task-number: QTBUG-45582 Change-Id: Ibb404a43d5464e8e280ccebd5f95719852f5a986 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QGraphicsScene: replace QList::prepend()s with appends()Marc Mutz2015-12-171-3/+3
| | | | | | | | | | | | | | | | | | Use the new reverse_iterator support in QList to avoid building a QList with prepend()ing, using append() instead. Change-Id: Ia1f6d0ecc08a824f11d93a6fd4077b11b1b0f786 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>