summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qnamespace.h
Commit message (Collapse)AuthorAgeFilesLines
* QKeyCombination: use new comparison helper macrosTatiana Borisova9 days1-9/+6
| | | | | | | | | | Replace public friend operators operator==(), operator!=() of QKeyCombination to friend method comparesEqual() and Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE macro. Task-number: QTBUG-120304 Change-Id: I679f3fa5fcc4c675a763cc5a5fe0e0880439a64f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Add AA_DontUsePopupWindowsOliver Eftevaag2024-04-051-1/+1
| | | | | | | | | | | | | | | | | | | We want QQuickPopup to open a top-level window in qt quick, by default. But also allow users to opt out, and revert back to the old behavior. It makes sense to have an application wide setting for this, in order to allow application developer to opt out of the new default behavior, without having to change a property for every instance of Popup. While QCoreApplicationPrivate::attribs bearly has any available bits, it appear that bit 30 is available, since AA_DisableWindowContextHelpButton was commented out. Task-number: QTBUG-121363 Change-Id: I6b2759d89b46aa5d08222c2611eaffe855cc425c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix Qt::AA_DontUseNativeMenuWindows being unsettable on 32 bit systemsMitch Curtis2024-04-041-2/+1
| | | | | | | | | | | | | | | | f1bb9cfbf65ab56b67b5a52fa736071e0e534261 added this value, but it was only when a test in qtdeclarative tried to use it that it was discovered that it couldn't be set on 32 bit operating systems (armv7, AKA imx7) due to overflow as a result of the bit shifting that is done. Fix it by using an old, deprecated value. If any old codebase using that older flag tries to build against a newer Qt with this change, it shouldn't affect it, as setting the flag does nothing in Widgets, and native menus didn't exist in earlier versions. Task-number: QTBUG-69558 Change-Id: I520154d02e9ccf007ebd73807685212a19fbee1b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add AA_DontUseNativeMenuWindowsMitch Curtis2024-03-151-0/+1
| | | | | | | | | | | | | | | Also add some categorized logging output to make it easier to check if native menus are being created. [ChangeLog][Qt Core] Added AA_DontUseNativeMenuWindows application attribute. Menu popup windows (e.g. context menus, combo box menus, and non-native menubar menus) created while this attribute is set to true will not be represented as native top level windows, unless required by the implementation. Task-number: QTBUG-69558 Change-Id: Iba11b89c67d942ce6c5a28a7c57a86e63c020618 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Timers: add Qt::TimerId enum classAhmad Samir2024-03-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Which will be used to represent timer IDs. Thanks to Marc for the idea to use "a strongly typed int". QTimer got a new id() method that returns Qt::TimerId (can't overload timerId()). Various classes in qtbase have a member named timerId(), but a new method is needed anyway in QTimer so id() it is (this is the reason QChronoTimer only has id() and no timerId()). Besides timer.timerId() has an extra "timer". This commit fixes the inconsistency between QObject using `0` timer id to indicate "failed to start", while QTimer::timerId() returned `-1` to indicate "timer is inactive". QTimer::id(), being a new method and all, now returns Qt::TimerId::Invalid, which has value `0`, so that the values match between the two classes. Extend the unittests to ensure QTimer::timerId()'s behavior is preserved. [ChangeLog][Core][QObject] Added Qt::TimerId enum class, that is used to represent timer IDs. Change-Id: I0e8564c1461884106d8a797cc980a669035d480a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update the default behavior of items with layoutSanthosh Kumar2024-03-011-1/+1
| | | | | | | | | | | | | | | | The earlier patch 4ae537e67c99160f5dcac99f40d03a7921456556 had default behavior as opt-out for size policy of items within the layout. This can cause a lot more UI regressions than anticipated and, so make it as opt-in (Qt::AA_QtQuickUseDefaultSizePolicy). This means that the user needs to explicitly set this attribute to utilize the default size policy of quick items. Amends patch 4ae537e67c99160f5dcac99f40d03a7921456556 Task-number: QTBUG-117597 Pick-to: 6.7 Change-Id: Ibdb3ea9897c19792a110cbb15834b27383b9103e Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Add Qt::AA_QtQuickDontUseDefaultSizePolicyJan Arve Sæther2024-01-081-1/+1
| | | | | | | | | | | This flag should be set in order to opt out of that Qt Quick Layouts takes implicit (built-in) size policies into account, a feature that was introduced in Qt 6.7 Task-number: QTBUG-117597 Pick-to: 6.7 Change-Id: I206cd61534b2103b2c3a9b4abc97fec8c88799d1 Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* Rename Qt::Key_mu to Qt::Key_microEdward Welbourne2023-08-241-1/+5
| | | | | | | | | | | | | | | | | The old name misleadingly identifies it as the Greek letter on which it is based (and to which it case-folds); but U+00B5 is MICRO SIGN, not the Greek letter mu, and pretending it is the latter only leads to confusion. Retain the old name as an alias to the new, prepare to deprecate it from 6.11 and change all uses of it to the new name. [ChangeLog][QtCore][Qt::Key] Qt::Key_mu is now renamed Key_micro, since it is, in fact, the micro sign, not the Greek letter mu. The old name is retained as an alias for the time being. Change-Id: I4deb905f5e59b906710bd092c05a2c0a9b6bba65 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Add note about Qt::SubWindow not being the same as a child windowTor Arne Vestbø2023-08-071-1/+1
| | | | | | Task-number: QTBUG-115729 Change-Id: Icd0b2006a828fd02b60e047d066e8a2e3095b93d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Rename Qt::Appearance to Qt::ColorSchemeTor Arne Vestbø2023-02-131-7/+0
| | | | | | | | | | | | Based on discussions in the 6.5 API review, where we concluded that 'appearance' is too general. Instead, we follow the CSS standard and use the term 'color scheme'. Pick-to: 6.5 Change-Id: I8ceaf4138ecadff5ccd962480e8e5beb39b556ec Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Jonas Kvinge <jonas@jkvinge.net> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Prepare for replacing Qt::Appearance with Qt::ColorSchemeTor Arne Vestbø2023-02-091-0/+7
| | | | | | | | | | | | | | Based on discussions in the 6.5 API review, where we concluded that 'appearance' is too general. Instead, we follow the CSS standard and use the term 'color scheme'. This patch is a first step, only introducing the new API, so that submodules can port over. The next step will be to remove the old API and transition the docs and platform themes. Pick-to: 6.5 Change-Id: I43cdb6bb1ccb49c535c06b1897821467fd83ca60 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Qt::Appearance: don't assign values to enumeratorsMarc Mutz2023-02-081-3/+3
| | | | | | | | | | | | The compiler does that for us. This makes the enum look like an enum again. A non-flags enum shouldn't have intializers of the form 0xNNNN, as that makes it looks like flags. Found in API review. Pick-to: 6.5 Change-Id: If49e94cdad719b7dc9e8a7b17f6883dc789e62d6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Long live QPermissions!Tor Arne Vestbø2022-11-011-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many features of today's devices and operating systems can have significant privacy, security, and performance implications if misused. It's therefore increasingly common for platforms to require explicit consent from the user before accessing these features. The Qt permission APIs allow the application to check or request permission for such features in a cross platform manner. The check is always synchronous, and can be used in both library and application code, from any thread. The request is asynchronous, and should be initiated from application code on the main thread. The result of the request can be delivered to lambdas, standalone functions, or regular member functions such as slots, with an optional context parameter to manage the lifetime of the request. Individual permissions are distinct types, not enum values, and can be added and extended at a later point. Task-number: QTBUG-90498 Done-with: Timur Pocheptsov <timur.pocheptsov@qt.io> Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Done-with: Mårten Nordheim <marten.nordheim@qt.io> Change-Id: I821380bbe56bbc0178cb43e6cabbc99fdbd1235e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add enum class Qt::AppearanceAxel Spoerl2022-09-161-0/+7
| | | | | | | | | | | | It has been decided to add an appearance property in QStyleHints, which will be propagated to classes that do not include QPlatformTheme. Therefore an appearance enum class is added to the Qt namespace, thus being available to all Qt classes. Task-number: QTBUG-106383 Change-Id: Icff94b0d7adca954ce74241d6811401d41f053e6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Long live QT6_{DECL,IMPL,CALL}_NEW_OVERLOAD!Marc Mutz2022-07-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have in the past found ourselves in need of disambiguating new overloads from older, QT_REMOVED_SINCE'ed ones, which we usually did by adding a defaulted int argument, cf. e.g. QMetaType::id(). The problem with a defaulted int argument is twofold: First, an int is a valid argument type, and users may get confused as to its meaning when presented with the signature in the IDEs auto-completion popup, and a lot of things implicitly convert to an int, so any errornous parameter passing may stay unnoticed until we remove these fake arguments come Qt 7. Second, this way of doing things requires a lot of ifdef'ery to keep the additional argument out of both the docs and future Qt 7 builds. The solution presented in this patch is to create a tag type, QDisambiguated_t, which a) more clearly communicates its purpose and b) doesn't implicitly convert from anything. To help with the invariably ugly ifdef'ery, provide a set of macros that hide this stuff from qdoc and Qt 7 builds. Use the macros to replace the fake int arguments that were added for 6.4. Pick-to: 6.4 Change-Id: I6916f38c8eb9793ad6dea5f61e7e5fff7e75e273 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert "Windows QPA: Add MSWindowsNoRedirectionBitmap flag"Tor Arne Vestbø2022-07-141-1/+0
| | | | | | | | | | | | This reverts commit 417bb463526d3ec3d80d66b029c1064fde88391f. The API addition was premature, as it can potentially be handled by the platform plugin automatically, and if not, should possibly live in QSurfaceFormat instead. Change-Id: I5c7050ce9c50b6c6a93ddfa6d2e842db0b9eed0d Reviewed-by: Yuhang Zhao <2546789017@qq.com> Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Windows QPA: Add MSWindowsNoRedirectionBitmap flagYuhang Zhao2022-07-141-0/+1
| | | | | | | | | | | | This flag will be useful for windows that only use 3D graphics API to do the rendering, such as Qt Quick applications. As a drive-by, fix a typo in the above line. Pick-to: 6.4 Change-Id: Ic6edcb7610055693734a5d5aff5e906991d4b911 Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* Add the qt_class pragma to file listed in sync.profile classnames mapAlexey Edelev2022-06-221-0/+4
| | | | | | | | | This makes header files self-contained and reduces the number of 'sources of truth' for syncqt procedure. Change-Id: I7f5865abc69934603139d23e1b5452da46ccb110 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Restore C++20-deprecated mixed-enum bitwise operatorsMarc Mutz2022-03-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++20 deprecated arithmetic on enum types. For enums used on QFlags<>, these operators have always been user-defined, but when the two enums are of different type, such as QFrame::Shape and QFrame::Shadow, the deprecation warning pops up. We have in the past fixed these in our headers by manual casts, but that doesn't help our users when our API requires them to OR together enums of different type. Until we can rework these APIs to use a variadic QFlags type, we need to fix it in an SC and BC way, which is what this patch sets out to do. The idea is simply to mark pairs of enums that are designed to be ORed together and replace the deprecated built-in bitwise operators with user-defined ones in C++20. To ensure SC and BC, we pass an explicit result type and use that to check, in C++17 builds, that it matches the decltype of the result of the built-in operator. This patch is the first in a series of similar patches. It introduces said markup macro and applies it to all enum pairs that create warnings on (my) Linux GCC 11.3 and Clang 10.0.0 builds. It is expected that more such markups are needed, for other modules, and for symmetry. Even with this patch, there is one mixed-enum warning left, in qxcbwindow.cpp. This appears to be a genuine bug (cf. QTBUG-101306), so this patch doesn't mark the enums involved in it as designed to be used together. This patch also unearthed that QT_TYPESAFE_FLAGS, possibly unsurprisingly so, breaks several mixed bitwise flags-enum operations (QTBUG-101344). Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-99948 Change-Id: I86ec11c1e4d31dfa81e2c3aad031b2aa113503eb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Qt namespace: fix Q_FLAG_NS declaration for Qt::MouseEventFlagsGiuseppe D'Angelo2022-03-021-1/+1
| | | | | | | | | The declaration was accidentally declaring the enumeration as a flag type, not the actual flag type. Change-Id: I515478b1628a6d72626da6d7e0061f1ea3d10c89 Pick-to: 6.3 6.2 5.15 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Qt namespace: add a Qt 7 note about enumerator orderMarc Mutz2021-08-061-0/+1
| | | | | | | | | | | | | LayoutDirectionAuto is the default in qguiapplication.cpp's layout_direction. Because the numeric value isn't zero, it forces the variable into the DATA segment instead of the more efficient BSS one. At a less technical level, LayoutDirection{} should really produce the default, Auto, instead of LeftToRight. APIs have been changed for lesser violations of inclusivity :) Change-Id: I06b42f0bc00ea539805280ef0aa9694e6d739f41 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QKeyCombination: code tidiesGiuseppe D'Angelo2021-05-191-3/+3
| | | | | | | | | | | * Use the new QFlags::toInt() instead of an explicit cast. * Don't apply ~ to an enumerator and then convert the result to an int; instead, convert the enumerator to int and then bitwise negate it. The former is going to break in an upcoming commit. Change-Id: I3a798d61452891d2f61f84e2d8e17237f47c5659 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QAbstractItemModel::match: code tidiesGiuseppe D'Angelo2021-05-121-0/+1
| | | | | | | | Remove a magic number from the code, by adding it (as a private value) to the right enumeration. Use toInt() to convert to integer. Change-Id: Id1b00dde900619684b5a3df247d46938439150ca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Delete less-than operator for QKeyCombinationVolker Hilsheimer2021-05-041-0/+2
| | | | | | | | | | | | | | | | | | QMetaType relies on QTypeTraits to identify whether a type provides operator<. Due to the the deprecated implicit conversion to int, this results in several screens of deprecation warnings when using QKeyCombination in a signal parameter or as a property type. QKeyCombination has no ordering semantics (is Alt+F5 larger than Control+Up?), so delete the operator. [ChangeLog][QtCore][QKeyCombination] Potentially source-incompatible change: the less-than operator for QKeyCombination has been deleted. Code relying on the deprecated implicit conversion to int will no longer compile. Use QKeyCombination::toCombined explicitly. Change-Id: Ic8522b88d68063f74b5a5582c51aee8e18982331 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Android: Add select and copy capability to read-only text widgetsPiotr Mikolajczyk2021-03-301-0/+1
| | | | | | | | | | | | | | | | In case of a read-only text editing widget it was imposibble to copy text from it. In QtWidgets you could not even see the selection handless. Text selection in QtWidgets module was filtered depending on readOnly property of the widget. Additionally, in InputMethod the read-only state was translated into disabled. Patch also makes the edit menu to be aware of the read-only status of the control - the menu items are different for rw and ro controls. Task-number: QTBUG-91417 Change-Id: Ic7b27f78678eeaa87a38607af787f254db1383b8 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Fix XCB launch key mappingAllan Sandfeld Jensen2021-01-151-0/+1
| | | | | | | | | | | | | They have been reported wrong since Qt 4, and not fixed for behavior compatibility, fixing it for Qt 6. [ChangeLog][X11] XF86LaunchXX keys have been remapped, so the Qt names and X11 names match, instead of being 2 off. Pick-to: 6.0 Fixes: QTBUG-25261 Change-Id: Ie3a8676439ae3e93a78218c9e7f4443565e84356 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-11-301-1/+1
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.0 Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Drop a [[maybe_unused]] on a variableGiuseppe D'Angelo2020-11-231-1/+1
| | | | | | | Turn it into an inline variable. Change-Id: I491bd8fee3d25f814587db5a1047f15990081d66 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Get rid of Q_COMPILER_CONSTEXPR checksAllan Sandfeld Jensen2020-11-171-7/+1
| | | | | | | Is required now. Change-Id: I62e95929d1649ea1390392230b619bd56d2a0349 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Expunge WA_GroupLeaderShawn Rutledge2020-10-271-1/+0
| | | | | | | | | It's been deprecated since Qt 4.1. Task-number: QTBUG-85816 Change-Id: Iafc6340716556f54fc5472c60035bb57461b842f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Long live Q_IMPLICIT!Giuseppe D'Angelo2020-10-141-2/+2
| | | | | | | | | | | | | C++20 will give us explicit(bool). While we can't use it just yet in its full potential, we can introduce a macro to start marking our implicit conversions (aka `explicit(false)`), removing the need for /* implicit */-like comments. Port a few usages to it. Change-Id: I336d5e4c8d51d8329627900d1059e59062c5cafd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* macOS: Remove WA_MacVariableSize widget attributeTor Arne Vestbø2020-10-061-1/+1
| | | | | | | | It was used for the deprecated HI-based theming, removed in 50428e97270ad7c87439af599dce33b697c8cc44. Change-Id: Ic0c216c2c056de81c85bcb1e724c0b8ecb8ac7ec Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Remove dead MacQuartz QInternal::PaintDeviceFlags enum valueTor Arne Vestbø2020-10-061-1/+0
| | | | | | | The QMacQuartzPaintDevice implementation was removed in c0065187d7c. Change-Id: I852c688601f105646d39c95341232512ee57a10d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macOS: Remove dead widget attribute WA_MacNoShadowTor Arne Vestbø2020-10-061-1/+1
| | | | | Change-Id: If17acc230fc7669e46956ac2150a5a395694666c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Replace Q_DECL_UNUSED with [[maybe_unused]]Allan Sandfeld Jensen2020-10-031-1/+1
| | | | | | | Use C++17 attribute directly Change-Id: Id853e7a5117065e4adb549f81303c1820fe198ce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use C++17 [[maybe_unused]]Allan Sandfeld Jensen2020-09-061-1/+1
| | | | | | | In some places needs to be ordered before const/constexpr though. Change-Id: I57a521ac0ad22b5a018761c4d52befbef69d64c0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Long live QKeyCombination!Giuseppe D'Angelo2020-09-031-0/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++20 via P1120 is deprecating arithmetic operations between unrelated enumeration types, and GCC 10 is already complaining. Hence, these operations might become illegal in C++23 or C++26 at the latest. A case of this that affects Qt is in key combinations: a QKeySequence can be constructed by summing / ORing modifiers and a key, for instance: Qt::CTRL + Qt::Key_A Qt::SHIFT | Qt::CTRL | Qt::Key_G (recommended, see below) The problem is that the modifiers and the key belong to different enumerations (and there's 2 enumerations for the modifier, and one for the key). To solve this: add a dedicated class to represent a combination of keys, and operators between those enumerations to build instances of this class. I would've simply defined operator|, but again docs and pre-existing code use operator+ as well, so added both to at least tackle simple cases (modifier + key). Multiple modifiers create a problem: operator+ between them yields int, not the corresponding flags type (because operator+ is not overloaded for this use case): Qt::CTRL + Qt::SHIFT + Qt::Key_A \__________________/ / int / \______________/ int Not only this loses track of the datatypes involved, but it would also then "add" the key (with NO warnings, now its int + enum, so it's not mixing enums!) and yielding int again. I don't want to special-case this; the point of the class is that int is the wrong datatype. Everything works just fine when using operator| instead: Qt::CTRL | Qt::SHIFT | Qt::Key_A \__________________/ / Qt::Modifiers / \______________/ QKeyCombination So I'm defining operator+ so that the simple cases still work, but also deprecating it. Port some code around Qt to the new class. In certain cases, it's a huge win for clarity. In some others, I've just added the necessary casts to make it still compile without warnings, without attempting refactorings. [ChangeLog][QtCore][QKeyCombination] New class to represent a combination of a key and zero or more modifiers, to be used when defining shortcuts or similar. [ChangeLog][Potentially Source-Incompatible Changes] A keyboard modifier (such as Qt::CTRL, Qt::AltModifier, etc.) should be combined with a key (such as Qt::Key_A, Qt::Key_F1, etc.) by using operator|, not operator+. The result is now an object of type QKeyCombination, that stores the key and the modifiers. Change-Id: I657a3a328232f059023fff69c5031ee31cc91dd6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QObject: add a single shot connection flagGiuseppe D'Angelo2020-09-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If one needed to listen to a signal just once, one had to store the QMetaObject::Connection object returned by connect() and use it to disconnect the slot after the first signal activation. This has led to a proliferation of using wrappers (and enough TMP); they usually look like this: 1) create a shared_ptr<QMO::Connection>, allocating its payload; 2) create a lambda, capturing the shared_ptr by value; 3) in the lambda, disconnect the connection (through the shared_ptr), and call the actual slot; 4) connect the signal to the lambda, storing the returned QMO::Connection into the shared_ptr. This is expensive, error prone for newcomers, and tricky to support as a general facility inside one's projects. We can do better, just support single shot connections right in QObject. [ChangeLog][QtCore][QObject] Added the Qt::SingleShotConnection flag. When a connection is established with this flag set, the slot is going to be activated at most once; when the signal is emitted, the connection gets automatically broken by Qt. Change-Id: I5f5feeae7f76c9c3d6323d841efba81c8f98ce7e Fixes: QTBUG-44219 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Deprecate and remove uses of AA_DisableHighDpiScalingTor Arne Vestbø2020-08-311-2/+6
| | | | | | Change-Id: Ibadce68775858c524b998aacad310905ba2c2e8e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Deprecate and remove all uses of AA_UseHighDpiPixmapsTor Arne Vestbø2020-08-311-1/+5
| | | | | | | High-DPI pixmaps are always enabled, and cannot be disabled. Change-Id: I01a006b404e5431582b64ef812974c1c022b39ae Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Qt namespace: purge deprecated enum members and a typedefEdward Welbourne2020-08-281-40/+6
| | | | | | | | | | | | | | Since 5.0 - WFlags Since 5.6 - ItemIsTristate Since 5.14 - WA_NoBackground, WA_MacNoClickThrough, WA_MacBrushedMetal, WA_MacMetalStyle, WA_MSWindowsUseDirect3D WA_MacFrameworkScaled, ImMicroFocus Since 5.15 - MatchRegExp, MidButton (really since 5.7.0), WA_ContentsPropagated (really since 4.5.1, as are the following), WA_WState_DND, WA_ForceAcceptDrops. Change-Id: Ib1db3d85bf28823c704b5f3857546764b158e1ed Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* High-DPI: Remove usage of Qt::AA_EnableHighDpiScalingTor Arne Vestbø2020-08-281-1/+3
| | | | | | | | This attribute is now on by default. Change-Id: I7c9d2e3445d204d3450758673048d514bc9c850c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Mark some Qt namespace enum members properly as deprecatedEdward Welbourne2020-08-271-6/+12
| | | | | | | | | | | | | | | | A comment is not good enough, Some of the enum members were even still in use, or mentioned in documentation. WA_ContentsPropagated, WA_WState_DND and WA_ForceAcceptDrops have been deprecated since 4.5.1; and at least the last has been an \omitvalue in the docs for even longer. (WA_ShowModal and WA_GroupLeader have been similarly marked, but are in use, see QTBUG-85816.) Push back to 5.15.1 in order to be able to remove these at Qt 6. Pick-to: 5.15.1 Change-Id: I6ea3839767e5f5158b0fed508f65798470191908 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Properly deprecate Qt::MidButton in favor of Qt::MiddleButtonEdward Welbourne2020-08-221-2/+4
| | | | | | | | | | | | MidButton had its // ### Qt 5: remove me upgraded to Qt 6 at 5.0; but it dates back to 4.7.0 Replace the many remaining uses of MidButton with MiddleButton in the process. Pick-to: 5.15 Change-Id: Idc1b1b1816673dfdb344d703d101febc823a76ff Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clarify relation between Qt::Keys and Unicode rangesTor Arne Vestbø2020-07-101-101/+114
| | | | | | | | | | | | | | The Qt::Keys have been re-ordered and comments added to reflect the layout of the enum values in relation to the Unicode ranges. Bits 0x00200000, 0x00400000, and 0x00800000 have been reserved in case we want to use them for Qt::ModifierKey later on. Doing so would require changing Qt::Key_unknown to not overlap with these bits, or to accept that Modifier + Qt::Key_unknown is not a supported usecase. Change-Id: I580a01b0a47a28948a0f0018c47931395933b8f2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Refactor pointer event hierarchyShawn Rutledge2020-07-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some goals that have hopefully been achieved are: - make QPointerEvent and QEventPoint resemble their Qt Quick counterparts to such an extent that we can remove those wrappers and go back to delivering the original events in Qt Quick - make QEventPoint much smaller than QTouchEvent::TouchPoint, with no pimpl - remove most public setters - reduce the usage of complex constructors that take many arguments - don't repeat ourselves: move accessors and storage upwards rather than having redundant ones in subclasses - standardize the set of accessors in QPointerEvent - maintain source compatibility as much as possible: do not require modifying event-handling code in any QWidget subclass To avoid public setters we now introduce a few QMutable* subclasses. This is a bit like the Builder pattern except that it doesn't involve constructing a separate disposable object: the main event type can be cast to the mutable type at any time to enable modifications, iff the code is linked with gui-private. Therefore event classes can have less-"complete" constructors, because internal Qt code can use setters the same way it could use the ones in QTouchEvent before; and the event classes don't need many friends. Even some read-accessors can be kept private unless we are sure we want to expose them. Task-number: QTBUG-46266 Fixes: QTBUG-72173 Change-Id: I740e4e40165b7bc41223d38b200bbc2b403e07b6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Qt::Modifier: do some cleanupsGiuseppe D'Angelo2020-07-091-1/+1
| | | | | | | | | | | | | | | | | | Qt::UNICODE_ACCEL had no effect since at least Qt 4.0. We can drop it in Qt 6. The whole Qt::Modifier enumeration is still widely used, so we can't drop it yet, but we should aim at doing so in Qt 7. Add a note. [ChangeLog][QtCore][Qt::Modifier] The Qt::UNICODE_ACCEL enumerator has been removed. It had no effect since Qt 4.0. [ChangeLog][QtCore][Qt::Modifier] Usage of the enumerators in the Qt::Modifier enumeration is discouraged. The enumeration will likely get removed in the next major version of Qt. Change-Id: If25f30d920878d32903b91a38044f5da042c7eab Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove deprecated roles BackgroundColorRole and TextColorRoleChristian Ehrlicher2020-06-201-4/+0
| | | | | Change-Id: I2729102d1efa9f3809ec22c29517961800e7dc6d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove deprecated text-related enumsEskil Abrahamsen Blomfeldt2020-06-081-4/+0
| | | | | | | | Fixes: QTBUG-82367 Change-Id: Iff2645759657f8e350754e90e791dbd583017671 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>