Consistently use int (instead of uint) type for alignment/text
formatting flags passed to QStyle::drawItemText (and overrides).
Clean variables in QCommonStyle::sizeFromContents
- use self-explaining variable names
- rename misleading variables
- define one variable per line
- use consts whereever possible
- insert new lines to make code easier to read
- correct wrong indentations
- use auto in qstyleoption_castis to respect maximum of 100
characters per line
Pick-to: 6.5
Change-Id: Ie145c089606436213c813227154fac29962825d0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The example didn't show anything useful, and seemed more like a
manual test case.
Pick-to: 6.5
Change-Id: Ia71f39b26943aab04b6895e63b6eed50dd084bfd
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
.../qabstractbutton.cpp: In member function ‘virtual void
QAbstractButton::keyPressEvent(QKeyEvent*)’:
.../qabstractbutton.cpp:1010:58: error: incomplete type
‘QGuiApplicationPrivate’ used in nested name specifier
Pick-to: 6.5
Change-Id: Ia71bb481d125087aa813c891f9508755f435f4d2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Move all libthai symbol resolution and state management into a single
class. Create a single global static instance of this class. This allows
freeing of the state on program exit.
Task-number: QTBUG-105544
Pick-to: 6.5
Change-Id: I2610863f85f49f88e83f1fdaa200ea277c88c0ef
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Despite being move-only, std::vector<unique_ptr> advertizes
is_copyable:
https://quuxplusone.github.io/blog/2020/02/05/vector-is-copyable-except-when-its-not/
Our combined reallocation and resizing function, reallocate_impl(),
runs afoul of this when it uses std::is_copyable in a constexpr-if to
implement resize(n, v) without running into problems with move-only
types: the trait is true, but actual instantation runs into a
static_assert in the STL implementation.
To fix, move the problematic resize functionality out of
reallocate_impl() and into the resp. resize_impl overloads. The shrink
functionality remains in reallocate_impl(), because there are many
more users, and it only requires destructible<T>, which isn't
constraining at all.
Amends a00a1d8806.
Fixes: QTBUG-109745
Pick-to: 6.5 6.4
Change-Id: Ibc5b9cf5375108eb3d8f6c8a16d4fd02dadd73b1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The method is not meant be a slot.
warning: getter QApplication::autoSipEnabled possibly mismarked as a
slot [clazy-const-signal-or-slot]
[ChangeLog][QtWidgets][Potentially Source-Incompatible Changes]
bool QApplication::autoSipEnabled() is no longer a slot. Code such as
using QObject::connect() to connect to it as a slot or accessing it
through meta object system will have to be rewritten.
Pick-to: 6.5
Change-Id: I892a51120478f3c90e5834c8e3e00bc836b84c52
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Alexandru mentioned that at the time qtdeclarative was still using the
variable, but from then, he replaced those as well, and I couldn't find
any usage anymore either.
Change-Id: I6a1893c2dfaa483dc8cb865f7bacf08cadca985b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Stub targets introduced in 65b7aacb make the old batch target detecting
measure in qt_internal_extend_target,
qt_internal_undefine_global_definition, qt_internal_add_resource
obsolete, since now the targets actually exist in the build system.
Unconditionally fail if the target does not exist and if it does, query
for its inclusion in the batch
Change-Id: I1cd1d8cc7fbf4bdbd2289a1b38ecbea1e93a06c8
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
QDir caches data in mutable variables. Because of no protection, two
threads calling for instance QDir::count on two independent but shared
copies of a QDir object caused a data race.
Running the tst_QDir_tree and tst_QDir_10000 three times with and
without this change show no change beyond the difference between
each result. For instance tst_QDir_tree::thousandFiles:"src" took
36/35/37 ms before the change and 35/35/35 ms after.
This makes sense because the time to handle mutexes is very little
compared the time to make file operations.
Fixes: QTBUG-105753
Change-Id: I6886f84521410f88cce2b25f0cce8cfc3fea1a0b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
_qt_internal_expose_deferred_files_to_ide must add the source files to
the target exactly as they were passed to
_qt_internal_expose_source_file_to_ide. Otherwise, CMake might be fooled
into thinking that we're adding a new file here, and source file
properties would not be readable.
Instead of back-calculating the relative paths from the absolute paths,
we use the already existing list of relative paths.
Pick-to: 6.5
Fixes: QTBUG-109678
Change-Id: I81510f37eacb409eb5c03e3ff032926c3ca25a1f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Also remove reference to QTestCaseEvent loop class, which
is not documented.
Pick-to: 6.5
Change-Id: Ic09b3b102db535dfb090b9a4072ad29515a911ae
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
They cause clashes in CMake Unity (Jumbo) builds.
Properly prefixing the childWidgets() function also prevents
it from cluttering static builds.
Task-number: QTBUG-109394
Pick-to: 6.5
Change-Id: Idd2b1ec748f33cfae8f3213847c43b3fb0550377
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
As discussed in API review, the default-constructed T() returned from
a mismatched data<T>() call is indistinguishable from a real T with
default state.
To make them distinguishable, return optional<T>. Call the new
function value<T>(), mimicking QVariant::value<T>(), and suggested in
API review, because data() is usually used to return raw pointers, not
values.
Remove the qWarning() on requestedType and actualType mismatch, as the
new function can be used in std::get_if/dynamic_cast-like if-then-else
chains, in which failure is part of the normal operation, and a
warning message misplaced:
if (auto loc = perm.value<QLocationPermission>())
~~~ use *loc ~~~
else if (auto con = perm.value<QContactsPermission>())
~~~ use *con ~~~
~~~ etc ~~~
Pick-to: 6.5
Change-Id: I799a58e930307323ebce8f9ac50a42455e9c017f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Its symbol changed once it was changed to protected, so even if
it's unlikely to have been imported in any application let's just
change it back to private.
Pick-to: 6.5
Change-Id: I21b4a471caedb8edc8e1a04f706eae541b3c12fd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Following the QRect, add functions converting the QString to native
emscripten::val and back: fromJsString, toJsString
Change-Id: I2d0625ede3bbf7249e2e91b8de298b5b91df8ba2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
On small screen devices such as iPhone targets, the save file dialog is
using a non-native dialog, and it doesn't fit the screen real estate to
the extent that the [Ok] button is clipped away.
In addition, the open file dialog and the save file dialog doesn't
cooperate very well on platforms such as iOS without more plumbing.
Since using the file dialog is out of the scope for this example we
remove all usages of it.
Pick-to: 6.5
Change-Id: Ie165355ed0b671d93e44d2d55791156367b0ea5c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Use th_brk_new()/th_brk_find_breaks() instead of non-thread-safe
th_brk(). The new API is available in libthai since version
0.1.25 released on 2016-06-28.
[ChangeLog][QtCore] Correct line wrapping of Thai text now requires
libthai version 0.1.25 or above.
Fixes: QTBUG-105544
Pick-to: 6.5
Change-Id: I723050bef9f4e6445c946125c74c99e50addadef
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The new test:
- checks the properties of stateful Q<Typed>Permissions work
- ensures that piping a Q<Typed>Permission through QPermission
maintains state
- also ensures that assignment of a Q<Typed>Permission to a
QPermission works (via QPermission(Type) + move ctor)
Pick-to: 6.5
Change-Id: I340e49b1ecc665702ccab26d9050ca158b0e7885
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
These docs are for Q_Calendar_Permission, not for QContactsPermission.
Pick-to: 6.5
Change-Id: Ifbffa568b510ef035270082d1926e35d8d5cf241
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
They can be smaller than an int, so use quint8. In a world of BC
guarantees, pinning the underlying type of enums is best practice.
Found during API review.
Pick-to: 6.5
Change-Id: I0c31fe4565329982c81173e3a265f73758aad257
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Do not call first on it. A regression was introduced by
56f0ebfe86.
Fixes: QTBUG-110070
Pick-to: 6.5 6.4
Change-Id: I7c969da889b6c7ad3a67149fe99ca47830683073
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The test body has been inside an #if 0 for long, remove the test
altogether. The part that loads libthai does not check anyhing
meaningful.
Task-number: QTBUG-109954
Change-Id: I8ce006a14e4cf926b668e958d4b2343f965a5fb6
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
In developer builds we don't install tools, so syncqt executable is
located in its RUNTIME_OUTPUT_DIRECTORY but not by install path. This
works fine in general case, but in multi-config builds the
RUNTIME_OUTPUT_DIRECTORY path doesn't match the install path. So syncqt
target points to wrong location in this case. It makes sense to use the
existing IMPORTED_LOCATION of syncqt executable directly if Qt is not
supposed to be installed. Also check if the syncqt executable exists at
the expected location before creating the imported target.
Pick-to: 6.5
Fixes: QTBUG-109864
Change-Id: I0de647b2a73169a0d48bd88edeb7ff00975fa774
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
The code to save parent_id, actually a member variable that's
commented out, presumably because we have no use for it, was declaring
a variable to save it in and then Q_UNUSED()ing it. It is simpler to
just not do any of that. Since this "code" did at least document where
to get the parent_id, if we ever do want it, and what the number just
parsed actually means, keep the assignment as a comment but make clear
why it's commented out.
Change-Id: Iec59fa4d1af6c7e3b16570a612178a54004ebb70
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
It had various QVERIFY()s of != and >= checks: convert these to
QCOMPARE_NE() and QCOMPARE_GE() checks.
Change-Id: Ida6f7dca726187f7837da0d805549d9c582f946a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Like done elsewhere (e.g. in QStringView), formulate the constaint in
if_x<T> = true from, and let qdoc see it. Then document the constraint
in prose, too.
As a drive-by, use C++17 variable templates instead of
std::bool_value, and document that data() returns a
default-constructed T on failure (which is indistinguishable from a
successful call that happens to return a default-constructed T, so we
should probably return an optional<T> here, but that's orthogonal to
the change at hand).
Pick-to: 6.5
Change-Id: I0584ce3f4febd619d3966afeb6244b11b167cd42
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Extract the type-independent code into an out-of-line data_impl()
private method, leaving data() containing only the
QMetaType::fromType<T>() call as well as T copy- and
default-constructor calls.
As a drive-by, use categorized logging (consistency with the rest of
the permissions code) and printf-style qWarning() (expands to less
code).
Pick-to: 6.5
Change-Id: Ie23b83cb3fc537c9cff15f853ceee2888bf63124
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
When rows are hidden (implicitly or explicitly), then their layout data
does not get fully updated. If rows get hidden after the layout data has
been calculated once, then we must make sure that their indices are
reset. Otherwise we might access array indices that are out of bounds
when the layout data structure gets resized to fit only visible rows.
For good measure, skip entirely over hidden rows when accessing the
layout data when arranging the widget.
Fixes: QTBUG-109237
Pick-to: 6.5 6.4
Change-Id: I4d6943b6a110edb61f60ce78d31f0fc64b5cc03d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The flag avoids overriding of the default CMake build config when
building syncqt.
Add extra checks to the make sure that configure-time tools use the
correct build type.
Fixes: QTBUG-109792
Pick-to: 6.5
Change-Id: I572fed60c58e59297fa559aea6eb86af94b979b7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
If the command line option contains /DEBUG without the following
argument, GenerateDebugInformation remained 'false' because the
DebugInfoOption contained the initial value.
Set GenerateDebugInformation to 'true' if the /DEBUG option is found and
reset to 'false' only if option is set to 'none'.
Amends commit 6a6b27940d.
Pick-to: 6.2 6.4 6.5 5.15
Fixes: QTBUG-110068
Change-Id: I792d7335d8b9536d4beed54cabfd70dcf54f09ac
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
QDateTimeEdit has such reset functions for the minimum/maximum
range properties, this makes QCalendarWidget consistent with the
simpler editors.
Fixes: QTBUG-62448
Change-Id: Iabb89f599e4996f00488a885a5b8a009471838b3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Implement platform independent tracing backend in Common trace format.
This allows tracing in platforms without own/existing backend and
analysing all platforms with the same tooling. The backend is the basis
for further work in application level profiling area.
The backend is implemented as a plugin that is loaded immediately when
the application starts in order to process all trace events. The backend
avoids using Qt classes so that it doesn't generate trace events
itself. Adds plumbing to configure the new backend.
Modifies the tracegen and tracepointgen tools to support the new
backend.
Task-number: QTBUG-106399
Pick-to: 6.5
Change-Id: I80711be52d4d48e1acbc72edffbdf3f379fce52a
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Modify qtcore and qtwidgets to use the new tracing metadata features.
This allows showing the event types and image formats used in traces
as text instead of just numbers.
Task-number: QTBUG-106399
Pick-to: 6.5
Change-Id: I267d03a696dc95e8b1d36657d7339dd09d92de3b
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Adds ability to add textual metadata for enumerations and flags
to the traces so that they provide more information to the user
instead of just numbers. Implement these for both existing backends.
Task-number: QTBUG-106399
Pick-to: 6.5
Change-Id: Ibab00dd370d019891cf9ad6e65e6f9d868e32dce
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Add it globally so that each module using tracepoints don't have to
add it themselves to each modules configure.cmake.
Pick-to: 6.5
Change-Id: Id58cfaff5cd715b2667da2470001d646117f9f28
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>