Commit Graph

52797 Commits

Author SHA1 Message Date
Jeremy Katz
81411cb3a8 Doc: fix QStyleOptionMenuItem::menuHasCheckableItems typo
Change-Id: I2553f3e799e57e688ae98090e34f30122fea1142
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-08-10 05:42:58 -07:00
Tianlu Shao
0ef190fcc4 QCompleter: QCompleter unexpectedly changes QLineEdit text
When qcompleter and qlineedit are used together, the currentcompletion()
of qcompleter is its first item by default. Therefore, when qlineedit
makes the initial value, then selects the text and enters, qcompleter
will modify the default first item to qlineedit text. The judgment that
completionprefix() of the completer is not empty is modified and added
here, because completionprefix() is always empty when there is no match.

Fixes: QTBUG-20894
Pick-to: 6.2 6.1 5.15
Change-Id: Id47f7f4da0a93d03a4e7b056ec731615b0803d13
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tianlu Shao <shaotianlu@uniontech.com>
2021-08-10 20:21:59 +08:00
Gatis Paeglis
e946e6895a xcb: implement missing bits from ICCCM 4.1.4 WM_STATE handling
ICCCM 4.1.4 says:

Clients that want to re-use a client window (e.g. by mapping it again) after
withdrawing it must wait for the withdrawal to be complete before proceeding.
The preferred method for doing this is for clients to wait for a windown manager
to update or remove the WM_STATE property.

This patch implements the required logic. Qt 4 had something similar. Without
this patch we are calling various setter functions on a native window while it
is in an undefined state.

Fixes: QTBUG-69515
Pick-to: 6.2 5.15
Done-with: Liang Qi <liang.qi@qt.io>
Change-Id: I377a66ad3d5e43f14465d0ea670b2f43f96ed7d3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-08-10 14:21:59 +02:00
Liang Qi
02248eea55 xcb: add a timeout control when reading INCR property
For the first call of QXcbClipboard::clipboardReadProperty()
inside of clipboardReadIncrementalProperty() in getSelection(),
it will get a XCB_NONE reply before the contents arrived via
property change. Then we give a chance to read more.

Manually tested with following setups:
* examples/widgets/mainwindows/application with gvim(gtk3)
* examples/widgets/widgets/imageviewer with GIMP 2.10.18(based on
gtk2) and GIMP 2.99.6(based on gtk3 via flatpak)

Fixes: QTBUG-56595
Pick-to: 5.12 5.15 6.1 6.2
Done-With: JiDe Zhang <zhangjide@uniontech.com>
Change-Id: Ib45f08464d39ad79137b1da99808c89b7dca2d08
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-08-10 12:21:58 +00:00
Ievgenii Meshcheriakov
f636a1efa5 QCalendarRegistry: Explicitly disable moving and copying
Add Q_DISABLE_COPY_MOVE to QCalendarRegistry to silence the following
warning produced by QtStaticAnalysisBot:

    class 'QCalendarRegistry' defines a non-default destructor but does
    not define a copy constructor, a copy assignment operator, a move
    constructor or a move assignment operator

QCalendarRegistry is a singleton so it does not need to be moved or
copied.

The warning was introduced by d0ae1ef33a.

Task-number: QTBUG-93004
Pick-to: 6.2
Change-Id: I5e018346415b9d0a1ebc3bbde2ab7c3ad5e6d9d0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-10 14:21:58 +02:00
Ievgenii Meshcheriakov
62b5d88b0d tst_qurlinternal: Add tests for punycode overflow
Add two tests for decoding IDNs when they encode values outside Unicode
(> 0x110000).

"xn--5p32g" decodes to "a" (all ASCII) before QTBUG-95577 got fixed.

"xn--400595c" decodes to the same value as "xn--097c" after the above
mentioned bug got fixed. This test is currently failing.

Task-number: QTBUG-95689
Pick-to: 6.2
Change-Id: Icab55c41e0233b34d57e38232fa90ac42f35a50a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-10 14:21:58 +02:00
Ievgenii Meshcheriakov
9bd2ab85ac QUrl: Fix Punycode handling for non-BMP codepoints
Iterate over Unicode codepoints instead of UTF-16 characters
when converting to/from Punycode as described in the specification.
Additionally reject strings with invalid surrogate pairs when
encoding to Punycode, reject strings with any encoded surrogates
when decoding.

Remove expected failure marking from the test for this issue
in tst_qurlinternal.

Fixes: QTBUG-95577
Pick-to: 6.2
Change-Id: I3dd68f95ada6d652e2fa5c0c3118dcfa0a5f4c4d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-10 14:21:58 +02:00
Toni Saario
2f3b234d6c Apply custom timeouts to cross compilations
Pick-to: 6.2
Change-Id: I93ce6b6a6011a0883820f291121d7374391494c6
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
2021-08-10 12:21:58 +00:00
Timur Pocheptsov
33de5f6502 tst_QSslSocket - replace an old certificate
Helped quite a lot with OpenSSL 3 not accepting some old algorithms.

Pick-to: 6.2 6.1 5.15
Task-number: QTBUG-95123
Change-Id: If4894fa86eba7b002465fa661d436ae6ea751989
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-10 14:21:58 +02:00
Alexandru Croitor
eb22826057 CMake: Fix build with CMake master / 3.22
CMake master / 3.22 introduced a behavior change in how conditions are
evaluated in the while command. It is now consistent with how if()
evaluates conditions.

This caused an issue in Qt code where a "(" opening parenthesis was
evaluated as part of the condition rather than as a string.

Fix this by wrapping the evaluation of the variable in quotes.

Pick-to: 6.1 6.2
Change-Id: I70c26dc91394f4a14f7a26419df264a069dc7dc5
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
2021-08-10 12:05:31 +00:00
Sona Kurazyan
d61820e5ab Improve docs for QFuture continuations
Replace phrases like "future has been running", "parent" with more
precise descriptions.

Pick-to: 6.1 6.2
Fixes: QTBUG-95273
Change-Id: Ibd5a464007d41cc437da49ba250b9ea0a46078c6
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-10 13:07:18 +02:00
Edward Welbourne
f5aeb4f970 qlocale_win: Rename a misnamed local variable
Although the function is called get{Dat,Tim}eFormat(), the content
it's filling the buffer with isn't a format, it's a formatted date or
time. So name the variable we transcribe the buffer into text instead
of misleadingly calling it format.

Change-Id: Ia3a51184963109a50dbc41e205bd8c83d83c04d7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-10 13:07:18 +02:00
Ulf Hermann
6f8ef8c64d QVariant: Tolerate QObject* metatypes without QMetaObject
QMetaType does. QVariant should do the same.

Pick-to: 6.2
Change-Id: I3419276b78b3b5ce8bd144dee92685195797d568
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Daniel Nicoletti <daniel.nicoletti@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-08-10 13:07:18 +02:00
Volker Hilsheimer
79a219862f Document that hiding/disabling a menu is best done via the menuAction
Task-number: QTBUG-95072
Pick-to: 6.2
Change-Id: I83afe13b129a35b39c62abe553061cc4a390fd65
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2021-08-10 12:00:13 +02:00
Thorbjørn Lund Martsum
7502598ef5 QListView: fix AdjustToContents (sizeAdjustPolicy)
Unlike an acceptable effect in QTableView + QTreeView
setAdjustPolicy(QAbstractScrollArea::AdjustToContents)
unfortunately didn't work for QListViews (and QListWidget).

This patch corrects QListViews AdjustToContents
behavior.

[ChangeLog][QtWidgets][QListView] A more correct implementation
of QListView::viewportSizeHint has been made. That
implies that setting the sizeAdjustPolicy to AdjustToContent
on QListView and QListWidget will now cause the view to
size after the contents and avoid scrollbars.

Pick-to: 6.2
Task-number: QTBUG-58749
Change-Id: I1675115f2348e2fcf0b2c39b451ef337e10eb872
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-08-10 12:00:13 +02:00
Joerg Bornemann
0e92ec9728 Remove dysfunctional -coverage configure argument
The -coverage argument merely added compiler flags for the Qt build.  It
was never properly ported to the CMake build, and it doesn't seem
feasible to have configure arguments for every possible compiler option.

The same can be achieved by passing the needed compiler option to CMake,
for example: CMAKE_CXX_FLAGS=-fsanitize-coverage=trace-pc-guard

Pick-to: 6.2
Fixes: QTBUG-86227
Change-Id: Ieef9acaedc0a839f9fb35b4403395eea28643864
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-10 12:00:13 +02:00
Eirik Aavitsland
84aba80944 Refix for avoiding huge number of tiny dashes
Previous fix hit too widely so some valid horizontal and vertical
lines were affected; the root problem being that such lines have an
empty control point rect (width or height is 0). Fix by caculating in
the pen width.

Pick-to: 6.2 6.1 5.15
Change-Id: I7a436e873f6d485028f6759d0e2c6456f07eebdc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-08-10 12:00:13 +02:00
Marc Mutz
aa25e8d87e QGuiApplication: move two static variables from DATA to BSS
The {mouse,touch}DoubleXDistance variables were initialized to -1,
which forces them into the DATA segments.

But this value is completely unused, since these variables are also
set in initThemeHints(), called from QGuiApplicationPrivate::init(),
before their only user, QGuiApplicationPrivate::processMouseEvent(),
can possibly execute.

By changing the default value to 0, then, we allow the compiler to
place these variables into the BSS segment.

Change-Id: I86144559ee2410b844f70a4f2499c8d3140d14cf
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-10 08:11:38 +02:00
Marc Mutz
8da891a7f4 QMetaStringTable: disable copy and move
This class is an algorithm, and shouldn't be copied or moved.

Change-Id: I6f517f53a242dbfd61975ef885c358eef139a272
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-10 08:11:13 +02:00
Tor Arne Vestbø
ab70aa362e macOS: Fix leaked NSMutableArray in applicationActivationChanged
The +[NSObject new] method is a combination of alloc and init.

Fixes: QTBUG-95619
Pick-to: 6.2 6.1 5.15
Change-Id: I341f8a3958fb7a016cf4c346750ea6d46eeebe9f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-08-08 13:54:37 +02:00
Alexandru Croitor
b2f00dfb46 CMake: Rename qt6_add_plugin TYPE option to PLUGIN_TYPE
The intention is to remove TYPE as a keyword completely before 6.2.0
release, but in case if that's not possible due to the large amount
of repositories and examples, just print a deprecation warning for
now and handle both TYPE and PLUGIN_TYPE.

Task-number: QTBUG-95170
Pick-to: 6.2
Change-Id: If0c18345483b9254b0fc21120229fcc2a2fbfbf5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-08-06 21:08:21 +02:00
Tor Arne Vestbø
eb4fb9fa32 testlib: Don't report blacklisted tests as failures in JUnit reporter
We don't produce <failure> elements for them, so we shouldn't include
them in the total count of failures.

In the future we might produce <skipped> elements instead, but for now
remove the incorrect increment.

Pick-to: 6.2
Change-Id: Ia89a5cdaf79f6aa2f92be53180112c40ad6da2c6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-06 20:05:15 +02:00
Ievgenii Meshcheriakov
84a93d94ac QCalendar: Delete registered calendar backends on program exit
Add code to check if the calendar registry is destroyed to all
QCalendar methods that dereference QCalendarBackend pointer.

Pick-to: 6.2
Change-Id: I9b562355e2e0579396b52968f6065c6927cc9ca8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-06 19:46:18 +02:00
Ievgenii Meshcheriakov
d0ae1ef33a QCalendar: Thread-safe calendar backend registration
All calendar backend accounting was moved into QCalendarRegistry class
(renamed from Registry). Calendar backends are no longer registered
inside constructors, because in multithreaded environment
this may lead to incompletely initialized instances becoming visible
via QCalendar API in multithreaded environment. All system backends are
registered by QCalendarRegistry itself when they are needed. New method
QCalendarBackend::registerCustomBackend() is provided to register
any 3rd-party calendar backends.

Registration by names was also simplified. The list of names is now
passed to QCalendarBackend::registerCustomBackend(). The checks are
provided to ensure that all system backends have non-conflicting names.
Name conflicts for custom backends are resolved in favor of earlier
registered backends, as it is already the case in the existing code.
The documentation was updated to reflect that.

Method QCalendarBackend::names() was added to query the list of names
associated with a backend after it is registered.

Calendar backend deregistration was completely removed because it is
not possible to perform it safely without reference counting.

Fixes: QTBUG-93004
Pick-to: 6.2
Change-Id: I0ab1eccc02fdd1e1c66b5e5dd076c93de32d5a49
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-06 19:46:18 +02:00
Marc Mutz
f84adba102 Qt namespace: add a Qt 7 note about enumerator order
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>
2021-08-06 18:11:37 +02:00
Andrei Golubev
d4e62f2c5a moc: Support BINDABLE for private properties
Hopefully we won't need it but let's have it still at least for
consistency

Change-Id: I72289e65e5e5613174ad4d98cf8d614f9caae8e6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-08-06 17:25:50 +02:00
Marc Mutz
6ba6e7585d QXpmHandler: clean up write_xpm_image: cut out the QBA middle-man
Instead of appending to a QByteArray and then streaming that one, just
stream the components of a line directly. QTextStream's op<<(const
char*) is not subject to QT_NO_CAST_FROM_ASCII, etc., so can be used
unconditionally.

Change-Id: Idd97a75a1b5b939de7176d40880a2f328d01927d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-06 17:08:10 +02:00
Friedemann Kleint
74515a7a30 Improve translations loading code in standarddialogs example
Pick-to: 6.2
Change-Id: I799724b633f1b52675ca2aa69b22fdb678b84421
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-08-06 17:08:10 +02:00
Tor Arne Vestbø
1272b60d9e testlib: Fix name of current test case element in JUnit reporter
Pick-to: 6.2
Change-Id: I0bd77e5f1d0540b87568a0c69a4b96442d4000eb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-06 17:00:22 +02:00
Tor Arne Vestbø
a2026e4116 testlib: Write failure details as <failure> content in JUnit reporter
Pick-to: 6.2
Change-Id: Ica48769e7dfcabdc4bc8f0ed058bc22e29a0b632
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-06 17:00:22 +02:00
Tor Arne Vestbø
0ce70a29b3 testlib: Indent CDATA element in JUnit reporter
The data itself is not indented, as consumers may read it as verbatim
data.

Pick-to: 6.2
Change-Id: Ia934616cea273feadc3a45d7c74726d4f804f0dc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-06 17:00:22 +02:00
Ievgenii Meshcheriakov
1f20606fa3 tst_qurlinternal: Add a test for Punycode handling of non-BMP codepoints
Use U+102F7 as an example. The current code is not able to handle conversion
of Unicode codepoints outside BMP correctly, so mark the test as expected
failure.

Task-number: QTBUG-95577
Pick-to: 6.2
Change-Id: Ifd50cf306bce4940f84cb412de148eac952e6c09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-06 17:00:22 +02:00
Alexandru Croitor
7d86cf02c1 CMake: Partially fix QUIETness of find_package(Qt6 COMPONENTS Foo)
When Qt5Config.cmake was ported to Qt6, the assignment of
_Qt6_FIND_PARTS_QUIET was accidentally left out.

Make sure that when find_package(Qt6 QUIET COMPONENTS Foo) is
called, the underlying component find_package(Qt6Foo) call gets
a QUIET option as well.

This will silence short-form warnings like

 -- Could NOT find Qt6Foo (missing: Qt6Foo_DIR)

It currently won't silence any warnings produced by the transitive
find_package calls in QtModuleDependencies.cmake. That will require a
separate change.

Remove usage of _Qt6_FIND_PARTS_REQUIRED which was always empty.
See details of QTBUG-95573 why it's currently not used.

Pick-to: 6.2
Task-number: QTBUG-95573
Change-Id: I3822c068eecbe84c306a1b04f4187278d35ec3d5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-08-06 17:00:21 +02:00
Alexandru Croitor
825cb50c27 CMake: Improve component / package not found error messages
Provide better error messages when a Qt package / component is not
found.

Mention the location of the expected Config file on the file system,
whether it exists
Also mention the location of the Config file that was specified by the
user when configuring the project or which CMake computed and stored
in QtModule_DIR cache var.

Mention that a package is not found in case if the main target exposed
by that package is not found.

If the target is not found, mention that it might be due to
QT_NO_CREATE_TARGETS being set to TRUE (when it is set to true).
If it is set to true, the assumption is that the target must have been
defined by something else before the find_package call (either an
earlier find_package call without QT_NO_CREATE_TARGETS set to TRUE or
maybe it's the use case of Qt being built together with its examples
or it's a super build).

Unset _Qt_NOTFOUND_MESSAGE to ensure that the Qt6 not found error
message is not spilled into any subsequent find_package(Qt6) calls,
causing a cascade of unwarranted warnings / errors.
Make sure to unset it only if components were specified, so the
message is not shown or unset in any of the recursive
find_package(Qt6) calls which is a dependency for regular Qt module
packages.
This works fine, because find_package(Qt6) calls with components are
only done in project code and not done by the transitive dependency
code (which looks for Qt6Foo packages directly).

Remove some dead code.

Pick-to: 6.2
Task-number: QTBUG-95532
Change-Id: Ie93d18e25e33aa0fe9e9da9a60e3d3e4cd6adb58
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-08-06 17:00:21 +02:00
Mårten Nordheim
9b860ece42 QString/QByteArray: Fix setNum docs and add tests
Amends 260168d9d7

Task-number: QTBUG-53706
Pick-to: 6.2
Change-Id: I01c8cdc6a3cb46ec8e49e15ad71b6d707c0d272f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-06 16:49:08 +02:00
Marc Mutz
65512f8505 QInputDeviceManager: make QT_NO_KEYWORDS-clean
Change-Id: I1ba43c4dce82a8488e51c471fa3409fc08be1529
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-08-06 16:49:08 +02:00
Timur Pocheptsov
e7ab17ade1 tst_QSslCertificate::verify - remove QSKIP
And re-generate certificates.

Fixes: QTBUG-95429
Pick-to: 6.2 6.1 5.15 5.12
Change-Id: Id970a0a9315d146d6dd1e66c9cff9b7d75657e2d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-08-06 16:08:43 +02:00
Tor Arne Vestbø
f5203eeada Add native interface for X11 application, exposing display and connection
The major use-case of the now private QX11Info from Qt X11 Extras was
getting hold of the Xlib display and XCB connection, for example in KDE:

  https://lxr.kde.org/search?%21v=kf5-qt5&_filestring=&_string=QX11Info

A new native interface for QGuiApplication has now been added that
exposes these two properties, e.g.:

  if (auto *x11App = app.nativeInterface<QX11Application>())
      qDebug() << x11App->display() << x11App->connection();

To avoid type clashes one of the enum values of QXcbNativeInterface's
ResourceType had to be renamed.

Pick-to: 6.2
Task-number: QTBUG-93633
Change-Id: I2e366a2bb88bd3965ac6172ad000ae32209f43e7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-08-06 15:09:39 +02:00
Edward Welbourne
e158502e33 Turn off feature timezone for emscripten
We don't (yet) have a workable back-end for it.

Pick-to: 6.2 5.15
Task-number: QTBUG-95314
Change-Id: I8cf0fd11f315bc7d6cac351d485f4cbc676ed95d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2021-08-06 14:31:11 +02:00
Edward Welbourne
57da4a4f76 Tidy up QString's replaceArgEscapes() helper function
Eliminate wasted space, add spaces required by coding style, reflow an
arithmetic expression to read more gracefully.

Change-Id: Id04dfc7710f5cdb560a8d4655608139fb4c36191
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-06 14:29:18 +02:00
Edward Welbourne
d0c7f718ca replaceArgEscapes(): rework nested conditional to avoid repetition
Change-Id: I42306cb38d745bde33b93d3f66e86f19f58a868a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-06 14:29:18 +02:00
Edward Welbourne
54abc61af1 replaceArgEscapes(): correct a comment and assert what it relies on
Change-Id: I1d0c82b1cac0d59bd1fbda65f6a3e5be346b4c70
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-06 14:29:18 +02:00
Edward Welbourne
2452a7e184 replaceArgEscapes(): rework local variables to make code simpler
Change-Id: I188dc6f7a0d81d8587cc5a750d8773c3d389644f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-06 14:29:18 +02:00
Edward Welbourne
0dca7afaee replaceArgEscapes(): use qsizetype in place of int ant uint
The uint, particularly, was requiring some contortions to avoid
getting a "negative" value, where using qsizetype makes it harmless,
as the resulting loops are then no-ops. In the process, document the
slightly eccentric semantics of one of the retyped variables.

Change-Id: Idaad4cfde9ed9d24e1bcbf03c2bdb10b62e07916
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2021-08-06 14:29:18 +02:00
Edward Welbourne
47ead6ce2c replaceArgEscapes(): use a local variable to avoid duplication
Two blocks of code branched on the same local variable and, in each
block, one branch acted on a C-locale text, the other a localized
version, but doing the same to each in the two branches. Branch to set
a variable to the selected text so that we only have to write the code
to do each branch's actions to that one text.

Change-Id: I8bbc1210f2c14b19f41a9974c7b6ec2ae612cc70
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2021-08-06 14:29:18 +02:00
Marc Mutz
ccec95fda6 QCoreGlobalData: use QHash, not QMap, for dirSearchPaths
No user of the variable iterates over the container, they only
manipulate or inspect individual entries, so order doesn't matter. If
order doesn't matter, use the more efficient QHash over QMap.

Change-Id: Id28913a57bb14eb328e668624f236f76cad86def
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-06 14:19:52 +02:00
Fabian Kosmale
87973325f1 Handle even more include in enum cases
The solution in d3ed7dac8a was needlessly
complicated, and broke a valid use case.
The issue of no identifier being available to parse after the include
has been processed can instead be solved by moving the test for the
closing brace after the include processing.

Fixes: QTBUG-94790
Pick-to: 6.2 6.1 5.15
Change-Id: Ieec4b89e1d117637f11479e8bddc4060f93da43d
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-08-06 11:54:11 +00:00
Marc Mutz
71334c324e QXpmHandler: actually limit characters-per-pixel to four
The following code assumed, and all comments indicated, that the cpp
variable was limited to a max of 4. Yet, as coded, cpp could be five,
in which case the XPM would be corrupt, as the header suggested five
characters-per-pixel while the data was formatted in only four.

Add a warning and error out when we encounter this situation.

[ChangeLog][QtGui][QImage] Instead of writing a corrupt file, rejects
to write XPM files with more than 64^4 colors (more than four
characters per pixel) now.

Pick-to: 6.2 6.1 5.15 5.12
Change-Id: I458873cf7d179ab2e2dacd4c17dc837d640591a9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-08-06 13:50:39 +02:00
Marc Mutz
066dd1cdc0 QInputDeviceManager: ++explicit, ++out-of-line-dtors
It's private API, but exported, so de-inline the dtor to pin the
vtable in QtCore instead of potentially duplicating it in every plugin
that uses the class.

Change-Id: Ia948985bb94677c8453a8e7be27a14085303aaf5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2021-08-06 13:02:44 +02:00
Morten Johan Sørvig
6336b5350b Improve WM_DPICHANGED handling
Resize QPlatformWindow on DPI change, so that QWindow
size can stay approximately constant.

For example, a 100x100 QWindow at 100% scaling will
have a 100x100 QPlatformWindow. If the scaling is changed
to 200% then the QPlatformWindow is resized to 200x200,
while the size of the QWindow stays at at 100x100.

In practice the QWindow size will also change slightly,
due to inaccuracies in how we adjust for the size of the
non-client window area. This will be addressed in a later commit.

We can get DPI change independently of screen change,
so no resizing should happen in screen change events.
Disable the resize code in QGuiApplication for Q_OS_WIN,
and remove the WithinDpiChanged flag.

The new flow for handling DPI change is:

  1) Send screen change (if any), so that the correct
     screen will be used when calculating scale factors
     during the following resize.
  2) Resize the native window, which will trigger geometry
     change events, possibly also for the QWindow.
  3) Resize child windows; WM_DPICHANGED is sent to
     top-level windows only.

Fixes: QTBUG-89294
Pick-to: 6.2
Change-Id: I0e2d44bae72d20ebdafc3d410db7be9964ad851b
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2021-08-06 13:02:44 +02:00