summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qkeysequence.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-281-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsettings.cpp src/corelib/kernel/qvariant.cpp src/corelib/serialization/qjsoncbor.cpp src/corelib/serialization/qjsonvalue.cpp src/corelib/tools/tools.pri src/gui/image/qimage.cpp src/gui/kernel/qguivariant.cpp src/widgets/kernel/qshortcut.cpp tests/auto/tools/moc/allmocs_baseline_in.json tests/auto/tools/moc/tst_moc.cpp src/opengl/qglframebufferobject.cpp Done-With: Edward Welbourne <edward.welbourne@qt.io> Done-With: Leander Beernaert <leander.beernaert@qt.io> Change-Id: Ie7f5fa646c607fe70c314bf7195f7578ded1d271
| * Replace most use of QVariant::type and occurrences of QVariant::TypeOlivier Goffart2020-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I made a clazy automated check that replaced the use of QVariant::Type by the equivalent in QMetaType. This has been deprecated since Qt 5.0, but many uses were not yet removed. In addition, there was some manual changes to fix the compilation errors. Adapted the Private API of QDateTimeParser and QMimeDataPrivate and adjust QDateTimeEdit and QSpinBox. QVariant(QVariant::Invalid) in qstylesheet made no sense. But note that in QVariant::save, we actually wanted to use the non-user type. In the SQL module, many changes were actually reverted because the API still expects QVarient::Type. Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-10-261-0/+6
|\| | | | | | | Change-Id: I379794a01cbf6fb39d94b24cc8c90b1971a212b9
| * QKeySequence: Add missing names for multimedia keysAlexander Volkov2019-10-241-0/+6
| | | | | | | | | | | | Task-number: QTBUG-40030 Change-Id: Ib34bcbf42d6dd1206209c2d76444fd8c777278fe Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | QShortcut: Properly port to the new configure systemFriedemann Kleint2019-10-251-5/+0
|/ | | | | | | | | | | | | | | Move the feature to corelib so that the QMetaType enumeration values can be properly excluded and there is no need for a dummy class. Use QT_REQUIRE_CONFIG in the headers of classes to be disabled. Add headers/source files in the .pro file depending on the configure feature in libraries and tests. Add the necessary exclusions and use QT_CONFIG. Task-number: QTBUG-76493 Change-Id: I02499ebee1a3d6d9a1e5afd02517beed5f4536b7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Port from QAtomic::load() to loadRelaxed()Giuseppe D'Angelo2019-06-201-1/+1
| | | | | | | | | | | | | | | Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QRegExp include cleanupSamuel Gaist2019-04-191-3/+0
| | | | | | | | | | | | | | | | QRegExp includes can be found in several files where there's not even a use of the class. This patch aims to avoid needless includes as well as follow the "include only what you use" moto. This patch removes a QRegExp include from the QStringList header which means that there is likely going to be code breaking since QStringList is used in many places and would get QRegExp in. [ChangeLog][Potentially Source-Incompatible Changes] qstringlist.h no longer includes qregexp.h. Change-Id: I32847532f16e419d4cb735ddc11a26551127e923 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace Q_DECL_NOEXCEPT with noexcept in QtGuiAllan Sandfeld Jensen2019-04-051-1/+1
| | | | | Change-Id: I43803b88fea8083782d73ce157c466b022208740 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add comment to a tr() callLars Knoll2019-01-251-2/+4
| | | | | | | | | | Add a comment for the translator explaining what the "+" sign is being used for that they are translating. Fixes: QTBUG-2657 Change-Id: I4c828bcc36fa94c0f1771831667b2b1f591ae92e Reviewed-by: Lucie Gerard <lucie.gerard@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* macOS: Handle missing key in QKeySequencePrivate::decodeString()Erik Verbruggen2018-08-141-0/+5
| | | | | | | | | | | | | | | On macOS we pull out all the modifiers up front, which in the case of incomplete key sequences such as "Meta+Shift+" will result in an empty string as a result. The cross-platform code does not handle that case, so we need to exit early. This fixes an assert in tst_QKeySequence::parseString(). An assert has been added to QKeySequencePrivate::decodeString() to make the assumption about the 'accel' argument explicit. Change-Id: I135e62f9051a8b899202e5fb224b5d3c77bf2062 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* doc: Add tests of Q_CLANG_QDOCMartin Smith2018-02-031-2/+2
| | | | | | | Some defined(Q_CLANG_QDOC) uses were added. Change-Id: I5688fee0d0d8f00bb97e3e63bd02a68ddbfdda11 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* The desktop is called Plasma nowAlbert Astals Cid2017-09-291-1/+1
| | | | | Change-Id: Ic07b45491a13bc4136e5259d45232297b7b25d8f Reviewed-by: David Faure <david.faure@kdab.com>
* QKeySequence: let Private::decodeString() take QString by valueMarc Mutz2017-06-201-5/+4
| | | | | | | | | | | | | It calls toLower() on it, and the existence of two strings in scope has already caused some latent bug where sizes of the two were mixed. Taking by value means we can use the rvalue-version of toLower(). While that does not guarantee no allocations, we can make sure that at least in QKeySequence::assign(), we hand in unshared data, by using std::move(). Change-Id: Ic4a18486a6f4528eba36109dec1a47082cf57055 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-191-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/windows/qwindowscontext.cpp src/plugins/platforms/windows/windows.pri src/tools/uic/cpp/cppwriteinitialization.cpp src/widgets/doc/src/widgets-and-layouts/gallery.qdoc Change-Id: I8d0834c77f350ea7540140c2c7f372814afc2d0f
| * QKeySequence: fix size mismatchMarc Mutz2017-06-081-1/+1
| | | | | | | | | | | | | | | | | | 'accel' is 'str.toLower()' and as such may have a different size, so don't use str.size() to index into 'accel'. Change-Id: I6a140ded45ecedd811b9618e1facb63d522eb235 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QKeySequence: remove a clause guarding an impossible conditionMarc Mutz2017-06-081-1/+0
| | | | | | | | | | | | | | | | | | | | | | All code paths leading up to this line unconditionally dereference the pointer, so it cannot be nullptr. Remove the check. It only confuses readers of the code and probably will trigger warnings with tomorrow's compilers. Change-Id: I31a643738e951da9c04f0091645016276b047761 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-041-1/+1
|\| | | | | | | | | | | | | | | Conflicts: src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h src/plugins/platforms/xcb/qxcbwindow.cpp Change-Id: Ic747c3c50e68c005b425e7a1ec2a90965527c8bd
| * Prefer rvalue versions of toLower() and toUpper()Anton Kudryavtsev2017-03-281-1/+1
| | | | | | | | | | | | | | ... to re-use existing buffers. Change-Id: Ib2bc938f1cf0451c1dbc012b3db022b878e987cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Remove remaining Carbon includes from QtCore, QtGui and QtWidgetsJake Petroules2017-03-071-1/+7
|/ | | | | | | | | Carbon is deprecated and we should not rely on it at runtime or compile time. These headers were only included for a small collection of keyboard key constants which have now been hardcoded instead. Change-Id: Ia2eaa267584b63be8019be3bbf64cba897a985a8 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-241-1/+3
|\ | | | | | | | | | | | | | | | | Conflicts: src/network/socket/qnativesocketengine_winrt.cpp tools/configure/configureapp.cpp tools/configure/environment.cpp Change-Id: Ieae6f2ee004a87f041751852b687484f91ee4480
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-231-1/+3
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also reverts commit 0d2f0164f45cb626c40a7c95026ba00fa56ac249. Conflicts: header.BSD-NEW qmake/Makefile.win32 src/openglextensions/qopenglextensions.cpp src/openglextensions/qopenglextensions.h src/winmain/qtmain_win.cpp src/winmain/qtmain_winrt.cpp tools/configure/configureapp.cpp util/glgen/qopenglextensions.cpp.header util/glgen/qopenglextensions.h.header Change-Id: If26c6f4111b342378dd88bbdc657e322d2ab6ad8
| | * Add more information for QKeySequence::toString on macOSJesus Fernandez2016-11-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous documentation said: "On OS X, the string returned resembles the sequence that is shown in the menu bar." That was not completely true because the string returned depends on the format passed to the function. Task-number: QTWEBSITE-744 Change-Id: I1b7d9367547326670d1b3a8cfe48f066910f5a10 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | | Use QString::fromLatin1() less to avoid string allocationsAnton Kudryavtsev2016-09-151-3/+7
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QString::fromLatin1 always allocates memory, but there are cases where we can avoid/reduce allocations or/and reduce text size, e.g.: QStringBuilder expressions Fix: replace QString::fromLatin1 with QL1S QString::fromLatin1().arg(String) pattern Fix: replace with QStringBuilder Overloaded functions with QL1S arg Fix: replace QString::fromLatin1 with QL1S In rare cases if there is no overloaded function with QL1S and we have deal with string literal, replace QString::fromLatin1 with QStringLiteral. Change-Id: Iabe1a3cc0830f40ef78a0548afa4368583c31def Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-251-5/+5
|\| | | | | | | | | | | | | | | Conflicts: src/corelib/mimetypes/qmimeprovider.cpp src/corelib/mimetypes/qmimetype.cpp Change-Id: Ib483ddb6bfc380e7c8f195feca535703814c3872
| * QKeySequence: remove 239 unneeded relocationsMarc Mutz2016-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Same change as in QColor (d38f86e50b01c6dd60f5a97355031e08d6a47d18). relocs: -239 text: -586B data: -3840B (optimized GCC 6.1 Linux AMD64 build). Change-Id: I180e9b65736481dd4e82dc68ef6c3f7541e205cf Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * QKeySequence: replace an array end marker by static size calculationMarc Mutz2016-08-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | This improves code generation, since the compiler statically knows the number of loop iterations. But it also fixes a compile-error on Clang with a following change of the name field from char* to char[]. Change-Id: I7ef18adf3cb9b34cd1b7235cb35cf26b7e349d92 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-13/+13
|\| | | | | | | | | | | | | | | | | | | 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
| * Fix typo in QKeySequence docLiang Qi2016-08-121-1/+1
| | | | | | | | | | | | Task-number: QTBUG-55181 Change-Id: I70615a2b4b026a83f506df928a79c9e60543e655 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
| * Doc: Change instances of '(Mac) OS X' to 'macOS'Topi Reinio2016-08-121-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-051-2/+2
|\| | | | | | | | | | | | | Conflicts: tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: I6f3878b204464313aa2f9d988d3b35121d4d9867
| * Doc: Fix references to Control, Meta key enumsKai Koehne2016-08-031-2/+2
| | | | | | | | | | | | | | | | Also make use of qdoc's \note command. Change-Id: I276300cfcfde06e82b04793dbf25df8ec73e9838 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* | QtGui: use QStringRef to optimize memory allocationAnton Kudryavtsev2016-06-021-6/+7
| | | | | | | | | | | | | | | | | | | | | | Replace substring functions that return QString with corresponding functions that return QStringRef where it's possible. Create QString from QStringRef only where necessary. Change-Id: Id83c60cc7568b20ef008b51c582cfdf466a47e35 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Gui: use const (and const APIs) moreAnton Kudryavtsev2016-06-011-3/+3
| | | | | | | | | | | | | | For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: I88d08d499e1be72c1f6d983fecdcee513df18aa2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-291-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qml_module.prf mkspecs/features/qt_common.prf src/gui/text/qzip.cpp src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/windows/array.h src/testlib/qtestcase.cpp src/widgets/dialogs/qfilesystemmodel.h Change-Id: Ie41c5868415b81f7693c80e045497035504bb210
| * Silence MSVC warnings when using certain std algorithmsMarc Mutz2016-04-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MSVC STL warns when passing naked pointers as non-bounded iterators to algorithms such as std::equal and std::copy, in an attempt to inform users that the range specified by that iterator has an implicit minimum size that the caller of the algorithm must ensure is met: warning C4996: 'std::_Equal1': Function call with parameters that may be unsafe - \ this call relies on the caller to check that the passed values are correct. To \ disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to \ use Visual C++ 'Checked Iterators' When building Qt, as well as when building user projects with qmake (cf. 0a76b6bc7f98900ea884cd10ccca1a332e5bdba5), we globally disable this warning (with -D_SCL_SECURE_NO_WARNINGS), but since we started using STL algorithms in public headers (e.g. in qvector.h), users get this warning in their own projects now, unless they, too, define said macro. But such a requirement is against the Qt policy to have headers that are warning-free as much as possible. The suggested way of fixing this warning is to wrap the naked pointer in a stdext::unchecked_array_iterator before passing it to the algorithm, cf. examples in https://msdn.microsoft.com/en-us/library/ttcz0bys%28v=vs.120%29.aspx or, together with the capacity-made-explicit, in a stdext::checked_array_iterator. To avoid ifdefs for platforms that don't have these extensions (which, incidentally, for the unchecked case, includes MSVC 2012), wrap the calls in macros. The end game here is to drop -D_SCL_SECURE_NO_WARNINGS, at least for public headers, even though this commit also adds the wrapper to implementation and private header files. An alternative to the wrapper would have been the version of std::equal that takes four iterators. However, that is a C++14 library feature, while this version of Qt still needs to compile with a C++98 compiler, and, more importantly, there isn't, and never will be, a corresponding 4-iterator version of std::copy. Task-number: QTBUG-47948 Done-with: Stephen Kelly <steveire@gmail.com> Change-Id: I1bbab257fb5f1c5042939c382a412b596112ff26 Reviewed-by: Stephen Kelly <ske@ableton.com>
* | QtGui: eradicate Q_FOREACH loops [already const]Marc Mutz2016-02-111-3/+3
| | | | | | | | | | | | | | | | | | (or trivially marked const) ... by replacing them with C++11 range-for loops. Change-Id: I3cce92b9d77a3ff96fad877d1d989145e530646f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-111-8/+22
|\| | | | | | | | | | | | | | | | | | | 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
| * dbusmenu: Add support for shortcutsDmitry Shachnev2016-02-021-8/+22
| | | | | | | | | | | | | | | | | | | | To do that, split out and export a QKeySequencePrivate::keyName() function that returns the key text representation without the modifiers. The implementation is compatible with libdbusmenu-qt. Change-Id: Ibc3190a3949813a1610728cf89574027e5d2778d Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-021-0/+17
|\| | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test src/plugins/platforms/cocoa/qcocoahelpers.mm src/tools/qlalr/cppgenerator.cpp Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
| * Doc: Properly document old platform-specific functionsSze Howe Koh2016-01-291-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | qt_mac_set_dock_menu() needs a \relates command to show up properly. "\since 5.2" produces "This function was introduced in Qt 5.2", which is wrong; the function existed in Qt 4. qt_set_sequence_auto_mnemonic() is referenced by the QShortcut class ref, but the page that hosted it in qtdoc.git is being removed. Thus, its description is now transferred here. Change-Id: If009a45f1d04541787925cf230ed7b59c7db0b39 Reviewed-by: Alejandro Exojo Piqueras <suy@badopi.org> Reviewed-by: Topi Reiniö <topi.reinio@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>
* Clean up cancel operation handling on OS XTor Arne Vestbø2015-09-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The logic for handling cancel operations was spread out through the code base and sometimes hard-coded to only include the Escape key shortcut, missing the Command+. shortcut. We now intercept both attempts at cancel operations from the system through cancelOperation, which we forward as normal key events. A new QKeySequence::StandardKey has been added for the Cancel sequence, which maps to Escape on all platforms, and Command+. in addition for OS X. The hard-coded logic in QWidget and subclasses for dealing with closing the dialogs has been replaced with this key sequence, which allows clients to override the behavior. Note that the widget code is not wrapped in checks for QT_NO_SHORTCUT, as we don't care about keeping widgets building and working under that define. The logic in QCocoaWindow to bypass windowShouldClose when delivering IM events has been removed as we now handle that specific case by also forwarding Escape as a cancel operation. Task-number: QTBUG-47557 Task-number: QTBUG-45771 Task-number: QTBUG-44076 Change-Id: Ibe0b3a4819f8659d246a2142dd7d9cd3a826ef78 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* QKeySequence: replace an inefficient QList with QVectorMarc Mutz2015-07-131-4/+5
| | | | | | | | | | | | | | QModifKeyName is larger than a pointer, so holding it in a QList is horribly inefficient. Fix by marking it movable and using QVector instead. The logic for filling the lists-turned-vectors is a bit fishy in that it is not thread-safe. Maybe it doesn't have to, it's not marked as \reentrant. Change-Id: I8421e6d8b980eff022badfe3c61b3537783b5cfa Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QKeySequence: use QKeySequencePrivate::MaxKeyCount everywhereMarc Mutz2015-07-131-17/+9
| | | | | | | | | | | | | | | | | The MaxKeyCount symbolic constant was introduced for use by QKeySequenceEdit, but never applied to QKeySequence itself. To prevent the two from getting out of sync, use it in the QKeySequence implementation itself, too. This required re-writing most expressions involving QKeySequenceEditPrivate::keys with algorithms, but we already determined in the discussion around 1cf9a139 that GCC generates the same code as the loops unrolled by hand, and if Clang doesn't, it's its own fault. Where using MaxKeysCount was not possible, e.g. in documentation, static_asserts were used to indicate the need for manual changes. Change-Id: I559fffdfd552d488448ba4a5a1ac10708c16a2ae Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Micro-optimize QKeySequence datastream operator (II)Marc Mutz2015-07-041-4/+12
| | | | | | | | | | | | | | | | | | | | | | | Instead of reading a QList with the keys and then assigning the list contents to the keysequence internals without any further checking (not even for the size of the list, even though op<< creates lists with just one element), do the processing by hand. The greatest benefit is that there is are no memory allocations anymore, except for the detach and whatever QDataStream does internally. The other benefit is that the output key sequence is not touched until the necessary values have been successfully read. This includes the detach. For this, some very basic error checking has been added. Also removed the magic number 4 in favor of the recently introduced QKeySequencePrivate::MaxKeyCount. Change-Id: If70f75cc043468d2774a7bb03eebdbf39422043a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-07-011-8/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qglobal.h src/corelib/global/qsysinfo.h src/corelib/global/qsystemdetection.h src/corelib/kernel/qobjectdefs.h src/plugins/plugins.pro tests/auto/widgets/itemviews/qlistview/qlistview.pro Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
| * Replace MAC OS X with OS XNico Vertriest2015-06-301-8/+8
| | | | | | | | | | | | Task-number: QTBUG-46374 Change-Id: I7bc633ab551740bd328a24b0ccae1d534af47138 Reviewed-by: Martin Smith <martin.smith@digia.com>
* | Micro-optimize QKeySequence datastream operator (I)Marc Mutz2015-06-241-8/+7
| | | | | | | | | | | | | | | | | | Instead of creating a QList with the keys with one of two statically known sizes, stream the contents itself. Apart from QDataStream, this no longer allocates any memory. Change-Id: I5ed814b186dcaf8cc7dedcc520928aefab01f009 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | gui: Add several QList::reserve() calls.Sérgio Martins2015-06-221-0/+1
| | | | | | | | | | | | | | Reduces reallocations. Change-Id: I0db16726f413a67b76a73fabd013f910ab5f5109 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Micro-optimize QKeySequencePrivate::decodeString()Marc Mutz2015-06-151-1/+1
| | | | | | | | | | | | | | Use a QStringRef instead of a QString. Change-Id: I63bf9775606b071cd9614306375e1316dada9f61 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>