... and use QtEndian instead.
The conversion would be done even on a big-endian system, so the
example would not work correctly on such machines.
Task-number: QTBUG-110622
Pick-to: 6.5
Change-Id: I6a660ff68fa5a8d9b4c1faf9e264d937c605c47e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
As a networking example it doesn't contribute much. But it has some
interesting uses of widget/events
Pick-to: 6.5
Change-Id: I194d32e6a304ae41819c20751e9f1ee1d9b5abdb
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
It's not a very well written example, using (largely unneed) hacks to
implement what it does. It's also misleading - the syntaxhighlighter
example is a better showcase for building a useful code editor.
Move it to manual tests.
Fixes: QTBUG-111025
Pick-to: 6.5
Change-Id: I405d41688235bf3e9a08373e716769f26d02fec6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
The example follows bad and outdated practices:
- running time consuming and I/O heavy workload in the GUI thread
- calling processEvents to keep the UI responsive
- showing results only at the end of a search rather than continuously
Perhaps this example can be rewritten at some point to apply modern
practices (at least use a thread and emit signals), but it seems
to have low overall educational value.
Moving it to be a manual test for now.
Fixes: QTBUG-111002
Pick-to: 6.5
Change-Id: Id630fd4599096448ea4f96bcbf977b11a039796f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The example is 90% boiler plate for subclassing QFrame and providing
a bit of GUI to change the size of the label using sliders. The
interesting bit is a block of 25 lines of code, so turn those into a
snippet and add that to the QTextLayout overview documentation.
Fixes: QTBUG-111011
Pick-to: 6.5
Change-Id: I6e97b2ea47b553c8d998ad185cfac006721ef7ee
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Includes should be ordered from most specific to most general. This
means that project-specific includes always come before Qt includes.
This example didn't follow that guideline. Fix.
Amends 88e8094f18.
Task-number: QTBUG-108857
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Iafdae9dd8e70ff99882c4344a023a21d15fa3c54
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
A QString is not a full representation of a Level, so the
Level(QString) ctor should be explicit.
Pick-to: 6.5 6.4 6.2 5.15
Task-number: QTBUG-108857
Change-Id: I24b705139e61c4aaf59cb0aad3b536013e0d07df
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Includes should be ordered from most specific to most general. This
means that project-specific includes always come before Qt includes.
This example didn't follow that guideline. Fix.
Task-number: QTBUG-108857
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I42727ff8bdef5336368cde349cbcb8d10bb6289f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
And add the macOS specific key.
Pick-to: 6.5
Change-Id: I1e0446a1927ef530322388417b9300ae287752c3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
These files should not change the outcome of the build process, but are
merely added to better support the CMake and Android integration in
Qt Creator. Also those files were previously listed in the OTHER_FILES
section of the qmake project files.
Change-Id: Id3d403130ee8800ed6b0877f9f1c3dd1f28b46b7
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This is almost exactly the same as the "Analog Clock" (widget) example.
"Analog Clock Window Example" demonstrates:
* How to render to a QWindow (covered by RasterWindow example)
* QPainter and transformations (covered by Analog Clock example)
* How to use QTimer (covered by Analog Clock example)
Pick-to: 6.5
Change-Id: I7f20a29798830ed6345eca250e4139cb314cab84
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
It gets hard to read like that.
And update mentions of 'SSL' to 'TLS' in the message while we're there.
Task-number: QTBUG-108874
Pick-to: 6.5
Change-Id: Ia7b27bfb3d99391b14ed396ca9a6400621022bf6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Otherwise the finalizers won't know which libraries we're linking to.
Pick-to: 6.5
Change-Id: I886c46443b7289d6e2c7d824767ed5e34a0a1fbf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
It demonstrates timerEvent() and some QFontMetrics
There are other examples that demonstrates this
Pick-to: 6.5
Change-Id: I4ad6f30c8ef93c995f980545ed88ab13b9aa9c7d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The "undo" example didn't show anything that the "undoframework"
example doesn't, and the latter is more comprehensive and properly
documented. "undoframework" also uses QGraphicsView instead of
inventing its own diagram widget.
However, the "undo" example created a nicer UI with toolbuttons,
icons, and the undo view in a dock widget, so reuse those elements
in the "undoframework" example instead.
Update the documentation quoting tags accordingly, and clean up
a bit.
Pick-to: 6.5
Change-Id: I3c91feecbd5fe3e5900838b0b51f9fe7bd190280
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
The hand-rolled loop produced incorrect output and was subsequently
rejected by trackers.
The torrent example doesn't support modern features though, so it's
still a bit hit-or-miss whether a torrent will work. E.g. downloading an
Arch iso does not work since it relies on DHT, PeX and HTTP seeds.
Fixes: QTBUG-109798
Task-number: QTBUG-110622
Pick-to: 6.5
Change-Id: Ica40fb9205f09d135407a160a28a45d06a418176
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
If a proxy is configured on the system then we will request credentials
if needed.
Task-number: QTBUG-108874
Fixes: QTBUG-106245
Pick-to: 6.5
Change-Id: Icbea491492cde4634421b1a1e722a3768d56dec8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
In Qt 6 it is unset by default.
Task-number: QTBUG-108874
Pick-to: 6.5
Change-Id: I35af9d7c1517fd393710b7b1b978d3f39c61acf0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
As a drive-by: print the path with native separators
Task-number: QTBUG-108874
Pick-to: 6.5
Change-Id: I73164acb159d1a45960e16d5f57996e8c27257f7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
It can do more than HTTP but let's keep the naming simple. Most people
likely aren't looking to do file: or data: or qrc: in this example.
Task-number: QTBUG-108874
Pick-to: 6.5
Change-Id: I8a822640f4a8015ebf6c56cb6a614d6426e8a912
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Add TARGET instruction in property setter, used in debug mode on macOS.
Task-number: QTBUG-107842
Task-number: QTBUG-109227
Change-Id: I8704b7009c36ea8ddbf8773abfaf2b5f34f728ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
A few things:
- Improved the documentation by adding a CMake section, briefly
describing the process of adding the plugin, and placing it where it
should be.
- Write a note about the case where the style may be overwritten at
launch, and how to set the a new style using a CLI
- Improved the CMake build such that it creates the App Bundle
correctly, and also works without an App Bundle as well.
- Changed the example, and plugin such that now instead of a QPushButton
we have a QTextEdit, and change the text color.
- Replaced the application screenshot
Fixes: QTBUG-107842
Fixes: QTBUG-109227
Change-Id: I161a91b27df016ff6230fac3871b79d2dfbdf18a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
One of the examples were using a different version than the others.
Though QString's formatting probably didn't change since then so
it was no problem.
Anyway, pretend like we're releasing it now for the first time and
set 6.5 on all of them
Task-number: QTBUG-108875
Pick-to: 6.5
Change-Id: I28b496ab3d8ff54c503a032ba15882cdf3d5eccf
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Ends up shortening the loop, making it easier to read at a glance.
Pick-to: 6.5
Task-number: QTBUG-108875
Change-Id: Ia12a994259b00e9b57f2de48124be9cb38553bf5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
As a consequence, also had to add some suppressions:
-Wno-padded (this warning should almost never be responded to)
-Wno-c++98-compat (we want to use c++17 features)
-Wno-weak-vtables (IMO not worth fixing for an example)
Pick-to: 6.5
Change-Id: I28ae4456c0221ad2370879a691f6343affff138b
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@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>
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>
The example overrides QWidget::resizeEvent() without using the
QResizeEvent * argument. This results in a compiler warning.
This patch marks the argument unused.
Pick-to: 6.5
Change-Id: I647d0eda7d895e70ed6f232960aec992f5e37b6c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The Qt namespace should be used for types defined in the Qt library,
not for user types.
Pick-to: 6.5
Change-Id: I6df0ca054888f4a65b19a9cb44324321d1dcfad8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Also, adjust line length to be < 80 columns and make link
parenthetical.
Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-107026
Change-Id: I5f7efa5d572103a6fb432d79a52a57363efd9dd7
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
3a449bbb69 amended the code to remove
acquiring a lock when waking up a condition variable. It is fine to
not have a lock associated when waking a condition variable; what I
misunderstood was the scope of the lock, which (and this underlines
the importance of commenting _what exactly_ a lock protects, for
each and ever lock) protected both the buffer as well as the counter
of the buffer. This made my reasoning flawed: it is necessary to keep
the lock while notifying, otherwise the counterpart could verify the
condition isn't satisfied and wait (e.g. see numUsedBytes==0), missing
the wake from the other thread (which could arrive between the check and
the wait).
Amends the previous commit.
Change-Id: If7db2d045331f1b33b976fb6bf6aa9117c41678f
Pick-to: 5.15 6.2 6.4 6.5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
The venerable wiggly example was created before unicode support was
added to Qt. Hence, when extracting the individual characters from the
string for painting, the code was not prepared to handle that some
characters, like emojis, are composed of two QChar elements.
Fixes: QTBUG-28853
Change-Id: I9804415f92775e2b78fa9fcaf7a2d112153cdce0
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
In no particular order:
* Clean up #includes.
* Document what is protected by the mutex.
* Use explicit, nullptr.
* Use lock managers, not manual calls to lock/unlock.
* Unlock the mutex before notifying the condition variables.
* Condition variables are always meant to be used in a while loop, and
never with a plain if, because of spurious wakeups.
* Don't lock a mutex just to protect a plain integer. We have atomics
for that use case.
* Remove an unneeded signal, therefore also the need of using
Q_OBJECT and the inclusion of the moc-generated file.
Pick-to: 5.15 6.2 6.4
Fixes: QTBUG-108860
Change-Id: I2afc77955b95de8aa5fb88048cd9feb217f83b4f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Remove conversion artifacts.
Also, remove setting the include path. The library's interface takes
care of that.
Change-Id: Ib5043f15ede2171ab876ccbe603ed0b84de1bce4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This library deliberately links PUBLICly against Qt6::Widgets and
Qt6::OpenGL. Same for the target_include_directories call.
This partially reverts a5de12f0d7.
This fixes the builds of examples using this library.
Change-Id: I2b5791044afc82e71df4a3bbfc26e5b1ab9afa76
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
There seems to be some confusion from back when the example were
mass-ported to the QOpenGL stuff in Qt 5 times.
Pick-to: 6.4 6.2
Fixes: QTBUG-109119
Change-Id: Ic4bcd010df3fcf82e16385ce241b379f0c351788
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
We (almost) only build apps, for which PRIVATE linkage makes more sense.
Change-Id: I09a509c3fb33a00cdfdede687b3f95d638f42091
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Some CMakeLists.txt files did link to Qt6::PrintSupport twice. Also
unify formatting and order of the linker step.
Change-Id: I4af935c5dc3de6c243aad8511b0803ceaa872589
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Need to add the plumbing necessary to support two textures in
QOpenGLWidget and use these in the backing store. The changes
required on the RHI level is already done in an earlier patch.
Then paintGL() needs to be called twice, once for each buffer.
Also add overloads for the other functions of QOopenGLWidget
where it makes sense to query for left or right buffer.
Then finally create an example.
[ChangeLog][Widgets][QOpenGLWidget] Added support for
stereoscopic rendering.
Fixes: QTBUG-64587
Change-Id: I5a5c53506dcf8a56442097290dceb7eb730d50ce
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This is what we promote also in the documentation.
Change-Id: If91aebafe861b0c934acbb2c69afd182abc3345d
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Not all platforms clean up the shared memory entries on exit, so the
example needs to handle that case, by attaching instead, as documented.
Change-Id: Ifbcf92d0fad429caf30710bd8a344831cb0d859c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The "Show Details..." button is not plumbed in any way to the native
dialog, so when added to a native dialog it will just result in the
dialog being dismissed, instead of revealing any extra content in
the native dialog.
Both the iOS and Android native message dialog implementations add
the details text directly to the dialog, without any action to
explicitly reveal it.
Task-number: QTBUG-108153
Change-Id: I92e00c59b7836f633be44caebd534a47ac58be00
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
And add license headers and some minor fixes for warnings in the
example and test.
Task-number: QTBUG-90498
Change-Id: I34592f7f2844c92c25a6a676c8ac1ffca9e03c6d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The lock and unlock of the Android deadlock mutex is now part
of the internal implementation instead of limited to the enum
based permission API. It is unclear why 8bca441b6f added
the guard only to this API and not to the string based API
as well.
The check for isBackgroundLocationApi29 has been removed,
as the logic seemingly resulted in accepting every single
permission type except location permissions if used via
the enum-based API.
Since Android's platform permission API doesn't have an
Undetermined status, we keep a hash of the status for each
permission type, and by default checkPermission() would
return Undetermined, until a requestPermission() call
is done which updates the internal hash, and after that
checkPermission() would return properly Granted/Denied.
Task-number: QTBUG-100413
Change-Id: Ia95c76af754481a281bc90198e349966c9c2da52
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
When submitting applications to the iOS and macOS AppStore the
application goes through static analysis, which will trigger on
uses of various privacy protected APIs, unless the application
has a corresponding usage description for the permission in the
Info.plist file. This applies even if the application never
requests the given permission, but just links to a Qt library
that has the offending symbols or library dependencies.
To ensure that the application does not have to add usage
descriptions to their Info.plist for permissions they never
plan to use we split up the various permission implementations
into small static libraries that register with the Qt plugin
mechanism as permission backends. We can then inspect the
application's Info.plist at configure time and only add the
relevant static permission libraries.
Furthermore, since some permissions can be checked without any
usage description, we allow the implementation to be split up
into two separate translation units. By putting the request in
its own translation unit we can selectively include it during
linking by telling the linker to look for a special symbol.
This is useful for libraries such as Qt Multimedia who would
like to check the current permission status, but without
needing to request any permission of its own.
Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Change-Id: Ic2a43e1a0c45a91df6101020639f473ffd9454cc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
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>
Move i18n example out of qtbase. In qttools, it can use lrelease,
avoiding the need to store .qm files in the repository.
Change-Id: I8ba36a1372c2a743b809e3f7ea95a67825558f41
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
It also fails for -no-feature-gui, but since the example depends on
QtWidgets, which implies depending on QtGui, we only check for
QtWidgets here.
Pick-to: 6.2 6.4
Change-Id: I777e540e6c2101ce8f08a5f80ba01b37ff858373
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Many applications offer shortcuts for quick interaction with the
application. It is also common in such applications to offer a shortcut
editor in the preferences or separately in a dialog.
However, even though this is a fairly common use case for applications
with more than a couple of shortcuts, there is no good and comprehensive
official Qt example how this could be achieved.
This change is an attempt to bridge the gap.
Change-Id: Ic01a404e6157bda1b0a75a0b792cbfe5d910d48f
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
The name of the variable that handles the qm file is qmlFile.
Change-Id: I873c73cd8f96ff821fe3d2e633e84fef8c687875
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace, with manual
unstaging of the actual definition and documentation in dist/,
src/corelib/doc/ and src/corelib/global/.
Task-number: QTBUG-99313
Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
None of these users require C++20 constexpr or C++23 noexcept, the
only remaining difference between std::exchange and qExchange.
This leaves a single qExchange() user, in QScopedValueRollback, that
requires the constexpr version, only available from C++20, and thus
remains unported.
Task-number: QTBUG-99313
Change-Id: Iea46f6ed61d6bd8a5b2fd9d9ec4d70c980b443a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The placeholder text was given its own QPalette color role in Qt 5.12,
but there has been no way to specify it from a Qt style sheet.
Fixes: QTBUG-93009
Change-Id: If58ca844c19c65b7eee14c6d5730a4ba27640c33
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
- Use qsizetype
- Use new string literals instead of deprecated QLatin1String()
- Streamline some code
- Remove unused member variable
- Remove module include
Pick-to: 6.4
Change-Id: Ia96424a23f3ae10e57db942de49949ce3aef8876
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The leak is just on termination, but we should show good practices in
our examples
Pick-to: 6.4 6.3 6.2
Change-Id: I39abb7545d3c68a1a537b865ba3fcb5e60c22fbf
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
popup() is generally better but it has a certain advantage that it does
not require a run loop to work, therefore platforms (like WASM) can use
it without resorting to extra measures (like asyncify).
Task-id: QTBUG-106389
Backport-to: 6.4 6.4.0
Change-Id: I87bde677f84048af82cc9aadd982284bdba41e69
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Also follow this best practice in testlib's own documentation and
examples.
Pick-to: 6.4
Change-Id: I8b57dfa8f88835adae8fceeb122a16635708e338
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Add documentation of usage of CBOR in convert and cbordump examples,
add a CBOR overview, and add links to them other places in the
documentation.
Task-number: QTBUG-85912
Change-Id: I518792db63647bf9ddd4507d8d4b7ef056192f82
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
And use the new overloads in examples and tests.
[ChangeLog][QtXml][QDomDocument] Deprecated the old setContent()
overloads in favor of the new ones that take ParseOptions and
ParseError.
Task-number: QTBUG-104507
Change-Id: I61b37eba2fe3002c03bddc90f6877676d539f7ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Changes the layout to QGridLayout and adds function to change widgets
position on the layout depending on the windows aspect ratio. Before
this the widgets wouldn't fit on screen when using the example on
Android in portrait.
Fixes: QTCREATORBUG-27685
Pick-to: 6.2 6.3 6.4
Change-Id: I00009cb6c8c250a8333ac3dfa635f70da4576d5e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Jani Korteniemi <jani.korteniemi@qt.io>
- Reorder the class declarations, moving private sections last
- Make constructors explicit
- Add space to the comments
- Introduce auto
- Replace slot MainWindow::showWindowTitle() by a direct
connection to slot QWidget::setWindowTitle().
Pick-to: 6.4 6.3
Change-Id: Ic229162434dfef5f2767d0b4e186759ca0f821f3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Adds scrolling to basic layouts example because the user interface in
the example doesn't fit properly on smaller screen sizes.
Fixes: QTCREATORBUG-27634
Pick-to: 6.2 6.3 6.4
Change-Id: I61e6eac2b28e5b3ff0f984894fe38167b3f46a9c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Markku Nokkala <markku.nokkala@qt.io>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
The find_package calls need to happen after we set INSTALL_EXAMPLEDIR
to ensure that INSTALL_EXAMPLEDIR is overridden if necessary.
Pick-to: 6.2 6.3 6.4
Task-number: QTBUG-102879
Change-Id: I3c2e6c5a68a8c6ff9b98b79dbd6c83445d8da052
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Used QGesture for this as per the gesture example.
Moved the help and info text to separate lines.
Enabled word wrap to prevent text going off screen.
As a drive-by, the code to center the window at a size that's a fraction
of the screen is replaced with a simple sizeHint() override. The user
should have control over placement, particularly now that it should be
placed manually onto a touchscreen if the user has one.
Done-with: Shawn Rutledge
Fixes: QTBUG-96702
Pick-to: 6.4
Change-Id: I8dba8b09bed474f585341e9a7a8c71fb60293eee
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This allows to fix the warning:
qtbase/examples/widgets/itemviews/addressbook/addresswidget.cpp:115:
warning: loop variable ‘str’ of type ‘const QString&’ binds to a
temporary constructed from type ‘const char* const’
[-Wrange-loop-construct]
Pick-to: 6.4
Change-Id: Ibbfa7f9e85fe9ef79291f9da3d161667286b282e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
We can achieve the same UI by using QMenu::addMenu() directly
Task-number: QTBUG-104857
Pick-to: 6.4 6.3 6.2
Change-Id: I627f21bc93646943cf6dfbd3b388352b84f73f0f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The commands qt6_add_executable and qt6_add_library both accept a list
of sources that get automatically added to the created target.
Extend qt6_add_plugin to also accept sources for consistency.
Fixes: QTBUG-104189
Change-Id: Iad5d8c5b31551663be155d068d55e770e1a91b27
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Found by codespell
Pick-to: 6.4
Change-Id: Ie3e301a23830c773a2e9aff487c702a223d246eb
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The example does not use OpenGL in Qt6 anymore so the dependency is not
necessary.
Change-Id: I6189a93eb65bd283ea7e85664582ab0b12a41639
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
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>
The example was refactored to use the PMF connection syntax.
However this introduced a problem: when connecting a QAbstractButton
to a slot that has a default parameter, the semantics of the connection
change between string-based connections and PMF.
Specifically: when connecting the
QAbstractButton::clicked(bool checked = false)
signal to a slot like
View::zoomIn(int level = 1)
then a string-based connection like
connect(button, SIGNAL(clicked()), this, SLOT(zoomIn()))
would call zoomIn without carrying the signal's parameter over.
In other words, zoomIn's parameter is defaulted. The same connection
using PFM instead is
connect(button, &QAbstractButton::clicked,
this, &View::zoomIn)
which would "connect" the arguments. This makes emissions that pass
false as clicked's parameter result in a zoomIn by 0.
Fix it by avoiding the default parameter of zoomIn -- just split
the function in two (zoomIn and zoomInBy).
Amends 8cf8122314.
Pick-to: 5.15 6.2 6.3
Fixes: QTBUG-100135
Done-with: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Change-Id: I10c150c648034449e3154140108de2d64326d965
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This makes sure that changes in the debug stream - like nospace() -
do not "leak". Also use the example snippet in QDebugStateSaver
documentation.
Pick-to: 6.2 6.3
Change-Id: I934976d2c7c2335abfec68c763526a5cbb0e6f1e
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
QPlatformTextureList holds a QRhiTexture instead of GLuint. A
QPlatformBackingStore now optionally can own a QRhi and a
QRhiSwapChain for the associated window. Non-GL rendering must use
this QRhi everywhere, whereas GL (QOpenGLWidget) can choose to still
rely on resource sharing between contexts. A widget tells that it
wants QRhi and the desired configuration in a new virtual function in
QWidgetPrivate returning a QPlatformBackingStoreRhiConfig. This is
evaluated (among a top-level's all children) upon create() before
creating the repaint manager and the QWidgetWindow.
In QOpenGLWidget what do request is obvious: it will request an
OpenGL-based QRhi. QQuickWidget (or a potential future QRhiWidget)
will be more interesting: it needs to honor the standard Qt Quick
env.vars. and QQuickWindow APIs (or, in whatever way the user
configured the QRhiWidget), and so will set up the config struct
accordingly.
In addition, the rhiconfig and surface type is (re)evaluated when
(re)parenting a widget to a new tlw. If needed, this will now trigger
a destroy - create on the tlw. This should be be safe to do in
setParent. When multiple child widgets report an enabled rhiconfig,
the first one (the first child encountered) wins. So e.g. attempting
to have a QOpenGLWidget and a Vulkan-based QQuickWidget in the same
top-level window will fail one of the widgets (it likely won't
render).
RasterGLSurface is no longer used by widgets. Rather, the appropriate
surface type is chosen.
The rhi support in the backingstore is usable without widgets as well.
To make rhiFlush() functional, one needs to call setRhiConfig() after
creating the QBackingStore. (like QWidget does to top-level windows)
Most of the QT_NO_OPENGL ifdefs are eliminated all over the place.
Everything with QRhi is unconditional code at compile time, except the
actual initialization.
Having to plumb the widget tlw's shareContext (or, now, the QRhi)
through QWindowPrivate is no longer needed. The old approach does not
scale: to implement composeAndFlush (now rhiFlush) we need more than
just a QRhi object, and this way we no longer pollute everything
starting from the widget level (QWidget's topextra -> QWidgetWindow ->
QWindowPrivate) just to send data around.
The BackingStoreOpenGLSupport interface and the QtGui - QtOpenGL split
is all gone. Instead, there is a QBackingStoreDefaultCompositor in
QtGui which is what the default implementations of composeAndFlush and
toTexture call. (overriding composeAndFlush and co. f.ex. in eglfs
should continue working mostly as-is, apart from adapting to the
texture list changes and getting the native OpenGL texture id out of
the QRhiTexture)
As QQuickWidget is way too complicated to just port as-is, an rhi
manual test (rhiwidget) is introduced as a first step, in ordewr to
exercise a simple, custom render-to-texture widget that does something
using a (not necessarily OpenGL-backed) QRhi and acts as fully
functional QWidget (modeled after QOpenGLWidget). This can also form
the foundation of a potential future QRhiWidget.
It is also possible to force the QRhi-based flushing always,
regardless of the presence of render-to-texture widgets. To exercise
this, set the env.var. QT_WIDGETS_RHI=1. This picks a
platform-specific default, and can be overridden with
QT_WIDGETS_RHI_BACKEND. (in sync with Qt Quick) This can eventually be
extended to query the platform plugin as well to check if the platform
plugin prefers to always do flushes with a 3D API.
QOpenGLWidget should work like before from the user's perspective, while
internally it has to do some things differently to play nice and prevent
regressions with the new rendering architecture. To exercise this
better, the qopenglwidget example gets a new tab-based view (that could
perhaps replace the example's main window later on?). The openglwidget
manual test is made compatible with Qt 6, and gets a counterpart in form
of the dockedopenglwidget manual test, which is a modified version of
the cube example that features dock widgets. This is relevant in
particular because render-to-texture widgets within a QDockWidget has
its own specific quirks, with logic taking this into account, hence
testing is essential.
For existing applications there are two important consequences with
this patch in place:
- Once the rhi-based composition is enabled, it stays active for the
lifetime of the top-level window.
- Dynamically creating and parenting the first render-to-texture
widget to an already created tlw will destroy and recreate the tlw
(and the underlying window). The visible effects of this depend on the
platform. (e.g. the window may disappear and reappear on some,
whereas with other windowing systems it is not noticeable at all -
this is not really different from similar situtions with reparenting
or when moving windows between screens, so should be acceptable in
practice)
- On iOS raster windows are flushed with Metal (and rhi) from now on
(previously this was through OpenGL by making flush() call
composeAndFlush().
Change-Id: Id05bd0f7a26fa845f8b7ad8eedda3b0e78ab7a4e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
We want to mark the corresponding QColor ctor(s) explicit.
Use Qt::GlobalColor or the new QColor::fromString() instead.
Change-Id: I68bf75a094e6821b97682de5a0ffd975834d22d0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
And also remove check for DtlsV1_2OrGreater for negotiated
session protocol, since it must have been resolved to a specific
protocol by this point.
Fixes: QTBUG-100154
Pick-to: 6.3 6.2
Change-Id: I3aec31faed8b9cb22be0062da057c62864eba34f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
[ChangeLog][Potentially Source-Incompatible Changes] The qtextstream
header no longer includes <QString>, <QStringEncoder> and
<QStringDecoder>. Code which relied on the implicit inclusion of those
classes might now need to include the headers explicitly.
Task-number: QTBUG-97601
Change-Id: Ifb8c8452026195a772c0588dbbbc53fb51cac548
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Update to use Qt Creator 7.0 and CMake as the build system.
Fixes: QTBUG-100075
Pick-to: 6.3
Change-Id: I71e1d1446a2c79c98423ca5d4427b4b4eb00021b
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
This makes the code clearer and decouples it from the
GLWidget.
As a drive-by, add a global shortcut to close.
Pick-to: 6.3 6.2
Change-Id: I3469d29bc367acc17c5f8acf9d46219259b8315b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
CMAKE_INCLUDE_CURRENT_DIR is not necessary anymore for moc since
CMake 3.8: https://cmake.org/cmake/help/latest/release/3.8.html#other-changes
CMAKE_AUTORCC should not be used anymore. Instead, we now use
qt_add_resources() or similar
Enable CMAKE_AUTOUIC only if .ui files are present.
Pick-to: 6.3
Task-number: QTBUG-87643
Change-Id: I835e2994cd5dba9918136999499b9077961b616c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Since by default QStyleOptionProgressBar is initialized with initialize
QStyle::State_Horizontal, the example shouldn't overwrite the state, and
instead OR other states into it. Otherwise, the progressbar will be laid
out vertically.
Pick-to: 6.2 6.3
Fixes: QTBUG-100067
Change-Id: Ibebda48a297af4a621719673033f8199b8bc7984
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
It seems not needed anymore with modern toolchains.
Pick-to: 6.3
Change-Id: Ic5386cad4576b10f49fd74212f3514e26cfb0abe
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Both are FALSE by default, so no point in explicitly setting
them to FALSE.
In addition, dbus/listnames is a command line tool. No reason
to set WIN32_EXECUTABLE, MACOSX_BUNDLE here.
Pick-to: 6.3
Change-Id: I99aaf27a0267c5575bd2ee5b6183991fce721f44
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Building the example when not on android makes little
sense. Therefore just error out in this case.
Pick-to: 6.3
Change-Id: Ib7325156bcd8ffd1b9b3e67174d878f5731a4a4f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
It was accidentally reverted as part of a different change.
Amends 3c1125d9fe
Pick-to: 6.2 6.3
Task-number: QTBUG-90820
Change-Id: Id9b2650c7c42fd9f401cd2da3fcd60ed4d39d212
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Also consolidate several find_package(Qt6 ...) calls in one call.
Task-number: QTBUG-98867
Change-Id: Idfd5e71f46d4489fac7411cbfadb84437a0658f3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We can expect that users use Qt 6 to try out Qt 6 examples.
Pick-to: 6.2
Change-Id: Ifa7bd9471a712fa1d63107b7ff2d392b7aefdcfe
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
These are left-overs from the initial qmake2cmake conversion.
Pick-to: 6.2
Change-Id: Ie15c9ff022ea4566d10c1ba74599de9af83d29a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Apparently this code is needed on other platforms now, not only macOS.
Pick-to: 6.2
Fixes: QTBUG-98504
Change-Id: Ie0a7e38609e8fc8c11915784dd3652a3517bb639
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
And mention the example in the bindable properties docs.
Pick-to: 6.2
Task-number: QTBUG-97655
Change-Id: I676e90dbda66c2e718c7f6c2240fac608a8653df
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Added two examples for modeling a subscription service: signal/slot
connection-based and bindable property-based. The examples are based
on the example from Fabian's Qt WS talk about the bindable properties.
Pick-to: 6.2
Task-number: QTBUG-97655
Change-Id: I0345913b8b6e5c40b8477e128d36483598bdfcaa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Instead of including <QIODevice>, use the correct 'nested name
specifier', QIODeviceBase.
Amends 8bd0a09475.
Pick-to: 6.2
Change-Id: I077948b33f985cd4a2e3a9e591645cf20d7af91c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Says GCC:
qtbase/examples/network/multistreamclient/timeconsumer.cpp:85:37: error: incomplete type ‘QIODevice’ used in nested name specifier
85 | QDataStream ds(&buf, QIODevice::WriteOnly);
| ^~~~~~~~~
Instead of including <QIODevice>, use the correct 'nested name
specifier', QIODeviceBase.
Pick-to: 6.2
Change-Id: Id8d87dbcb497e4feca1d5d3ce6b1bdb9da5c0dab
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Although the QBackingStore constructor takes a QWindow* as a parameter,
it does not inherit QObject and doesn't become a QObject child of the
QWindow. Use QScopedPointer to avoid memory leaks.
Pick-to: 6.2
Change-Id: Ib065163a9149d002f8220a0257bd78549062c595
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
targetSquare judges which square the position falls in. The point
scaling calculation method should not be used. The return value of
QPoint operator/ will be rounded up. Modified to separate the x and
y of position to calculate.
Fixes: QTBUG-81842
Change-Id: I70375185a78ba47efe01be3fd490e0fb0f456e17
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
All nodes in the view were at the top level due to a spurious trimmed()
call.
The condition in the indentation calculation was flipped, leading to a
segfault. Also, the input data does not contain tabs. Remove the
condition that checks for tabs altogether.
This amends commit 3fede6cb54.
Fixes: QTBUG-97727
Pick-to: 6.2 5.15
Change-Id: Ic5068ead755c4dae5f0607724ac7704cce03227c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
- Use member initialization
- Remove C-style casts
- Add space around operators
- Use qsizetype for list indexes
- Remove commented out debugging code
Task-number: QTBUG-97095
Pick-to: 6.2
Change-Id: I11a17fa6e7f17968367a57291d83ee6fba731a34
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
[ChangeLog][QtGui][CSS] The background-color style can now be applied to
<hr/> to set the rule color.
Task-number: QTBUG-74342
Change-Id: Ib960ce4d38caa225f258b6d228fb794cef43e1b7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Qt requires a compiler that support C++17 thus __cplusplus
is always 201703L or higher. This patch removes checks
for __cplusplus value that always succeed.
Change-Id: I4b830683ecefab8f913d8b09604086d53209d2e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This file was necessary for the qmake build and the CI. The qmake
build is history, and the CI does now read .cmake.conf (see
QTQAINFRA-4392).
In addition to being superfluous, the existence of .qmake.conf
triggers QTBUG-76140 when building Qt examples with qmake. Removing
the file alleviates the symptoms of this bug.
"Interestingly", to make the qmake build of examples work in the CI, we
have to adjust the dbus examples to not use nmake inference rules. The
absence of .qmake.conf results in a different order of inference rules
in the Makefile, and nmake/jom pick up generated source files from the
source dir. These are incompatible with the correct generated source
files in the build dir. See QTBUG-96513 for details.
Fixes: QTBUG-92271
Task-number: QTBUG-96513
Change-Id: I4076fae2eeb993956b54aced2c9c844ae2577a4a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
In the effort of repairing broken links as per QTBUG-96127,
a series of RFC links referring to `tools.ietf.org/html/*` were modified
to point to the new address that the site redirected to.
To simplify executing a similar task and to diminish the duplication of
manually inserted urls, the already existing `rfc.qdoc` file, containing
`\externalpage` commands directing to RFC locations, was enhanced with
links to all RFCs that were mentioned in the current documentation, so
as to aggregate this common category of links.
All links pointing to a `ietf` domain inside QDoc documentation blocks
were then changed to use the newly provided external-references.
Task-number: QTBUG-96127
Pick-to: 6.2
Change-Id: I2a52eb6aa8c9e346f64ef1a627b039220d9f6c2a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Both 'First name' and 'Last name' are two words, therefore
the column names should be spelled 'FirstName' and 'LastName'.
Fixes: QTBUG-96123
Change-Id: Iaf58442eba0bc5eb63dcde83ecdebdc4a3c658a5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Replace the “size() / devicePixelRatio()” pattern with
a call to deviceIndependentSize().
Change-Id: I9d9359e80b9e6643e7395028cd43e3261d449ae7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Previously we only created object library static plugin initializers
for Qt plugins only, not user-project plugins.
The reason was that if a user tried to install the plugin target via
an export set, CMake would error out saying that the _init library is
not part of the same export set.
Introduce an OUTPUT_TARGETS option that would allow projects to get
the name of the generated _init target, so they can install it if
needed.
This was already done for qt6_add_qml_module, so we just introduce the
same option for qt6_add_plugin.
Now user static plugins will have an _init target created, which will
be propagated to consumers whenever the consumers link against the
plugin itself.
We also need an internal option to disable this propagation, because
it's handled a bit differently for Qt plugins which can be linked
either via finalizers or via usage requirements.
Amends 91c65dd80c
As a result of the implementation change, cleanup example projects
to ensure that they build successfully (the important part is
specifying the CLASS_NAME).
Only plugandpaint works properly with both shared and static Qt
builds.
echoplugin works with a shared Qt build, but not a static one due to
some assumptions in the C++ code about shared plugins.
styleplugin doesn't seem to work properly neither with shared Qt
builds nor static Qt builds, at least on macOS. But it builds fine.
For some reason even if the plugin is found, the style is not applied.
Amends 4caac1feea
Pick-to: 6.2
Task-number: QTBUG-80863
Task-number: QTBUG-92933
Change-Id: I6f631cda9566229b7a63992b23d7d7fa50303eeb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Pick-to: 6.2
Task-number: QTBUG-94407
Change-Id: Ie9c05dbe498cd372c015b5125e6cb8d59ca96b59
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The former is QT_DEPRECATED_SINCE(6, 4).
Change-Id: I9e60639651b0832f1e3d3282d15dd0ab0b22d819
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Outside tests, all in-tree callers of QObject::findChildren() pass no
name to match, and in my experience that is also true for the vast
majority of out-of-tree users.
Avoid the temporary QString creation in the caller and the repeated
QString::isNull() checks in the implementation by overloading
findChildren() without a name argument and checking for name.isNull()
only once, forking off into separate helper functions.
Adjust in-tree callers that used an explicit `QString()` argument in
order to pass options, which goes to show that `name` should never
have been the first argument of findChilden() in the first place, even
though I appreciate the symmetry with findChild() (the use-cases of
which, however, are radically different).
Change a `findChildren().size() == 0` call found while scanning for
findChildren() calls to `!findChild()` as a drive-by.
Modernize loops in the various qt_qFindChild{,ren}_helper() overloads
to match how the new code looks.
[ChangeLog][QtCore][QObject] Added findChildren() overload taking no
name (thus optimizing this common case).
Change-Id: Ifc56e5438023d079b40c67f11ae274a3e128ad5e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Since Ministro no longer work on recent Android versions (Android 8+),
and it hasn't been maintained and the repos are not updated, the
existing code is practically a dead code.
[ChangeLog][Android] Remove ministro code since it's been unmaintained
and not working with recent Android versions.
Task-number: QTBUG-85201
Pick-to: 6.2
Change-Id: I18d7b1e209cba3cfd04674060e9bf39aa5a5510f
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
If we don't find it we can't link to it, and then the example will never
have any print functionality, in spite of having the UI.
Pick-to: 6.2
Change-Id: Ib84be39a2655253c7d643520487adee054d5bd2d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Refactor android notification example to fit in qtbase. The example
demonstrates how to use JNI and work with Java APIs and add custom
Java code to a Qt app targeting Android.
Task-number: QTBUG-84382
Change-Id: I5fcbbf77b36eb47a0acaa13835ef3d773e63885c
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
- Set a fixed font on text edits so that parentheses stand out
- Rearrange the layout to have the text at the top be prevent
long texts from being wrapped
- Add a replacement field where one can exercise replacement
with the \1, \2... placeholders.
Pick-to: 6.1
Change-Id: I140a62e1fb2cd1c6bfe02a2f01b7f06a6f3b5eb2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Examples are intended to show how to build against an installed Qt.
Building them as part of the main build means the way the Qt targets
are defined and created are not representative of an end user's build.
By building them as separate projects using ExternalProject, we can
more closely replicate the intended audience's environment. This
should allow us to catch more problems earlier.
Having examples built as part of the main build also creates problems
with some static builds where a tool built by the main build is needed
during configure time. This happens with other repos like qtdeclarative
but not (currently) with qtbase. Converting the examples in qtbase to
be built using ExternalProject is intended as a demonstrator for how
other repos can do similar. Until other repos are converted, they will
continue to work as they did before, with examples as part of the main
build for non-static builds only.
The new build-externally behavior is only supported for non-prefix
builds with this change. Prefix builds will continue to use the old
non-external method. Support for building examples externally in
prefix builds will be a separate change.
Task-number: QTBUG-90820
Fixes: QTBUG-91068
Change-Id: I2304329940568dbdb7da18d54d5595ea7d8668bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
- Remove misleading note about setCentralWidget()
- Connect copy/paste and undo/redo directly to the QTextEdit instead
of routing them via window
- Add the missing "About" menu
- Check for reject of QFileDialog
Change-Id: Ia7457fbedd762028bf2bcde99dfcfb50bbc97f1d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
The BASE argument of qt_add_resources now denotes the root point of the
alias of the file. Before, BASE was merely prepended to every file that
got passed to qt_add_resources.
Old behavior:
qt_add_resources(app "images"
PREFIX "/"
BASE "../shared"
FILES "images/button.png")
Alias is "../shared/images/button.png", and pro2cmake generated
QT_RESOURCE_ALIAS assignments to fix this.
New behavior:
qt_add_resources(app "images"
PREFIX "/"
BASE "../shared"
FILES "../shared/images/button.png")
The alias is "images/button.png". No extra QT_RESOURCE_ALIAS assignment
is needed.
The new behavior is in effect for user projects and for Qt repositories
that define QT_USE_FIXED_QT_ADD_RESOURCE_BASE. Qt repositories will be
ported one by one to this new behavior. Then the old code path can be
removed.
Pick-to: 6.1
Task-number: QTBUG-86726
Change-Id: Ib895edd4df8e97b54badadd9a1c34408beff131f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
- Use initializer lists
- Use u instead of QLatin1String()
- Fix some clang warnings about else after return, constFirst()
- Streamline code
- Remove slot TextEdit::printPreview() which is not needed
- Rename variable fileName to pdfFileName in filePrintPdf()
to disambiguate from this->fileName
Pick-to: 6.1
Change-Id: I377ebfd13487470b6f8eaf568dd5d99354f761f2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Since commit f5c69a5195 the examples/widgets/painting examples could
not be built standalone anymore.
Move the find_package calls out of the examples/widgets/painting/shared
subdirectory and add a .cmake file that can be included to use the
library conveniently.
Change-Id: I35cb5bd8419a67c782d109104c4a88d64477a8be
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Also add a feature to the textedit example to set this value.
[ChangeLog][QtGui][CSS] The CSS text-decoration-color attribute is now
supported in rich text spans with underlines, overlines and strikethrough.
Fixes: QTBUG-82114
Task-number: QTBUG-39617
Change-Id: I0065cb5431833da55b0f503ce7ff2b83b74b718a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Move the project prelude to
examples/widgets/tools/plugandpaint/CMakeLists.txt
to mark it as the entry point of the example project.
Remove the project prelude from all its subdirectories, because the
subdirs are not supposed to be built separately.
Remove the wrong code that pro2cmake generated for the application's
project file. That merely tried to link the basictools static plugin.
Move common initialization code (CMAKE_AUTO*, INSTALL_EXAMPLESDIR) to
the top-level plugandpaint project file.
Remove superfluous CMAKE_INCLUDE_CURRENT_DIR.
Set the output directory of the extrafilters plugin to the application's
build directory such that the app can find the plugin without having to
install the example.
Skip regeneration in those files, to avoid scattering the project files
with special case markers.
Fixes: QTBUG-87449
Fixes: QTBUG-91066
Change-Id: I3ceb08f5fcda1ffea3c35cee8580f7b5e4ecfc1f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Added branching to plugandpaint example to get correct library
architecture to the build
Fixes: QTBUG-56322
Pick-to: 5.15
Change-Id: I4d0eb4e24681642991d08c3dd2bad73d10caf962
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
- Start in root folder so that large directories (/bin/, Windows)
are easily reachable
- Remove the line edit and navigate by double clicking instead
since this is more in line with expectations
- Use a QPlainTextEdit for logging
- Make the log message more informative
- Add icons
Change-Id: Ia3cd7fc143efef80772923291f0b711913aa47be
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
After 7a738daa97 we require
QLineF::setLength() to take a finite length, and this code was probably
always risky when HoverPoints has two points that are both 0,0.
It's probably a transient condition anyway.
Fixes: QTBUG-92908
Change-Id: If81122d2f78761026b0d656ceffe173132751317
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The call assumes two arguments for QString::arg, but only one was passed.
The error string became a buttontext argument, which is clearly wrong.
Task-number: QTBUG-92483
Change-Id: I1fab5be88331f636185693b721f0d9688c0d9ff3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
It was originally marked \obsolete without any comment on what was to
be used to replace it, or deprecation markings in the declaration, so
it got missed at 6.0. More recently it's been deprecated in favor of a
territory-based name; but actually it was obsoleted by (iterating the
territory() of each return from) matchingLocales() in Qt 4.8.
So back out of adding territoriesForLanguage to replace it and,
instead, mark it as deprecated in the declaration, in favor of
matchingLocales(). Also rewrite the implementation to be exactly that
replacement. Rewrote the one example using it.
Fixes: QTBUG-92484
Change-Id: Iedaf30378446dd9adac5128b7ee5fee48aab1636
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The use of "Country" is misleading as some entries in the enumeration
are not countries (eg, HongKong), for all that most are. The Unicode
Consortium's Common Locale Data Repository (CLDR, from which QLocale's
data is taken) calls these territories, so introduce territory-based
names and prepare to deprecate the country-based ones in due course.
[ChangeLog][QtCore][QLocale] QLocale now has Territory as an alias for
its Country enumeration, and associated territory-based names to match
its country-named methods, to better match the usage in relevant
standards. The country-based names shall in due course be deprecated
in favor of the territory-based names.
Fixes: QTBUG-91686
Change-Id: Ia1ae1ad7323867016186fb775c9600cd5113aa42
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The example refines the image by running a number of passes
with increasing number of iterations, which is not really
visible to the user. Set an informational text string on
the generated image which provides this information
along with the elapsed time.
The idea is to do the same to the corresponding
Qt for Python example to have some sort of speed comparison
for number crunching.
Add a command line option for the number of passes.
Make the window a bit larger to accommodate the
information.
Change-Id: I2afc1009ab53b580123d82a6aa645d9ffaa63ea2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
The example crashed since it passed the font label text (which
receives the font key) to the QFont constructor taking the family list.
Use QFont::fromString() instead.
Pick-to: 6.0 6.1
Change-Id: I499fc9200b4d817b10c946a7b79ede4e7f7e69af
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
The rowCount method has been fixed to correctly pass the "Common error
test #3: the second column should NOT have the same children".
It also fixes the model being leaked.
Fixes: QTBUG-92178
Pick-to: 5.15
Change-Id: If92973e6f83ea9a2715bd335269f6e50d80f52c6
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Commit 21d3916817 added the 64-bit
version, so qsizetype now works cross-platform. The casts were added to
make qtbase compile on commit df853fed66.
Change-Id: I26b8286f61534f88b649fffd166c409c5c232230
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
- Fix the save as file dialog being in "Open" mode by setting
acceptMode
- Fix clazy warnings about detaching QList by using constFirst()
- Fix clazy warning about passing a context to slot connection
Pick-to: 6.0 6.1 5.15
Change-Id: I0c800e9829e118fcec477322aa2a13660e3b51d2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The ui_XXX.h include did not match the location of the XXX.ui file, and
AUTOUIC failed with
"SRC:/addtorrentdialog.h"
includes the uic file "ui_addtorrentform.h",
but the user interface file "addtorrentform.ui"
could not be found in the following directories
"SRC:"
While this could be fixed by adjusting the include paths properly, this
would complicate the CMake project file, and we're dealing with an
example where needless complexity would cloud comprehensibility.
Move the .ui file next to corresponding source files instead.
This removes the need for any special cases in CMakeLists.txt, and we
can remove .prev_CMakeLists.txt.
Fixes: QTBUG-87457
Pick-to: 6.1
Change-Id: Ic2dec5ded7100e22d5afc571efc4b009bc62e41c
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
They cannot be built due to QTBUG-91033.
Task-number: QTBUG-91033
Fixes: QTBUG-88758
Pick-to: 5.15
Change-Id: I6f75cac1b20208c7813addd1ebe578c9edae295a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Per the discussion of QTBUG-88831, we determined that module-wide
imports are unfortunate, especially for compile times. Following this,
all QtDBus includes have been replaced with the headers for the classes
actually used in each file. Additionally, some cleanup of header file
order and format has been performed in the changed files.
Pick-to: 6.0
Change-Id: I62c1b75682a48422f0ba1168dd5d7bd0952808ac
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Existing background image was not displayed correctly due to scaling
(see the description in related Jira task).
This commit increases the thickness of the lines, so that the grid
is displayed correctly
Task-number: QTBUG-89896
Pick-to: 6.0 5.15
Change-Id: Iaa8218a5e9852adbc40715e86862ac3b34e1fbec
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Complete search and replace of QtTest and QtTest/QtTest with QTest, as
QtTest includes the whole module. Replace all such instances with
correct header includes. See Jira task for more discussion.
Fixes: QTBUG-88831
Change-Id: I981cfae18a1cabcabcabee376016b086d9d01f44
Pick-to: 6.0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Provide execution context to QFuture continuations, instead of using
QMetaObject::invokeMethod calls for running in the main thread.
Change-Id: Ica7de19494065d677ffc94224781bfbe292b4f21
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Not much information in a bug report: QByteArray is protected from negative
sizes and QUdpSocket too. FWIW - add one more check, similar to what
the server counterpart already had.
Pick-to: 5.15 6.0
Fixes: QTBUG-83457
Change-Id: I585fa90e0a258d2257e4fed2f24c52b47548bcbb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The documentation on High DPI was recently rewritten, renaming
several sections. This patch fixes the links which were broken
by this change.
Task-number: QTBUG-88533
Pick-to: 6.0
Change-Id: I5e9417554270a6740986d7cec5e3433d043e5560
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Similar to what has been done in 5138a970f3, we need to adjust the
remotecontrolledcar/controller dbus example to be built with qmake.
In the CI we first build the examples with CMake in the source
directory. That creates some generated source files in the dbus example
dir.
Then, the examples are (will be) built ouf of source with qmake, and
those generated source files will be placed in the build directory.
When building with MSVC, there's a peculiarity with nmake/jom's
inference rules that lead to picking up the generated car_interface.cpp
from the source directory, instead of the build directory.
See QTBUG-13496 for details.
car_interface.cpp, built with CMake is generated to include
car_interface.moc.
car_interface.cpp, built with qmake does not have this include, but the
build system calls moc on car_interface.h.
All this leads to duplication of the meta object for
OrgExampleExamplesCarInterfaceInterface, preventing successful linking.
Work around this issue by turning off the generation of nmake/jom
inference rules.
Task-number: QTBUG-85986
Change-Id: I0a6ca9f880b63f05a4e9f2032e44d3b391d8a756
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Prefix it with "Qt Widgets -" to make it a bit clearer in the list of
highlighted examples which module this one is about.
Pick-to: 6.0 6.0.0
Change-Id: I0bf65b02db72173f1adfe0bcf8657be7905dbd6c
Reviewed-by: Tuukka Turunen <tuukka.turunen@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
In order to demonstrate the new functionality, changed the example to
download the images from the network, scale and show them by attaching
different continuations to QFuture. Because QtConcurrent::map is not
used anymore, removed the suspension functionality (supporting
suspension of download would complicate the logic).
Task-number: QTBUG-87205
Change-Id: I5a48b63195d28025ae8c5de28bc6d6178dad03db
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
- Exclude forwarding headers to Qt GUI as they caused the headers
to be parsed twice.
- Drop documentation for removed example
Task-number: QTBUG-86295
Change-Id: I08eb46b7c7f813f103cc545f931896be99a3ccec
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
MarkdownDialectGitHub now includes this feature, so *emph* is italicized
and _emph_ is underlined. This is a better fit for QTextDocument capabilities;
until now, _underlined_ markdown could be read, but would be rendered with
italics, because in CommonMark, *emphasis* and _emphasis_ are the same.
But QTextMarkdownWriter already writes underlining and italics distinctly
in this way.
[ChangeLog][QtGui][Text] By default (with MarkdownDialectGitHub), markdown
_underline_ and *italic* text styles are now distinct.
Fixes: QTBUG-84429
Change-Id: Ifc6defa4852abe831949baa4ce28bae5f1a82265
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Remove or fix references to removed APIs, and some qdoc syntax fixes.
Change-Id: I67d71062cd7a29f4eb74b02199b1482af5e59fc0
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This makes it feature comparable with QAction, and makes it possible
to use as a backend for QAction, and fixes a few missing alternative
keybindings in qtwidgets.
Change-Id: Iaefc630b96c4743fc5ef429dc841870ddd99fc64
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
All QFontDatabase APIs are static, use them accordingly.
Task-number: QTBUG-88114
Change-Id: I0e4a7508646037e6e2812611262eed8b6d7ad3de
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
If the mime data includes text/markdown, display it decoded in the QLabel,
and also display the raw markdown in the table below. QLabel supports
markdown since 51cbd5288c.
Ideally we should add proper support for markdown to QMimeData, but
it's too late to do that for Qt 5.
Pick-to: 5.15
Change-Id: I2a9998e4b239658fe49f39786e7c4fdd0c08b21a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
- Remove the casting operator of QFuture<T> to T. It calls
QFuture::result(), which may lead to undefined behavior if the user
has moved the results from QFuture via QFuture::takeResult() before
trying to do the conversion.
- Disable implicit conversion of QFuture<T> to QFuture<void>, by making
the constructor explicit. If the users really intend to do the
conversion, they should do it explicitly.
[ChangeLog][Source-Incompatible Changes][QFuture] Implicit conversions
of QFuture<T> to T and to QFuture<void> have been disabled. Use
QFuture::result() or QFuture::takeResult() where you need to convert
QFuture<T> to T. Use the explicit QFuture<void>(const QFuture<T> &)
constructor to convert QFuture<T> to QFuture<void>.
Change-Id: I153d4137d36365b1611ac934fb3ac2eb667fdd6c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
- Fix linking to CMake manual.
- Remove references to the state machine framework.
Task-number: QTBUG-86295
Change-Id: I01a61088da8eb36760949f39be5e71d92de956f2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
- Extended the documentation talking about it
- Initialize members in the header rather than in the ctor
- Some formatting changes
- Prefer connect-ing to QNetworkReply rather than QNAM for sslErrors
- Because we didn't use the QNetworkReply* argument
- Put the QNetworkReply pointer in a managed pointer
- Removed the code explicitly handling a redirect (it's the new default)
- Edited HttpWindow::httpFinished so that there're less places to reset
the reply pointer
- Updated some ifdefs I didn't update when I was revamping this example
3 years ago
Task-number: QTBUG-87306
Change-Id: I10a6f756c09908f199ac9c61e28b49625af10105
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The examples use an intermediate object library to avoid duplicate
file compilation. The examples worked when built as part of Qt
because the shared directory was always added, and Qt::OpenGL is
available implicitly.
Change each project to add_subdirectory(../shared) if the object
library is not available, thus making the examples build as standalone
projects.
Call find_package inside the shared project, to ensure the Qt packages
are found.
Create an alias called 'painting_shared::painting_shared' and link
against that to ensure that any failure is caught at configure time
rather than build time.
Adapt the pathstroke example to use the object library.
Comment out the code for the OpenGL scopes, because it's handled
by the object library.
Make sure the OpenGL dependency is public.
Make sure to run moc and compile the OpenGL specific files as well.
Task-number: QTBUG-87444
Change-Id: Ib0ecb68948581c5267ca04f19d8043fa44ff3d54
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
As well as the MACOSX_BUNDLE properties as necessary.
Task-number: QTBUG-87664
Task-number: QTBUG-86827
Change-Id: I7677449a26d51fa853bd67bab6b3b61afbd2b12f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
- Add a clear button to the line edit
- Indicate invalid regular expressions
Change-Id: I1dbeaa0f9168224ccb9134c0c1fe281da14dcbce
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
We have never had enough examples that show how easy it is to install
a QScroller. In this case, one line makes a QTreeView flickable.
Pick-to: 5.15
Task-number: QTBUG-86090
Change-Id: Idb8b4709617befb261f3b78d63ddbdaf5ad18d6b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Use QScreen APIs instead.
Change-Id: Ie99af94fe4292223dbb165b3f5c1b74e8fe0498b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This time based on grepping to also include documentation, tests and
examples previously missed by the automatic tool.
Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
We were already using the 'native' nomenclature when referring to these
kinds of APIs, e.g. when talking about native handles, or the existing
QPlatformNativeInterface on a QPA level. Using 'native' for the user
facing APIs also distinguishes them from the 'platform' backend layer
in QPA and elsewhere.
Change-Id: I0f3273265904f0f19c0b6d62471f8820d3c3232e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Try to get rid of APIs that use raw 'const {char, QChar} *, length'
pairs. Instead, use QByteArrayView or QStringView.
As QStringConverter is a new class, simply change the API to what we'd like
to have. Also adjust hidden API in QStringBuilder and friends.
Change-Id: I897d47f63a7b965f5574a1e51da64147f9e981f6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Clean up the state of the projects,
before changing the internal CMake API function names.
Task-number: QTBUG-86815
Change-Id: I90f1b21b8ae4439a4a293872c3bb728dab44a50d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
It is lossy, so should be requested explicitly, using a dedicated
fromPixmap factory function.
Deprecate the constructor and assignment operator, and make the
constructor explicit.
[ChangeLog][QtGui][QBitmap] Implicitly constructing and assigning
to a QBitmap from a QPixmap has been deprecated, and the respective
constructor has been made explicit. Use the fromPixmap factory
function instead.
Change-Id: I68ce85b26c901415137b664a1db687021d48bae0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Undeclared identifier ssize_t etc. Just use int. Not like we can have
more than a handful of physical devices anyway.
Change-Id: Ie1fb7ab9794a7d39e84db864c2be6dbdd5d97f50
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Fix our API, so that QStringList and QList<QString> are the
same thing.
This required a bit of refactoring in QList and moving the
indexOf(), lastIndexOf() and contains() method into
QListSpecialMethods. In addition, we need to ensure that
the QStringList(const QString&) constructor is still available
for compatibility with Qt 5.
Once those two are done, all methods in QStringList can be moved
into QListSpecialMethods<QString>.
Change-Id: Ib8afbf5b6d9df4d0d47051252233506f62335fa3
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
As per ### Qt6 comment. Also rename the LibraryLocation enum
to LibraryPath.
Change-Id: I556025a19c5bcdf2ff52598eaba32269522d4128
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Merging QAbstractPrintDialog with QPrintDialog, as proposed in the
removed comment, seems to have little value, given that the platform
specific implementations rely on the current abstraction.
Adjust examples and tests; with the QAbstractPrintDialog test now
testing the QPrintDialog::options API, the corresponding test function
can be removed from the QPrinter test.
Change-Id: Ia8906627898332e8590ea9b27e3d71dfcc6e8d71
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The qdoc-file that contains the example documentation was
left behind when the OpenGL code moved from QtGui
to QtOpenGL. This causes all the snippet commands to fail.
Task-number: QTBUG-74409
Change-Id: I86a753d4fc832965e76a085062882e6c720becd2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Address a ### Qt6 comment from change
283008e123, and start using
QStyledItemDelegate in more places, so those get proper
look and feel.
Change-Id: I39767ba99b7942faada1fba0ac241deb35563b63
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Instead of QCoreApplication::quit() directly calling exit(0), which would
leave QGuiApplication and client code out of the loop, we now send the
Quit event, and let it pass through event delivery, before finally ending
up in QCoreApplication::event(), where we call exit(0).
This has the advantage that QGuiApplication can ensure all windows are
closed before quitting, and if any of those windows ignore the close
event the quit will be aborted. This aligns the behavior of synthetic
quits via QCoreApplication::quit() with spontaneous quits from the
platform via QGuiApplicationPrivate::processApplicationTermination.
Clients who wish to exit the application without any event delivery or
potential user interaction can call the lower level exit() function
directly.
[ChangeLog][QtGui] Application termination via qApp->quit() will now
deliver Quit events to the application, which in turn will result in
application windows being closed as part of the application quit,
with an option to cancel the application quit by ignoring the close
event. Clients who explicitly want to exit the application without
any user interaction should call QCoreApplication::exit() explicitly.
Task-number: QTBUG-45262
Task-number: QTBUG-33235
Task-number: QTBUG-72013
Task-number: QTBUG-59782
Change-Id: Id4b3907e329b9ecfd936fe9a5f8a70cb66b76bb7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Adjusting the QPrinter test case - some use cases no longer exist, or are
already tested in QPageSize and QPageLayout tests.
Adjust examples and manual tests.
Change-Id: I01cbc65f3d8031aea2dac86dd942126ba708b111
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
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>
With the Qt6 compatibility break, it can finally be removed.
Closing windows (which might quit the application with
quitOnLastWindowClosed() true, the default) acted contrary to the
documentation of the commitDataRequest() signal, which could have
been a hint.
This removes the workaround API from the fix for QTBUG-49667 and
also removes the problematic feature that it worked around.
Change-Id: I672be58864ef062df7fb7f2a81658b92c4feedd2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
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>
viewOptions returned a QStyleOptionViewItem object. Such a method
can never support newer versions of the option structure.
Most styleable QWidget classes provide a virtual method
initStyleOption that initializes the option object passed in as a
pointer, e.g QFrame, QAbstractSpinBox, or QComboBox.
Follow that API convention, but name it initViewItemOption, as the
QStyleOptionViewItem struct contains information about the item as
well as the widget itelf.
This is a source incompatible change that will go unnoticed unless
existing subclasses mark their overrides as 'override', or call
the removed QAbstractItemView::viewOption virtual function.
[ChangeLog][QtWidgets][QAbstractItemView] The virtual viewOptions
method that previously returned a QStyleOptionViewItem object has
been renamed to initViewItemOption, and initializes a
QStyleOptionViewItem object that's passed in through a pointer.
Change-Id: Ie058702aed42d77274fa3c4abb43ba302e57e348
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Change the name/key of the style to 'macos'. Besides the
name 'macintosh' being archaic, we also need this
change to avoid creating 'macintosh' style folders
in QtQuickControls, now that we plan to use QPlatformTheme
also there to resolve the style.
[ChangeLog][Widgets][QStyle] The 'macintosh' style
has been renamed to 'macos'.
Change-Id: I14b8a8b4dbd369e7a7d16b94e4ad27e501e7e8d0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
And remove one of the type id to name mapping that still
existed in QMetaType. QMetaTypeInterface can provide that,
so there's no need to have a second copy of the data.
qMetaTypeTypeInternal() can still map all the names of all
builtin types to ids. That functionality is for now still
required by moc and can't be removed yet.
Change-Id: Ib4f8e9c71e1e7d99d52da9e44477c9a1f1805e57
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
And remove the old manual registration code for those operators.
Add some special handling for long/ulong, as these types could be
streamed as a QVariant so far, but are not directly streamable
through QDataStream.
[ChangeLog][QtCore][QMetaType] The QMetaType::registerStreamOperators()
and QMetaType::registerDebugStreamOperator() methods have been
removed. The streaming operators for a type are now automatically
registered together with the type registration. This implies that the
operators should be visible wherever the type is visible and being used.
[ChangeLog][Behavior Incompatible Changes] Because the QDataStream and
QDebug serialization operators are automatically registered with
QMetaType, the declarations of those functions must be present at any
point where the type is used with QMetaType and QVariant.
Change-Id: I4a0732651b20319af4a8397ff90b848ca4580d99
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
While trying to implement instructions for building examples with
qmake in the CI, an issue has surfaced.
When building examples with CMake with -DBUILD_EXAMPLES=ON in the CI,
the examples are built in-source, aka source dir == build dir.
This means that the header files generated by qdbusxml2cpp will be
placed in the qtbase source dir.
The instructions that try to build examples with qmake build the
examples in a separate build dir after building the examples with CMake.
Unfortunately the qtbase/examples/dbus/remotecontrolledcar/car example
includes the generated DBus adaptor header via a statement like
#include "car_adaptor.h"
and the compiler prefers to pick up the header file from the example
source dir (the one generated by CMake), rather than the one generated
by qmake in the example build dir.
Because CMake's DBus integration uses different flags than qmake's
DBus integration, the generated header file code is not compatible
with the qmake generated cpp file, and the example fails to link when
building with qmake, because it can't find an appropriate constructor
symbol.
In an ideal world, we wouldn't do in-source builds with the CMake
build, but that leads to other issues which I currently don't recall.
To circumvent the issue, adapt the CMake DBus qt6_add_dbus_adaptor
function to allow not passing the problematic '-l' flag by making it
optional. This shouldn't break existing code, but allows us to
generate a compatible header that will be used by qmake and succeed in
linking the example.
Task-number: QTBUG-85986
Change-Id: I06759f79aeb66bb32da7f158f55dd4734c4a9887
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Export some private functions from QUtf8 to resolve
undefined symbols in Qt5Compat after moving QStringRef.
Task-number: QTBUG-84437
Change-Id: I9046dcb14ed520d8868a511d79da6e721e26f72b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This gives some source incompatibilities, most of them can be
handled by using auto instead of QStringRef explicitly.
[ChangeLog][Important API changes] QXmlStream now uses QStringView
insteead of QStringRef in it's API. Using auto forvariables returning
a QStringRef in Qt 5 should lead to code that can be used against both
Qt versions.
Fixes: QTBUG-84317
Change-Id: I6df3a9507276f5d16d044a6bdbe0e4810cf99440
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Move the QIODevice::OpenMode enum into a base class, so that
we can remove the full QIODevice (and thus QObject) dependency
from qdatastream.h and qtextstream.h.
This is required so that we can include QDataStream in qmetatype.h
without getting circular dependencies.
As a nice side effect, QDataStream and QTextStream can now inherit
QIODeviceBase and provide the OpenMode enum directly in their
class scope.
Change-Id: Ifa68b7b1d8d95687ed032f6c9206f92e63bfacdf
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Add metaType()/setMetaType() methods to be used instead
of the type() methods taking a QVariant::Type.
Change-Id: Ieaba35b73f8061cd83288dd6b50d58322db3c7ed
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Only widgets is required here, so drop the dependency on QT_BUILD_PARTS
and just depend on widgets.
Pick-to: 5.15
Change-Id: Idaae547b69ffd91681900b33c73e4a341011c30c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
... and QMultiMap as std::multimap.
Just use the implementation from the STL; we can't really claim that
our code is much better than STL's, or does things any differently
(de facto they're both red-black trees).
Decouple QMultiMap from QMap, by making it NOT inherit from
QMap any longer. This completes the deprecation started in 5.15:
QMap now does not store duplicated keys any more.
Something to establish is where to put the
QExplictlySharedDataPointer replcement that is in there as an
ad-hoc solution. There's a number of patches in-flight by Marc
that try to introduce the same (or very similar) functionality.
Miscellanea changes to the Q(Multi)Map code itself:
* consistently use size_type instead of int;
* pass iterators by value;
* drop QT_STRICT_ITERATORS;
* iterators implictly convert to const_iterators, and APIs
take const_iterators;
* iterators are just bidirectional and not random access;
* added noexcept where it makes sense;
* "inline" dropped (churn);
* qMapLessThanKey dropped (undocumented, 0 hits in Qt, 1 hit in KDE);
* operator== on Q(Multi)Map requires operator== on the key type
(we're checking for equality, not equivalence!).
Very few breakages occur in qtbase.
[ChangeLog][Potentially Source-Incompatible Changes] QMap does not
support multiple equivalent keys any more. Any related functionality
has been removed from QMap, following the deprecation that happened
in Qt 5.15. Use QMultiMap for this use case.
[ChangeLog][Potentially Source-Incompatible Changes] QMap and
QMultiMap iterators random-access API have been removed. Note that
the iterators have always been just bidirectional; moving
an iterator by N positions can still be achieved using std::next
or std::advance, at the same cost as before (O(N)).
[ChangeLog][Potentially Source-Incompatible Changes] QMultiMap does
not inherit from QMap any more. Amongst other things, this means
that iterators on a QMultiMap now belong to the QMultiMap class
(and not to the QMap class); new Java iterators have been added.
Change-Id: I5a0fe9b020f92c21b37065a1defff783b5d2b7a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
QEasingCurve has a richer variety of curves and curveShape was already
implemented by changing the easingCurve property.
[ChangeLog][QtCore][QTimeLine] Deprecated QTimeLine's curveShape
property in favor of the easingCurve property.
Pick-to: 5.15
Change-Id: I7261c0f24d7e02bc94624f0b74d699df62de1a52
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
The example is meant to show an item delegate with a line edit with
QRegularExpression-based validation depending on type.
Unfortunately, this does not work since QSettings mostly
return QString types.
Fix it to a partially working state by
- Making the expressions match from beginning to end which
was overlooked in the QRegExp->QRegularExpression change.
- Use QCheckBox, QSpinBox for bool/int since it is silly
to have a user edit a bool value by typing 'true'/'false'.
- Move the expressions out to a separate struct to be
able to do some guessing of the type when reading
the QSettings, implement for bool and int.
- Use a fancy Unicode checkmark for displaying bools.
- Fix the garbled display of QByteArray with binary data
by displaying them with hex characters and setting them
read-only.
Change-Id: Iba22dfafc3b813b3fd3d2915ef5210d661049382
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This is required to remove the ; from the macro with Qt 6.
Task-number: QTBUG-82978
Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The change creates a slight source incompatibility. The main
things to take care of are
* code using printf statements on list.size(). Using qsizetype in
printf statements will always require a cast to work on both 32
and 64 bit.
* A few places where overloads now get ambiguous. One example is
QRandomGenerator::bounded() that has overloads for int, uint and
double, but not int64.
* Streaming list.size() to a QDataStream will change the format
depending on the architecture.
[ChangeLog][QtCore][QList] QList now uses qsizetype to index into
elements.
Change-Id: Iaff562a4d072b97f458417b670f95971bd47cbc6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The API is available by including qopenglcontext.h as usual,
but scoped in the QPlatformInterface namespace. The namespace
exposes platform specific type-safe interfaces that provide:
a) Factory functions for adopting native contexts, e.g.
QCocoaGLContext::fromNative(nsContext, shareContext);
b) Access to underlying native handles, e.g.
openGLContext->platformInterface<QCocoaGLContext>->nativeContext()
c) Platform specific functionality, e.g.
static QWGLContext::openGLModuleHandle()
openGLContext->platformInterface<QEGLContext>->doSomething();
The platform interfaces live close to the classes they extend,
removing the need for complex indirection and plumbing, and
avoids kitchen-sink modules and APIs such as the extras modules,
QPlatformFunctions, or QPlatformNativeInterface.
In the case of QOpenGLContext these platform APIs are backed
by the platform plugin, so dynamic_cast is used to ensure the
platform plugin supports the requested interface, but this is
and implementation detail. The interface APIs are agnostic
to where the implementation lives, while still being available
to the user as part of the APIs they extend/augment.
The documentation will be restored when the dust settles.
Task-number: QTBUG-80233
Change-Id: Iac612403383991c4b24064332542a6e4bcbb3293
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Assume UTF-8 on all Unix like systems
* Export some functions to be able to compile QTextCodec once
moved to Qt5Compat.
Task-number: QTBUG-75665
Change-Id: I52ec47a848bc0ba72e9c7689668b1bcc5d736c29
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
There is no reason for keep using our macro now that we have C++17.
The macro itself is left in for the moment being, as well as its
detection logic, because it's needed for C code (not everything
supports C11 yet). A few more cleanups will arrive in the next few
patches.
Note that this is a mere search/replace; some places were using
double braces to work around the presence of commas in a macro, no
attempt has been done to fix those.
tst_qglobal had just some minor changes to keep testing the macro.
Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
And not +. Guess what, this was "accidentally" working around
a number of bugs, most importantly QTBUG-75172 (which is caused by
QTBUG-74639 and probably others).
Change-Id: If13810d9408f2be7b87f0d259737bff8cacc6f7b
Pick-to: 5.15
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: David Faure <david.faure@kdab.com>
We have seen during the Qt 5 series that QMouseEvent::source() does
not provide enough information: if it is synthesized, it could have
come from any device for which mouse events are synthesized, not only
from a touchscreen. By providing in every QInputEvent as complete
information about the actual source device as possible, we will enable
very fine-tuned behavior in the object that handles each event.
Further, we would like to support multiple keyboards, pointing devices,
and named groups of devices that are known as "seats" in Wayland.
In Qt 5, QPA plugins registered each touchscreen as it was discovered.
Now we extend this pattern to all input devices. This new requirement
can be implemented gradually; for now, if a QTWSI input event is
received wtihout a device pointer, a default "core" device will be
created on-the-fly, and a warning emitted.
In Qt 5, QTouchEvent::TouchPoint::id() was forced to be unique even when
multiple devices were in use simultaneously. Now that each event
identifies the device it came from, this hack is no longer needed.
A stub of the new QPointerEvent is added; it will be developed further
in subsequent patches.
[ChangeLog][QtGui][QInputEvent] Every QInputEvent now carries a pointer
to an instance of QInputDevice, or the subclass QPointingDevice in case
of mouse, touch and tablet events. Each platform plugin is expected to
create the device instances, register them, and provide valid pointers
with all input events. If this is not done, warnings are emitted and
default devices are created as necessary. When the device has accurate
information, it provides the opportunity to fine-tune behavior depending
on device type and capabilities: for example if a QMouseEvent is
synthesized from a touchscreen, the recipient can see which touchscreen
it came from. Each device also has a seatName to distinguish users on
multi-user windowing systems. Touchpoint IDs are no longer unique on
their own, but the combination of ID and device is.
Fixes: QTBUG-46412
Fixes: QTBUG-72167
Task-number: QTBUG-69433
Task-number: QTBUG-52430
Change-Id: I933fb2b86182efa722037b7a33e404c5daf5292a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Add misisng namespace bits.
The example is built by a CMake configuration.
It is not built in a qmake configuration due to a missing
x11 / embedded requirement.
Task-number: QTBUG-84881
Change-Id: I6c53299a53e7c4e19d994ec2ae2d542667d41899
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
To avoid an incorrect offset for the native window, call create()
after createWindowContainer().
The mysterious -1 for the width and height are removed as well because
otherwise the GL window's size is clearly off by one.
Fixes: QTBUG-82195
Pick-to: 5.15
Change-Id: I1a9cec62746fc110bfc4cd2e4fa111f621124638
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Remove QDestopWidget public header, simplify the implementation that
maintains a Qt::Desktop type QWidget for each QScreen, and turn
QWidget's initial target screen into a QScreen pointer.
QApplication::desktop() now takes an optional QScreen pointer, and
returns a QWidget pointer, so that applications and widgets can get
access to the root widget for a specific screen without having to
resort to private APIs.
QDesktopWidgetPrivate implementations to look up a screen for an index,
widget, or point are now all inline functions that thinly wrap
QGuiApplication::screens/screenAt calls. We should consider adding those
as convenience APIs to QScreen instead.
Note that QWidget::screen is assumed to return a valid pointer; there is
code that handles the case that it returns nullptr (but also code that
trusts that it never is nullptr), so this needs to be defined, verified
with tests, and asserted. We can then simplify the code further.
Change-Id: Ifc89be65a0dce265b6729feaf54121c35137cb94
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Many of these were generated by clazy using the new qevent-accessors check.
Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This uses the "unneeded #include" approach, as this looks less
ugly than the QT_{BEGIN,END}_NAMESPACE decoration.
Change-Id: I03b6cf3ebf464134fe78ab49cbbad70c0b5fd42a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QFileSystemModel is the documented replacement. It uses threads to
populate the model, which QDirModel doesn't.
Change-Id: I7818ecd8f849eb566ac176612f382e17a0471c47
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The idea is pretty simple -- add QRegularExpression matching over
QStringView. When matching over a QString, keep the string
alive (by taking a copy), and set the view onto that string.
Otherwise, just use the view provided by the user (who is then
responsible for ensuring the data stays valid while matching).
Do just minor refactorings to support this use case in a cleaner
fashion.
In QRegularExpressionMatch drop the QStringRef-returning methods, as
they cannot work any more -- in the general case there won't be a
QString to build a QStringRef from.
[ChangeLog][QtCore][QRegularExpression] All the APIs dealing
with QStringRef have been ported to QStringView, following
QStringRef deprecation in Qt 6.0.
Change-Id: Ic367991d9583cc108c045e4387c9b7288c8f1ffd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
It seems this example never worked as expected.
It has a 'multiple' option which should show extra
windows with rendering taking place in different
thread, however although render is moved to other thread
render() function was never called in that thread.
Fix following things:
* make rendering in other thread
* stop requestUpdate if nothing is exposed
* add timer so animation works at the same speed despite
of number of windows (renderer B renders two windows)
* wait for render to finish before triggering requestUdpate
* remove mutex where not needed
Pick-to: 5.15
Change-Id: I420436bd28d0357534332dd55b088d634d906c14
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Remove the two deprecated (and non-functional) options
OptimizeOnFirstUsageOption and DontAutomaticallyOptimizeOption.
Change-Id: Id5191cee84bf7b1ae65f828a981f93d98db23f53
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
There's no real dependency to QTextCodec in those files anymore.
Change-Id: Ifaf19ab554fd108fa26095db4e2bd4a3e9ea427f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
And refactor the code a bit to not convert to unicode twice and
use the mime database instead of Qt::mightBeRichText().
Change-Id: I56f9a732c8ad593e7f050eaad401be536bdf6f98
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Yet Another Side Effect of not keeping iterator stability.
Although not idiomatic, the pattern
while (i != e) {
auto cur = i++;
if (cond)
erase(cur);
}
was actually correct. Move to the idiomatic erase pattern
instead (it = cont.erase(it)).
The example still has memory problems all over the place on
shutdown. At least now it doesn't crash when running.
Change-Id: I30bd2c4e2b3fa7fe4e28d4426ff3d894b9bae103
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Use case-insensitive endsWith() instead of lowering a QString and then
comparing case-sensitively.
As a drive-by, replace ascii string literal with char16_t one.
Change-Id: Id4d8e5b197baba7aa3ae4c2ae57414c1242b3827
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Don't use QTextStream to write a QString to a file in UTF-8.
This can be done more easily, by directly converting the
QString to utf-8 and calling write on the io device.
Change-Id: I4b617b342ab339affb396ed49c5a920985d1ddfd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Also add the missing examples/widgets/gallery project.
Change-Id: Iec3d61881065cf93d90f9fd3da928ffcd4f0c0aa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Due to QChar being convertible from almost any integral type,
the old code actually called QString::remove(QChar).
Fix by using QString::chop() instead.
Change-Id: I345b018aa137ecff608a130e69ade5d37ef0805c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
The SAX API in in Qt XML got deprecated, and examples using it
removed in commit 82d02b7b95.
Pick-to: 5.15
Change-Id: I39b71378c0f797e82431c8a0e12255626ed145ed
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Due to the bug related to the 'new syntax' signal/slot connections,
it's unfortunately possible to have a connection not deleted properly
by the moment children objects get deleted. Then, as a result,
in e.g. QSslSocket's destructor the socket will change its state,
triggering the (now deleted) UI elements' access.
Note - the original bug was reported, the patch (only possible?) was
not accepted.
Fixes: QTBUG-83659
Change-Id: I2965532485bcd46f93f8449e4d0a30da92b572c5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This patch adds a publicly callable qt6_add_plugin() API to create
plugins. This API is meant to cover cases such as the plugandpaint
example.
This patch also renames qt_add_plugin to qt_internal_add_plugin in order
to avoid clashes with the public API. To avoid breaking the existing
projects, a compatibility wrapper function is enabled by default unless
QT_DISABLE_QT_ADD_PLUGIN_COMPATIBILITY is specified.
Fixes: QTBUG-82961
Change-Id: If5b564a8406c90434f1bdad0b8df76d3e6626b5f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Change-Id: I7a4259ac43e59a8f50ee1c5072a3da5b977d8bfe
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
This is required, so that QHash and QSet can hold more
than 2^32 items on 64 bit platforms.
The actual hashing functions for strings are still 32bit, this will
be changed in a follow-up commit.
Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Conflicts:
examples/opengl/doc/src/cube.qdoc
src/corelib/global/qlibraryinfo.cpp
src/corelib/text/qbytearray_p.h
src/corelib/text/qlocale_data_p.h
src/corelib/time/qhijricalendar_data_p.h
src/corelib/time/qjalalicalendar_data_p.h
src/corelib/time/qromancalendar_data_p.h
src/network/ssl/qsslcertificate.h
src/widgets/doc/src/graphicsview.qdoc
src/widgets/widgets/qcombobox.cpp
src/widgets/widgets/qcombobox.h
tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
tests/manual/diaglib/debugproxystyle.cpp
tests/manual/diaglib/qwidgetdump.cpp
tests/manual/diaglib/qwindowdump.cpp
tests/manual/diaglib/textdump.cpp
util/locale_database/cldr2qlocalexml.py
util/locale_database/qlocalexml.py
util/locale_database/qlocalexml2cpp.py
Resolution of util/locale_database/ are based on:
https://codereview.qt-project.org/c/qt/qtbase/+/294250
and src/corelib/{text,time}/*_data_p.h were then regenerated by
running those scripts.
Updated CMakeLists.txt in each of
tests/auto/corelib/serialization/qcborstreamreader/
tests/auto/corelib/serialization/qcborvalue/
tests/auto/gui/kernel/
and generated new ones in each of
tests/auto/gui/kernel/qaddpostroutine/
tests/auto/gui/kernel/qhighdpiscaling/
tests/libfuzzer/corelib/text/qregularexpression/optimize/
tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/
tests/libfuzzer/gui/text/qtextdocument/sethtml/
tests/libfuzzer/gui/text/qtextdocument/setmarkdown/
tests/libfuzzer/gui/text/qtextlayout/beginlayout/
by running util/cmake/pro2cmake.py on their changed .pro files.
Changed target name in
tests/auto/gui/kernel/qaction/qaction.pro
tests/auto/gui/kernel/qaction/qactiongroup.pro
tests/auto/gui/kernel/qshortcut/qshortcut.pro
to ensure unique target names for CMake
Changed tst_QComboBox::currentIndex to not test the
currentIndexChanged(QString), as that one does not exist in Qt 6
anymore.
Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
The name of the option may cause confusion due to the fact
that it's not _fully_ anchoring the match, only anchoring it
at the offset passed to match() -- in other words, it's a
"left" anchoring. Deprecate the old name and introduce
a new one that should explain the situation better.
[ChangeLog][QtCore][QRegularExpression] The AnchoredMatchOption
match option has been deprecated in favor of
AnchorAtOffsetMatchOption, which should better describe
that the match is only anchored at the offset.
Change-Id: Ib751e5e488f2d0309a2da6496378247dfa4648de
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
- Moves QUndo* classes (except QUndoView) from src/widgets/utils to src/gui/utils
- Moves related auto tests from widgets to gui
- Replaces QUndoAction with lambdas that do text prefixing
[ChangeLog][Undo Framework] QUndo* classes (except QUndoView) were moved from Qt
Widgets to Qt GUI.
Done-with: volker.hilsheimer@qt.io
Fixes: QTBUG-40040
Change-Id: I3bd8d4d32c64f8dee548f62159a1df2126da89d8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Remove usages of Qt::AA_UseHighDpiPixmaps from examples/.
This flag is now on by default, and can't be disabled.
Task-number: QTBUG-83092
Change-Id: Ie28622f816da2fe28d4ab272d45ea20bd051d5f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Duplicating the number of classes is a high price to pay to be able to
have some QAction functionality behave differently, or be only available
in widgets applications.
Instead, declare the entire API in QtGui in QAction* classes, and
delegate the implementation of QtWidgets specific functionality to
the private. The creation of the private is then delegated to the
Q(Gui)ApplicationPrivate instance through a virtual factory function.
Change some public APIs that are primarily useful for specialized tools
such as Designer to operate on QObject* rather than QWidget*. APIs that
depend on QtWidgets types have been turned into inline template
functions, so that they are instantiated only at the caller side, where
we can expect the respective types to be fully defined. This way, we
only need to forward declare a few classes in the header, and don't
need to generate any additional code for e.g. language bindings.
Change-Id: Id0b27f9187652ec531a2e8b1b9837e82dc81625c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Remove references to the deprecated QGLWidget and replace it with
QOpenGLWidget.
Change-Id: Ia31df42ab61c25e9ce46f4491267d2c64910f55c
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Create the pixmap with a device pixel ratio set.
Change-Id: I7f7e90aec4d117304852f050be70e14a0c6bf69d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
[ChangeLog][Potentially Source-Incompatible Changes] QtConcurrent::run
has the following signatures: run(Function &&f, Args &&...args) and
run(QThreadPool *pool, Function &&f, Args &&...args). If f is a member
pointer, the first argument of args should be an object for which that
member is defined (or a reference, or a pointer to it). See the
documentation for more details.
Fixes: QTBUG-82383
Change-Id: I18f7fcfb2adbdd9f75b29c346bd3516304e32d31
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Fix warnings about float constants and comparison.
Use member or constructor initialization.
Introduce some const for clarity.
Use Qt_CONFIG.
Task-number: QTBUG-81254
Change-Id: I71a6ebfba397c0f8e1dd2e61167233c8e5c137af
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
For qgraphicsitem_cast to work correctly with custom items, one must
reimplement the type() function for each custom QGraphicsItem subclass.
Do that in the example code.
Fixes: QTBUG-7357
Change-Id: Ibf221817908355f0347cddfc46747b6955958f5f
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
printsupport features are only available if the module is available for
the configuration. Every printer feature check has to be coupled with a
check for the module itself.
Change-Id: Id2ca84e71d5d74463d0ff35e8b18b252a779a883
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This fix is most relevant for Android for affine and gradients examples.
Currently, if the screen size is small the settings will show cramped
and not usable. Thus, adding a scrollbar to fix that.
Task-number: QTBUG-80717
Change-Id: Ic25460e5ce37a5c53bbcae48e11b6b787c45e999
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
These examples show very tiny UI elements on Android devices,
thus enabling HighDPI.
Task-number: QTBUG-80717
Change-Id: I813801d5249dc1fcfc6f61a8d146f60dd19901f6
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Examples that use QDialog as main window should be maximized on Android
to avoid a black view on most of the screen.
Task-number: QTBUG-80717
Change-Id: I933c1a01d95d53da009c190c37fa32f27be5af5e
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
The Qt version was added in 5.14 "for use as eventual replacement for
QString::SplitBehavior." Move another step closer to that goal.
Applied suitable wrapping round various char and string literals,
since docs are meant to show best practice.
Change-Id: Ie061905fad26f9b4dda3eedba4612704f0a19126
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This reverts commit ccb2cb84f5 and
commit 0f568d0a67.
The patches fix ambiguity between a getter and a signal by changing the
getter name, but we still have to rename the signal to follow the signals
naming convention.
Revert the commits to keep the getter as is and change the signal name instead.
Change-Id: Iddbab7c33eea03826ae7c114a01857ed45bde6db
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
[ChangeLog][Deprecation Notice] QAbstractSocket::error() (the signal) is deprecated; superseded by errorOccurred()
Change-Id: I11e9c774d7c6096d1e9b37c451cf0b99188b6aad
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
http example uses QStandardPaths, on Android permissions might need to
be explicitly requested to write the downloaded file.
Task-number: QTBUG-80717
Change-Id: Icd377254ad77cac661c5ae37e9081e0463493d8b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This reverts commit 94b3dd77f2.
The patch fixes ambiguity between a getter and a signal by changing the
getter name, but we still have to rename the signal to follow the signals
naming convention.
Revert the commit to keep the getter as is and change the signal name instead.
Change-Id: I0dd60cf1ae9d1bd95beeb8ad58661ca4b1fb63b9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
They all used QGL (which has been removed).
Task-number: QTBUG-74408
Change-Id: Ied003625f14228b4951002a604fce91eaccec102
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>