Commit Graph

2085 Commits

Author SHA1 Message Date
Ivan Solovev
7d2361b9da Addressbook example: port to QLatin1StringView
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>
2022-07-15 14:44:38 +02:00
Ivan Solovev
6db91c0df1 GroupBox example: port away from using deprecated QAction::setMenu()
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>
2022-07-14 16:28:49 +02:00
Joerg Bornemann
7ce82225f6 CMake: Let qt6_add_plugin accept sources
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>
2022-06-29 18:32:05 +02:00
Kai Köhne
9d2cc4dd76 Fix typos in docs and comments
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>
2022-06-15 21:31:02 +02:00
Joni Poikelin
296c3776a8 Remove unnecessary dependency to OpenGL
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>
2022-05-30 11:03:19 +03:00
Lucie Gérard
05fc3aef53 Use SPDX license identifiers
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>
2022-05-16 16:37:38 +02:00
Liang Qi
43b779ab04 examples: add WindowStaysOnBottomHint into preview text
Pick-to: 6.3 6.2 5.15
Change-Id: I1e4e390990fcb6e30b2ff7bb59168e4ffc01a936
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-05-01 21:29:00 +02:00
Sona Kurazyan
908e85cc85 Replace uses of _qs with _s in sources and examples
Task-number: QTBUG-101408
Change-Id: I48360ba3b23965cd3d90ac243c100a0656a4cde8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-19 19:12:20 +02:00
Tang Haixiang
7a7023b7b1 Chip example: fix an accidental bool->int conversion when using PMF connections
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>
2022-04-13 11:36:34 +08:00
Alexandru Croitor
4b7225c662 CMake: Don't build the movie example if the feature is disabled
Pick-to: 6.2 6.3
Fixes: QTBUG-101897
Change-Id: Idef9aaa0c0a0380b88d8769cb19becd613b2173b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-03-19 14:19:13 +01:00
Fabian Kosmale
91a50d8330 Examples: Do not depend on transitive includes
Change-Id: I7bba855a14289edbedbaa07a1234213f59085c1d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-03-17 17:14:38 +01:00
Kai Köhne
9f5f64e9db Use QDebugStateSaver in example operator<<()
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>
2022-03-16 15:56:17 +01:00
Laszlo Agocs
68a4c5da9a Compose render-to-texture widgets through QRhi
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>
2022-03-11 21:25:00 +01:00
Marc Mutz
61e3fe7fd9 Do not assume implicit string-ish → QColor conversion
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>
2022-03-11 20:15:49 +01:00
Timur Pocheptsov
bd6d6d92b5 secure UDP server: do not use deprecated protocol (DTLS 1.0)
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>
2022-03-10 08:23:00 +00:00
Eirik Aavitsland
51ff94ec92 Avoid using deprecated API in the icons example
Fixes compilation warning.

Fixes: QTBUG-100155
Change-Id: I1af2e69c070497509645c933df58fd42277cfb18
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-02-24 20:17:41 +01:00
Fabian Kosmale
ae7799a924 qtextstream.h: streamline includes
[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>
2022-02-10 04:34:13 +01:00
Leena Miettinen
ec57418ecf Doc: Update Notepad tutorial
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>
2022-01-31 14:24:11 +01:00
Friedemann Kleint
f172b964f6 threadedqopenglwidget example: Split out class Renderer
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>
2022-01-25 15:54:05 +01:00
Kai Köhne
57402ffb9b Examples: Remove unneeded CMake options
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>
2022-01-24 14:00:00 +01:00
Zhang Hao
60f21e96ae Enable QStyle::State_Horizontal when initializing QStyleOptionProgressBar
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>
2022-01-21 00:57:15 +00:00
Kai Köhne
c52fcb2ad9 bindablesubscription: Remove duplicated file entry
Pick-to: 6.2 6.3
Change-Id: I7f24425c8ccfb11bda926373099d377f808a70dd
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-12-19 14:38:27 +01:00
Kai Köhne
0c39e5c76d Examples: Remove unneeded target_include_directories
Pick-to: 6.3
Change-Id: Icd97815ee231c34ad4ea5ab94a73bfc26df7e0ca
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-17 10:38:50 +01:00
Kai Köhne
e751c604df mandelbrot example: Remove explicit linking against libm
It seems not needed anymore with modern toolchains.

Pick-to: 6.3
Change-Id: Ic5386cad4576b10f49fd74212f3514e26cfb0abe
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-17 10:38:50 +01:00
Kai Köhne
4f699e8207 analogclock example: Clean up link_libraries
analogclock doesn't use widgets.

Pick-to: 6.3
Change-Id: I75b5efc0bec786b45f8273e3d21c9be204e18225
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-17 10:38:49 +01:00
Kai Köhne
131681652e Examples: Clean up WIN32_EXECUTABLE, MACOSX_BUNDLE properties
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>
2021-12-17 10:38:49 +01:00
Kai Köhne
7cf8ecf4ce androidnotifier: Simplify example CMakeLists.txt
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>
2021-12-17 10:38:49 +01:00
Alexandru Croitor
fc89d92150 CMake: Fix echoplugin example to be built as an external project
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>
2021-12-15 15:43:16 +01:00
Kai Köhne
80a76df178 Examples: Fix whitespace issues in CMakeLists.txt
Pick-to: 6.3
Change-Id: I8e6dd1f250f8be6016ee4164cb2ab7034cbb1203
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-13 14:16:26 +00:00
Kai Köhne
51f22a3a04 Examples: Remove remaining conversion markers in CMakeLists.txt
Pick-to: 6.3
Change-Id: Ia5d474a3efd6aadbd0ef1537318f2f24e6c24fee
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-13 14:16:26 +00:00
Kai Köhne
28a9d116bb CMake: Prefer unversioned commands
Pick-to: 6.3
Change-Id: Ib32700ab82cf6b271c49e25d12fbad8c9c6bc1d1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-13 14:16:25 +00:00
Kai Köhne
7024e7a627 Examples: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiom
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>
2021-12-10 10:48:26 +01:00
Kai Köhne
ce308d94a2 CMake: Simplify pingpong/complexpingpong examples
Change-Id: Iff9bf22c7aebc6a5f61cd7411a99ee2bbb11c12c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-12-09 13:57:07 +01:00
Kai Köhne
5bacfbd77e Rasterwindow: Remove unneeded find_package
Change-Id: Ia526f7603af98a6d450ff2465fd666d955772646
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-06 14:42:45 +01:00
Kai Köhne
4c31a78516 Do not support Qt5 build in androidnotifier example
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>
2021-12-06 14:42:45 +01:00
Kai Köhne
251e848007 Remove .prev_CMakeLists.txt
These are left-overs from the initial qmake2cmake conversion.

Pick-to: 6.2
Change-Id: Ie15c9ff022ea4566d10c1ba74599de9af83d29a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-12-06 11:23:26 +00:00
Shawn Rutledge
46cadf7b48 QSystemTrayIcon example: ignore non-spontaneous QCloseEvent
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>
2021-12-03 18:17:41 +00:00
ChunLin Wang
8e465c75fe Repair parameter type
Fix the parameter types corresponding to the sample code and subclasses

Fixes: QTBUG-98578
Pick-to: 6.2
Change-Id: I06e342ae1210ed53c5deec3e2711457cf2ac5b15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-03 11:52:21 +08:00
Sona Kurazyan
022891bcd8 Document the example showing the benefits of using bindable properties
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>
2021-12-02 12:53:34 +01:00
Sona Kurazyan
cee89e70a6 Add example showing the benefits of using bindable properties
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>
2021-12-02 12:53:34 +01:00
Marc Mutz
34c7018a52 multistreamserver: fix compilation
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>
2021-11-18 18:13:19 +01:00
Marc Mutz
8bd0a09475 multistreamclient example: fix compilation
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>
2021-11-16 15:07:36 +01:00
Tang Haixiang
c4856a9075 Use QScopedPointer to manage memory
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>
2021-11-04 01:03:44 +00:00
Tang Haixiang
f5eda09a63 Modify the target Square in the puzzle
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>
2021-11-03 01:10:32 +00:00
Joerg Bornemann
9beae46b59 Fix treemodelcompleter example
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>
2021-10-27 16:34:44 +02:00
Alexey Edelev
3f4082c0e8 Add missing LIBRARY DESTINATION for examples
Pick-to: 6.2
Fixes: QTBUG-97629
Change-Id: I5b32824693206926de9b4ee6637749a1814fdde7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-20 17:04:51 +02:00
Friedemann Kleint
bb56560b6b Polish the painting/affine example
- 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>
2021-10-16 12:52:29 +02:00
Shawn Rutledge
5c436365f5 Support background-color CSS styling on <hr/>
[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>
2021-10-14 17:09:20 +02:00
Ievgenii Meshcheriakov
44a7412795 Remove checks for C++ standard versions C++17 and below
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>
2021-10-01 02:46:09 +02:00
Joerg Bornemann
fb656c036d Remove .qmake.conf from this repository
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>
2021-09-20 19:00:05 +02:00
Luca Di Sera
10eedd175e Doc: Centralize RFC documentation-links in rfc.qdoc
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>
2021-09-16 15:52:27 +02:00
Talent Gc
f10ec04a6c SQL browser example: fix typo
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>
2021-09-02 15:45:16 +00:00
Morten Sørvig
81a7344e1d Port to QImage and QPixmap deviceIndependentSize()
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>
2021-09-01 15:24:05 +02:00
Alexandru Croitor
3c1125d9fe CMake: Create plugin initializers for static user plugins
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>
2021-08-24 16:10:31 +02:00
Joerg Bornemann
ff00ef6410 Raise cmake_minimum_required to VERSION 3.16 in examples
Pick-to: 6.2
Task-number: QTBUG-95636
Change-Id: I1270b4846d8a23bc3563b6942c0910e095d2be4a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-17 19:18:54 +02:00
Friedemann Kleint
74515a7a30 Improve translations loading code in standarddialogs example
Pick-to: 6.2
Change-Id: I799724b633f1b52675ca2aa69b22fdb678b84421
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-08-06 17:08:10 +02:00
Assam Boudjelthia
0edda211f9 Remove mention of permission api in http example
Pick-to: 6.2
Change-Id: I8b22633e1ad5372f92f87315b7184a4b499a0a0b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-07-30 14:46:55 +03:00
Assam Boudjelthia
07d4ecd734 Rename QPermission namespace to QApplicationPermission
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>
2021-07-15 01:57:41 +03:00
Marc Mutz
0e02f6536a Port all in-tree addAction() users from postfix to infix QKeySequence
The former is QT_DEPRECATED_SINCE(6, 4).

Change-Id: I9e60639651b0832f1e3d3282d15dd0ab0b22d819
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-07-14 00:46:49 +02:00
Marc Mutz
2b50c8bec0 QObject: optimize the common case of findChildren(QString())
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>
2021-07-13 16:57:31 +02:00
Assam Boudjelthia
468e4a8242 Android: trim down the examples manifests from obsolete tags
Pick-to: 6.2
Change-Id: I4a1fe025e59f724fb9aad8078198474f14d29feb
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2021-07-01 23:54:15 +03:00
Assam Boudjelthia
af6bc5a21b Remove ministro code
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>
2021-07-01 23:54:14 +03:00
Volker Hilsheimer
eee953aa56 Qt::PrintSupport is an optional component in the fontsampler example
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>
2021-06-15 22:11:10 +02:00
Assam Boudjelthia
19a154f57b Use new permission api for http example
Change-Id: I265ec42205a193e9862eef26e73805bbf4188640
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-07 14:59:14 +03:00
Assam Boudjelthia
107a8058ae Move notification example from androidextras to qtbase
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>
2021-06-04 22:21:12 +03:00
Friedemann Kleint
6ac77e81ae Regular Expression example: Brush up and add a way to preview replacements
- 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>
2021-06-01 21:54:35 +00:00
Laszlo Agocs
bbc6b5c3a7 vulkan: Update legacy tests and examples to the modern validation layer
Fixes: QTBUG-88388
Change-Id: Ib072f203ada5d692dea8d35da2b24db0deac0297
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-05-31 17:16:49 +02:00
Craig Scott
d97fd7af2b Build examples in isolated sub-builds using ExternalProject
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>
2021-05-26 13:33:29 +02:00
Friedemann Kleint
902a4d63a1 Small fix to the notepad example
- 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>
2021-05-18 20:57:25 +02:00
Joerg Bornemann
92185d417d Fix BASE argument of qt_add_resources
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>
2021-05-18 16:02:52 +02:00
Friedemann Kleint
18aad6da87 Brush up the text edit example
- 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>
2021-05-18 16:01:51 +02:00
Joerg Bornemann
db25a067b0 Fix build of standalone painting examples
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>
2021-05-17 17:14:10 +02:00
Joerg Bornemann
78e6b54cde Add missing PNG file to CMakeLists.txt of richtext/textedit example
Change-Id: I3532646d16c14585f8800a16d3032535bc6a30a6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-05-14 22:42:34 +02:00
Friedemann Kleint
e3141d5507 Style sheet example: Fix doc url for Qt 6
Pick-to: 6.1
Change-Id: I5c66b472b1687eec0ed1109ce2723d747b1a4193
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2021-05-08 01:35:44 +02:00
Shawn Rutledge
688602704d Support CSS text-decoration-color in underlines, overlines, strikethrough
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>
2021-05-07 17:00:20 +02:00
Joerg Bornemann
4caac1feea Re-work the CMake project files for the plugandpaint example
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>
2021-04-27 21:33:48 +02:00
Jukka Passi
34dc76c851 Android: Fix build error issue in examples
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>
2021-04-27 07:36:40 +00:00
Friedemann Kleint
2393a40ccd Rewrite the fetchmore example
- 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>
2021-04-23 12:43:28 +00:00
Volker Hilsheimer
00988adcf9 Port example away from deprecated QTextCharFormat API
Change-Id: I1d62f14f9e64f14809bdced4e5d906979034cbdc
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2021-04-23 08:52:01 +02:00
Shawn Rutledge
76537c065a Avoid divide-by-zero in the gradients example
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>
2021-04-19 19:56:25 +02:00
Volker Hilsheimer
6a4aa096e9 Port examples away from deprecated QTouchEvent APIs
Use the QEventPoints API instead.

Change-Id: I7310fd34df110cad508f6188a41ad452a3cf848d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-04-17 09:18:11 +02:00
Qt CI Bot
09d99a8d5f Merge integration refs/builds/qtci/dev/1618592683 2021-04-16 19:56:04 +00:00
Qt CI Bot
5839dee30f Merge integration refs/builds/qtci/dev/1618585460 2021-04-16 18:14:35 +00:00
Volker Hilsheimer
70d99512ee Fix call to QMessageBox::information
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>
2021-04-16 18:43:35 +02:00
Volker Hilsheimer
6ed83f82fe Port example away from deprecated QVariant API
Change-Id: I284610f216409b593d307b8076c8f638722929e6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-04-16 16:49:29 +02:00
Edward Welbourne
d4242b8af3 Revise deprecation of countriesForLanguage()
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>
2021-04-16 10:23:23 +02:00
JiDe Zhang
50a7eb8cf7 Add the "Territory" enumerated type for QLocale
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>
2021-04-15 20:17:49 +08:00
Friedemann Kleint
0e69349f6f Brush up the mandelbrot example
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>
2021-04-14 08:24:04 +02:00
Friedemann Kleint
c10159a9a1 standarddialogs example: Fix font handling
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>
2021-04-07 08:27:21 +02:00
Samuel Gaist
e65558c230 Fix Editable Tree Model example model rowCount and model instance leak
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>
2021-03-29 12:09:41 +01:00
Thiago Macieira
ae9e433753 Remove unnecessary int() casting in QRandomGenerator::bounded
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>
2021-03-17 06:21:52 +00:00
Topi Reinio
00e10f62b5 Doc: Fix various documentation issues
- Document QIODeviceBase
- Document QPointerEvent::points
- Fix linking issues

Task-number: QTBUG-90662
Change-Id: Ib123d5708953b22e01f95c82626b39a49fff95b2
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
2021-03-16 13:17:39 +01:00
Friedemann Kleint
0a392780c8 imageviewer example: Show the color space description when loading
Change-Id: If9939676f29b9bbb43d698fb12efc42757e5c659
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2021-03-05 17:35:25 +01:00
Friedemann Kleint
fe1ef3ebcb Brush up the imageviewer example
- 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>
2021-03-01 16:37:58 +00:00
Joerg Bornemann
0c51a87563 Fix CMake build of network/torrent example
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>
2021-02-15 13:40:08 +00:00
Joerg Bornemann
ab585356bd Fix deprecated API in network/torrent example
Pick-to: 6.1
Change-Id: Ie4493f0d93cdeff281c3826d2ca3beb4e68d7a0f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-02-15 12:07:47 +00:00
Friedemann Kleint
060fceb2ab dirview example: Show file icons on Windows
Use QFileIconProvider from QtWidgets.

Pick-to: 6.0
Task-number: QTBUG-66177
Change-Id: I22db2f8671c64d90c45ff7160af9a6925d1cecea
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-02-13 10:37:54 +01:00
Joerg Bornemann
a289bc84c6 Turn off the dbus examples for qmake-generated VS projects
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>
2021-02-09 15:45:06 +01:00
David Skoland
9e09677c1d Remove QtDBus includes
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>
2021-01-12 09:19:27 +01:00
Ivan Solovev
9b1d769fd0 UndoFramework example: make the background visible
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>
2021-01-11 12:59:07 +00:00
Giuseppe D'Angelo
c34c6af374 Replace some more erase/remove patterns with removeIf
Change-Id: I6c6f33450fbfd798e5ef71a8ba18f590581dc3a2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-01-10 15:02:47 +01:00
David Skoland
27d96b4789 Replace QtTest headers with QTest
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>
2020-12-22 15:20:30 +01:00
Sona Kurazyan
81ed78c293 Improve the QtConcurrent ImageScaling example
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>
2020-12-11 11:45:45 +01:00
Timur Pocheptsov
b283ce1e83 secureudpclient - a speculative fix for non-reproducible crash
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>
2020-12-10 22:07:12 +01:00
Shawn Rutledge
8e74ee0791 Update Drop Site Example docs: mention the new markdown support
Amends 4edcea762d

Change-Id: Ide3e7a67b6604d07b76edcfe484c8d29e4e848fb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-12-01 20:20:18 +01:00
Andreas Buhr
10b6a87679 Fix documentation links to High DPI documentation
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>
2020-12-01 15:48:53 +01:00
Joerg Bornemann
b71c04353d CMake: Work around building dbus 'controller' example with qmake
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>
2020-11-30 23:17:48 +01:00
Volker Hilsheimer
6cb36d825d Rename Application Example
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>
2020-11-26 14:43:20 +01:00
Volker Hilsheimer
78cbb25b9d Use event cloning rather than copying
Fixes: QTBUG-88834
Pick-to: 6.0 6.0.0
Change-Id: I8c21b07c9d8491f26589f29b04d552835b3cbd11
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-11-25 22:08:09 +01:00
Friedemann Kleint
d3ba1b321b i18n example: No longer ignore return value of QTranslator.load()
Adapt to qtbase/86ebe46f591d33dc76e2f764524c988dd72f4437.

Change-Id: Ie45d43b3eabe60195622d69458e3d881139f9ce1
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-11-19 17:27:30 +01:00
Sona Kurazyan
190b77463d Improve QtConcurrent ImageScaling example to demo new features
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>
2020-11-12 08:56:14 +01:00
Topi Reinio
5d8a04f007 Doc: Fix documentation warnings for Qt Widgets
- 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>
2020-11-12 06:55:01 +01:00
Shawn Rutledge
f5c7799f59 Support the markdown underline extension
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>
2020-11-07 09:35:11 +01:00
Volker Hilsheimer
4a66fb9d76 Fix a bunch of qdoc warnings
Remove or fix references to removed APIs, and some qdoc syntax fixes.

Change-Id: I67d71062cd7a29f4eb74b02199b1482af5e59fc0
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-11-06 10:16:31 +01:00
Allan Sandfeld Jensen
b26fa9722f Add multi key bindings to QShortcut
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>
2020-11-04 10:32:38 +02:00
Volker Hilsheimer
a50f0f045d Get rid of all instance usage of QFontDatabase
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>
2020-11-03 20:36:34 +01:00
Shawn Rutledge
4edcea762d DropSite example: support markdown
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>
2020-11-02 16:08:36 +01:00
Sona Kurazyan
ff0ba7e2d7 Forbid implicit conversions between QFuture and other types
- 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>
2020-10-30 17:19:26 +01:00
Topi Reinio
afa341375d Doc: Fix documentation warnings for Qt OpenGL
Task-number: QTBUG-86295
Change-Id: I4fff2d61f8f0513181150954440c9357acf73c1d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-10-30 06:19:26 +01:00
Topi Reinio
f604fe6d1d Doc: Fix link issues for QtCore
- 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>
2020-10-29 18:27:21 +01:00
Mårten Nordheim
dfca01e186 Update the HTTP example
- 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>
2020-10-28 08:48:26 +02:00
Alexandru Croitor
638ac41293 CMake: Fix painting examples to build as standalone projects
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>
2020-10-27 19:26:45 +01:00
Alexandru Croitor
397b372517 CMake: Regenerate examples to set the WIN32_EXECUTABLE property
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>
2020-10-27 12:49:39 +01:00
Alexandru Croitor
2ffbac7cb2 CMake: Regenerate examples to use qt_add_executable
Task-number: QTBUG-87661
Change-Id: I0dacfdc97a3fb7d88da85b67800f2c1b084d869b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-19 11:51:47 +02:00
Friedemann Kleint
d55940d7f6 Brush up the basicsortfiltermodel example
- Add a clear button to the line edit
- Indicate invalid regular expressions

Change-Id: I1dbeaa0f9168224ccb9134c0c1fe281da14dcbce
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-10-14 20:35:16 +02:00
Shawn Rutledge
b0cd3bcec4 Use QScroller in the Dir View example
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>
2020-10-14 18:29:00 +00:00
Volker Hilsheimer
1c76aa077e Get rid of all usage of QApplication:desktop
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>
2020-10-14 06:38:43 +02:00
Allan Sandfeld Jensen
564b59d903 Another round of replacing 0 with nullptr
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>
2020-10-07 23:02:47 +02:00
Tor Arne Vestbø
0efe79f80d Rename the new platform APIs from QPlatformInterface to QNativeInterface
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>
2020-10-07 13:03:27 +02:00
Lars Knoll
fa8d021fa6 Convert a couple of APIs to use views
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>
2020-10-06 11:16:36 +02:00
Alexander Volkov
a51b7844ca Stylesheet example: Get rid of auto-connection slots
Change-Id: I55d89cf33e5f9c8aef3a3dfbbdcd212415d35bcb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-09-25 18:04:06 +03:00
Alexandru Croitor
a3bd80c08c CMake: Regenerate projects
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>
2020-09-22 19:08:53 +02:00
Volker Hilsheimer
1e2325f0dc Fix some qdoc warnings: typos and qdoc syntax
Change-Id: Idf5c1490330e0f2e5d4bcf920eb03fc9993b3c8a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-22 06:01:02 +02:00
Volker Hilsheimer
861c4d8548 Deprecate implicit QPixmap conversion to QBitmap
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>
2020-09-17 13:26:50 +02:00
Mitch Curtis
fb65b32d76 Add qHash implementation for QPoint
[ChangeLog][QtCore][QPoint] Added qHash() implementation.

Change-Id: I65332e7aafab53af40a6e11457b9b457196d584c
Fixes: QTBUG-86457
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-09-15 02:46:40 +02:00
Allan Sandfeld Jensen
9815ebf24b Switch QSurfaceFormat::colorSpace to a QColorSpace
Allows more flexibility in the future.

Change-Id: Idcf2d8ddaee268a7b5d55379ccb42dd9b3c33abf
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-15 01:41:13 +02:00
Laszlo Agocs
cc570ce2fe Fix vulkan example build with MSVC
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>
2020-09-14 09:48:05 +02:00
Lars Knoll
652bd1efca Make QStringList an alias to QList<QString>
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>
2020-09-12 23:37:15 +02:00
Lars Knoll
557623cc4f Rename QLibraryInfo::location() to path()
As per ### Qt6 comment. Also rename the LibraryLocation enum
to LibraryPath.

Change-Id: I556025a19c5bcdf2ff52598eaba32269522d4128
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-09-12 23:35:56 +02:00
Volker Hilsheimer
8186bd628f Remove obsolete APIs and comments from QAbstractPrintDialog
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>
2020-09-10 17:29:52 +02:00
Morten Johan Sørvig
b3c991ae8f Port from devicePixelRatioF() to devicePixelRatio()
This ports all of QtBase.

Change-Id: If6712da44d7749b97b74f4614a04fac360f69d9e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-10 17:28:11 +02:00
Paul Wicking
95056d465e Doc: Move example file that was left behind
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>
2020-09-10 11:24:18 +02:00
Lars Knoll
d49a7412f5 Derive some item delegates from QStyledItemDelegate
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>
2020-09-10 03:15:49 +02:00
Tor Arne Vestbø
89f7a2759c Deliver Quit event when calling QCoreApplication::quit()
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>
2020-09-07 14:41:16 +02:00
Volker Hilsheimer
00a5629d8d Remove deprecated QPrinter and QPagedPaintDevice APIs
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>
2020-09-04 08:37:59 +02:00
Giuseppe D'Angelo
25351dcc54 Long live QKeyCombination!
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>
2020-09-03 07:00:31 +02:00
Andreas Hartmetz
7f878c6217 Remove "fallback session management"
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>
2020-09-01 10:16:15 +02:00
Tor Arne Vestbø
90358f6042 Deprecate and remove uses of AA_DisableHighDpiScaling
Change-Id: Ibadce68775858c524b998aacad310905ba2c2e8e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-08-31 19:14:55 +02:00
Tor Arne Vestbø
dce106c77c High-DPI: Remove usage of Qt::AA_EnableHighDpiScaling
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>
2020-08-28 20:08:43 +02:00
Volker Hilsheimer
c501e09efa Replace QAbstractItemView::viewOptions with initViewItemOption
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>
2020-08-26 18:02:58 +02:00
Richard Moe Gustavsen
ed813c19fa macOS: rename 'macintosh' style to 'macos'
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>
2020-08-26 16:37:43 +02:00
Karsten Heimrich
a735038376 Move QStateMachine from QtCore to QtScxml
Task-number: QTBUG-80316
Change-Id: I2ee74110fd55e94d86321d3b3dc5bb8297424ed4
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2020-08-24 20:10:25 +02:00
Mårten Nordheim
0011a45102 QAbstractSocket: Resolve remaining Qt6 TODOs
Change-Id: Id257f0721c1cd5fcbafa9297bae0251a2d68e366
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-08-24 17:43:56 +02:00
Lars Knoll
1697fbdf05 Deprecate the static int based API in QMetaType
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>
2020-08-24 00:19:05 +02:00
Lars Knoll
ed8acbeb7c Automatically register data/debug stream operations in QMetaType
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>
2020-08-24 00:17:03 +02:00
Alexandru Croitor
5138a970f3 CMake: Workaround building DBus 'car' example with qmake
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>
2020-08-23 11:04:04 +02:00
Karsten Heimrich
2766322de3 Move QStringRef and remains to Qt5Compat
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>
2020-08-20 00:58:13 +02:00
Karsten Heimrich
a8028a02df Port the QXmlStream API from QStringRef to QStringView
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>
2020-08-19 19:48:03 +02:00
Lars Knoll
f741a12de1 Disentangle QIODevice dependencies
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>
2020-08-15 20:55:31 +02:00
Lars Knoll
67f04fa060 Deprecate QVariant::Type uses in QSqlField
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>
2020-08-15 10:56:33 +02:00
Andy Shaw
53da069b32 Don't depend on tools for the qtestlib examples
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>
2020-08-12 19:37:15 +02:00
Giuseppe D'Angelo
14090760a8 Long Live QMap as a refcounted std::map!
... 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>
2020-08-06 19:15:39 +02:00
Lars Knoll
2b0db55939 Fix compiler warning about qsizetype/int mismatch
Change-Id: I58624d8c5de0734bd0851e6744ed34c1408dfda6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-08-04 13:28:33 +02:00
Edward Welbourne
d6502614d0 Deprecate QTimeLine's curveShape in favor of its easingCurve
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>
2020-07-16 17:39:11 +02:00
Friedemann Kleint
a83b2c64a9 Polish the settingseditor example
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>
2020-07-10 11:31:09 +00:00
Alexandru Croitor
74cb331af3 CMake: Regenerate examples
Change-Id: I1c51b10af4e2b26f54740f257164c56a0e2a03ce
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-07-09 09:38:28 +02:00
Lars Schmertmann
6ce2f3f26b Add ; to Q_UNUSED
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>
2020-07-07 11:51:48 +02:00
Lars Knoll
df853fed66 Use qsizetype in QList
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>
2020-07-06 21:31:14 +02:00
Jarek Kobus
60c6f4a51a Use QList instead of QVector in statemachine
Task-number: QTBUG-84469
Change-Id: I2b1399c34ebcc2237ca2662d97b54e81f11cb7af
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-07-06 14:06:13 +02:00
Tor Arne Vestbø
6ff79478a4 Introduce platform API abstraction for QOpenGLContext
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>
2020-07-02 10:27:50 +02:00
Tor Arne Vestbø
46d4c2022d Fix warnings in QtConcurrent image scaling example
Change-Id: Ib82b2abf608536ef4df6d7cfa5fb106f29f9253f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-01 14:57:43 +02:00
Tor Arne Vestbø
cc857a3c71 macOS: Remove examples for deprecated QMac(NativeWidget|CocoaViewContainer)
Change-Id: I60d694f868623ed9761baf0cf532a87ab3412208
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-06-26 15:10:26 +02:00
Paul Wicking
8cd3ec4ee4 Doc: Fix typo
Add missing quote in text.

Pick-to: 5.15
Change-Id: If3a3d28f50057040c5aff90c70803b85c8a475a9
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2020-06-25 09:56:46 +02:00
Paul Wicking
f7f5055702 Example: Connect to correct slot
Pick-to: 5.15
Fixes: QTBUG-85009
Change-Id: Id4db9a20e6c92ae86c764abb723fbe4ad426f2f8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-06-23 14:21:04 +02:00
Jarek Kobus
29c99bddbf Use QList instead of QVector in examples
Task-number: QTBUG-84469
Change-Id: Id14119168bb1bf11f99bda7ef6ee9cf51bcfab2e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2020-06-23 14:01:11 +02:00
Karsten Heimrich
18ec53156e Move QTextCodec support out of QtCore
* 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>
2020-06-20 02:04:38 +02:00
Giuseppe D'Angelo
3e1d03b1ea Port Q_STATIC_ASSERT(_X) to static_assert
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>
2020-06-19 19:38:23 +02:00
Giuseppe D'Angelo
97af1b839c Use | to OR some related flags
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>
2020-06-19 06:13:35 +00:00
Karsten Heimrich
b251d6137d Fix examples build after a061a64642
Change-Id: I4d10b4439e5a858437751b00efde2bf8c467e857
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-17 22:40:02 +02:00
Shawn Rutledge
6589f2ed0c Introduce QInputDevice hierarchy; replace QTouchDevice
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>
2020-06-16 22:06:56 +02:00
Alexandru Croitor
8a8541c3cd CMake: Fix lightmaps example to build in a namespaced Qt
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>
2020-06-12 19:30:29 +02:00
Laszlo Agocs
d4548751b7 Fix OpenGL mode in examples like composition
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>
2020-06-09 11:29:01 +00:00
Volker Hilsheimer
44fb925f50 Phase 2 of removing QDesktopWidget
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>
2020-06-08 20:29:49 +02:00
Shawn Rutledge
a061a64642 Replace calls to deprecated QEvent accessor functions
Many of these were generated by clazy using the new qevent-accessors check.

Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-06-08 19:11:51 +02:00
hjk
de389229fa Example compile fix with namespaced Qt
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>
2020-06-08 09:35:16 +02:00
Volker Hilsheimer
94dcb5454f Remove the deprecated QDirModel
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>
2020-06-04 19:11:19 +02:00
Giuseppe D'Angelo
529f052add Port QRegularExpression to QStringView, drop QStringRef
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>
2020-05-31 21:46:32 +02:00
Michal Klocek
5786ac12f0 Fix hellowindow example
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>
2020-05-25 17:37:57 +02:00
Christian Ehrlicher
ee3994384a Examples/RegularExpressionDialog: remove deprecated options
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>
2020-05-23 10:53:24 +02:00
Lars Knoll
2b8863a98c Get rid of some QTextCodec leftovers
There's no real dependency to QTextCodec in those files anymore.

Change-Id: Ifaf19ab554fd108fa26095db4e2bd4a3e9ea427f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-14 07:51:20 +02:00
Lars Knoll
ada608d46d Get rid of QTextCodec in the textedit example
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>
2020-05-14 07:51:15 +02:00
Paul Wicking
0515bd8d2e Doc: Use nullptr instead of 0 in example
Pick-to: 5.15
Fixes: QTBUG-84101
Change-Id: Ia0b5a87bf9776ee14eff0483b955dd99389cb6ae
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2020-05-11 11:48:57 +02:00
Giuseppe D'Angelo
1018dba04f Torrent example: fix crash
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>
2020-05-11 10:21:29 +02:00
Marc Mutz
616000ed7f torrent example: fix premature pessimisation
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>
2020-05-05 05:28:19 +00:00
Qt Forward Merge Bot
0f7987f0c9 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/corelib/text/qlocale.cpp
	src/network/access/qnetworkaccessmanager.cpp

Regenerated tests/auto/testlib/selftests/float/CMakeLists.txt

Change-Id: I5a8ae42511380ca49a38b13c6fa8a3c5df8bed01
2020-05-04 17:38:40 +02:00
Lars Knoll
5acc3dd242 Remove a couple of QTextStream usages
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>
2020-05-01 18:52:14 +02:00
Sona Kurazyan
9b51d5f571 CMake: Regenerate examples/widgets/ projects
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>
2020-04-29 22:48:38 +02:00
Friedemann Kleint
425560cc83 Mark widget gallery example as "gallery"
Add a metatag. Amends 4e93e3b574.

Pick-to: 5.15
Task-number: PYSIDE-1112
Change-Id: I5003f958559438cc83eb98e5eedfcefb21a243b7
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-04-29 22:47:34 +02:00
Marc Mutz
693c28b9fb examples: avoid int -> QChar conversions
They're being made explicit/deprecated/removed.

Change-Id: I61d8c40dc86035813b85724beb21a65b6f8dffef
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-04-29 10:10:36 +02:00
Marc Mutz
bfde4f4a96 torrent example: fix stripping of file extension
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>
2020-04-27 18:11:13 +00:00
Kai Koehne
44e8c90ad4 Do not mention Qt XML's SAX API anymore in examples/xml/README
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>
2020-04-24 09:47:41 +02:00
Qt Forward Merge Bot
7f895553ac Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Iaa439ba7dff19a17e3716b3d30f49f60fa6e38f8
2020-04-23 01:00:36 +02:00
Timur Pocheptsov
6c45b1817f SslSocketClient - fix example not to crash
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>
2020-04-22 13:03:45 +02:00
Leander Beernaert
6fbeef4c6b CMake: Add qt6_add_plugin public API
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>
2020-04-22 09:51:12 +02:00
Volker Hilsheimer
90295dcd03 Remove deprecated QStyle enum values
Change-Id: I7eba336017844c06b2976df53d440e167abd7894
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-04-16 16:53:18 +02:00
Lars Knoll
48794f5057 Port example over to QRegularExpression
Change-Id: I1e15bfa0a2973aabcad78f3eba4bb4903f8f3f6f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2020-04-15 14:38:23 +02:00
Lars Knoll
52d91508fd Convert the example to use QRegularExpression
Change-Id: I7a4259ac43e59a8f50ee1c5072a3da5b977d8bfe
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-04-15 14:38:17 +02:00
Lars Knoll
466a424514 Fix example documentation to not mention QRegExp anymore
Change-Id: I2761d8efef31a3b890de9cab78589f1d6c03f62d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-04-13 09:40:54 +02:00
Qt Forward Merge Bot
58a4289800 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	tests/auto/network/socket/platformsocketengine/platformsocketengine.pri

Change-Id: I22daf269a8f28f80630b5f521b91637531156404
2020-04-11 14:59:13 +02:00
Shawn Rutledge
1ec350e35f Stop using obsolete TouchPoint rect accessors in tests and examples
Followup to cf4a8b12fa
68916fede4 and
3c159957f8.

Task-number: QTBUG-83403
Change-Id: Ieaf418860c565dbe883384e7f296a829fbfa1e33
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-10 13:54:43 +00:00
Volker Hilsheimer
033d01bd6e QApplication: remove obsolete globalStrut functionality
Change-Id: If56873f86f5291264cac720f8db7dbd4db756f49
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-04-10 13:59:30 +02:00
Lars Knoll
c6cdf38e75 Change qHash() to work with size_t instead of uint
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>
2020-04-09 20:03:25 +02:00
Qt Forward Merge Bot
8823bb8d30 Merge remote-tracking branch 'origin/5.15' into dev
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
2020-04-08 20:11:39 +02:00
Giuseppe D'Angelo
9121829916 QRegularExpression: rename AnchoredMatchOption to AnchorAtOffsetMatchOption
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>
2020-04-03 21:49:57 +02:00
Tor Arne Vestbø
ab4c22d47d macOS: Remove all use of deprecated Q_OS_OSX define
Change-Id: I49c285604694c93d37c9d1c7cd6d3b1509858319
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-04-03 13:44:37 +02:00
Lars Knoll
2fda4cda22 Remove the regexp example
Change-Id: I113a8f4c8ba401443aab2347211b3782e99c9cf4
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2020-03-31 15:28:23 +02:00
Mitch Curtis
3f73995a03 Move undo framework out of Qt Widgets
- 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>
2020-03-30 12:36:29 +02:00
Morten Johan Sørvig
c3a4d36082 High-DPI: Remove usages of Qt::AA_UseHighDpiPixmaps
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>
2020-03-30 08:43:02 +01:00
Volker Hilsheimer
bcaff2b06f Remove QGuiAction again and split QAction implementation up instead
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>
2020-03-29 11:18:57 +01:00
Timur Pocheptsov
4561370661 More qOverload cleanups in qtbase
Task-number: QTBUG-82605
Change-Id: I1c3c14ed82911ed5483258c11e76f5dd7744fa12
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-24 20:58:13 +01:00
Mårten Nordheim
fc1b5eac1a QAbstractSocket: Fix usage of deprecated error signal in example
Task-number: QTBUG-82605
Change-Id: I83a8777d32302607d48dd670b6c787ac05db88d2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-24 17:40:40 +01:00
Christian Ehrlicher
bd75c87e0e Doc: replace deprecated references to QGLWidget
Remove references to the deprecated QGLWidget and replace it with
QOpenGLWidget.

Change-Id: Ia31df42ab61c25e9ce46f4491267d2c64910f55c
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-03-20 22:27:29 +01:00
Simon Hausmann
bc64ccbf00 Re-generate various CMake projects and configure after merge
Change-Id: I02f5926c6664aab518c5c81e0c33dca0818a1871
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-16 20:43:56 +01:00
Simon Hausmann
c2f167b412 Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-03-16 20:43:50 +01:00
Simon Hausmann
ff922e7b87 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/corelib/kernel/qmetatype.cpp

Change-Id: I88eb0d3e9c9a38abf7241a51e370c655ae74e38a
2020-03-16 18:41:27 +01:00
Tor Arne Vestbø
77885f8402 cmake: Remove APPLE prefix from platform names
None of the other platforms have it.

Change-Id: Ib448c2c03ba03f711b507ef391977c0e6aa7c192
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-16 17:57:56 +01:00
Tor Arne Vestbø
db745fdd2d cmake: Fix naming when referring to Apple macOS
Change-Id: Iafb5e448d0d65d42f788464fc600594a5666f9af
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-16 17:57:52 +01:00
Friedemann Kleint
a719c630f1 Mandelbrot Example: Use High DPI scaling
Create the pixmap with a device pixel ratio set.

Change-Id: I7f7e90aec4d117304852f050be70e14a0c6bf69d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-03-12 08:24:09 +01:00
Qt Forward Merge Bot
3d315860cd Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2020-03-11 15:39:56 +01:00
Qt Forward Merge Bot
865afac250 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ibee5acec72a1a1769d4bc5f23f56c7dc8d4cf3cb
2020-03-11 15:34:21 +01:00
Vitaly Fanaskov
c977e74afd QtConcurrent::run: accept more then five function's arguments
[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>
2020-03-11 14:46:25 +01:00
Qt Forward Merge Bot
116d68f105 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/corelib/plugin/qlibrary.cpp
	src/corelib/plugin/qlibrary_unix.cpp
	src/corelib/plugin/qpluginloader.cpp

Change-Id: I866feaaa2a4936ee5389679724c8471a5b4b583d
2020-03-11 11:27:49 +01:00
Friedemann Kleint
9aa2932701 Polish the Mandelbrot Example
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>
2020-03-10 08:15:15 +01:00
Jarek Kobus
50d2acdc93 Add default arguments to QPainterPath methods using transform
Fixes: QTBUG-82602
Change-Id: Id82f145ffb33e6d4ef9b81282ad14657b1c8fbd0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-03-06 21:09:48 +01:00
Paul Wicking
a2446c0eed Doc: Let SQL Drill Down example show correct use of qgraphicsitem_cast
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>
2020-03-06 08:12:52 +01:00
Oliver Wolff
7c7bd44669 examples: Fix build for configurations that do not have printsupport
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>
2020-03-05 15:11:36 +01:00
Lars Knoll
2a4b957789 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I99ee6f8b4bdc372437ee60d1feab931487fe55c4
2020-03-04 14:39:18 +00:00
Assam Boudjelthia
b711ee2555 Examples: add scrollbar to allow viewing all options on Android
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>
2020-03-03 19:35:46 +02:00
Assam Boudjelthia
e5f4e14059 Examples: enable HighDPI scaling for examples on Android
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>
2020-03-03 19:35:11 +02:00
Mårten Nordheim
8f8eb99991 QNetworkReply: Deprecate 'error' signal, use 'errorOccurred' instead
[ChangeLog][Deprecation Notice] QNetworkReply::error() (the signal) is deprecated; superseded by errorOccurred()

Change-Id: I4f1ef410fd22d34ddf87e89cc5709cc60703af95
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-03 18:25:57 +01:00
Qt Forward Merge Bot
63312fe2ec Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: If36d96c0fef3de5ab6503977501c55c62a2ecc97
2020-03-03 14:13:02 +01:00
Assam Boudjelthia
873eba3f8b Examples: use QDialog::showMaximaized() for Android
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>
2020-03-03 12:39:56 +02:00
Edward Welbourne
c158f881b3 Docs: Use Qt::SplitBehavior in preference to QString::SplitBehavior
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>
2020-02-28 15:37:11 +01:00
Lars Knoll
a450cce6b6 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I469b0501cc65fc5ce4d797a69ae89405cc69c7f8
2020-02-28 09:48:30 +01:00
Alexander Akulich
4c86e667d2 Revert "QNetworkReply: deprecate the 'error' getter"
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>
2020-02-28 07:21:14 +03:00
Alexander Akulich
cb26a4da69 QAbstractSocket: deprecate 'error' signal, use 'errorOccurred' instead
[ChangeLog][Deprecation Notice] QAbstractSocket::error() (the signal) is deprecated; superseded by errorOccurred()

Change-Id: I11e9c774d7c6096d1e9b37c451cf0b99188b6aad
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-02-27 13:56:45 +01:00
Assam Boudjelthia
86f7d44089 Examples: request Android storage permissions when using QStandardPaths
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>
2020-02-26 23:07:48 +02:00
Alexander Akulich
6d18e4a2b8 Revert "QAbstractSocket: deprecate 'error' member-function"
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>
2020-02-26 23:07:52 +03:00
Qt Forward Merge Bot
75c0ffaf6d Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	examples/network/bearermonitor/CMakeLists.txt
	examples/network/CMakeLists.txt
	src/corelib/tools/qlinkedlist.h
	src/sql/kernel/qsqldriver_p.h
	src/sql/kernel/qsqlresult_p.h
	src/widgets/kernel/qwidget.cpp
	src/widgets/kernel/qwidget_p.h
	tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
	tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
	tests/auto/tools/moc/allmocs_baseline_in.json

Change-Id: I21a3c34570ae79ea9d30107fae71759d7eac17d9
2020-02-26 18:39:21 +01:00
Johan Klokkhammer Helsing
e3f2e7afbb Remove legacy OpenGL examples
They all used QGL (which has been removed).

Task-number: QTBUG-74408
Change-Id: Ied003625f14228b4951002a604fce91eaccec102
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-02-21 09:01:08 +00:00
Johan Klokkhammer Helsing
4b611d649e Move QOpenGLShaderProgram from QtGui to QtOpenGL
Task-number: QTBUG-74409
Change-Id: I20dfafc0c9bf8e2b68b03e171d70c2cb4ad2bfaf
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-02-20 16:11:02 +01:00
Johan Klokkhammer Helsing
012bb039e3 Docs: Remove traces of QGL
The QGL* classes have been removed and the examples ported to QOpenGL, update
the documentation to reflect that.

Task-number: QTBUG-74408
Change-Id: Ibb4787cdeedc05a807d673943b61838f19092234
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-02-20 16:11:02 +01:00
Mårten Nordheim
3742c67041 Remove bearer management from remaining network examples
Because bearer management is going away

Change-Id: I60439c1714e0350b0f2bbef6afc8d2015886135f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-02-19 13:28:00 +01:00
Mårten Nordheim
22c585f0f9 Remove the bearermonitor example
Because bearer management is going away

Change-Id: I64311895c347b3e63df75d10db1673bcfe54f52d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-02-19 13:28:00 +01:00
Mårten Nordheim
57a6c60fb9 Remove usage of bearer management from lightmaps example
Because bearer management is going away

Change-Id: I82f2e67a052fdcdf0dde337f9f69b414681511c4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-02-19 13:28:00 +01:00
Vitaly Fanaskov
3703a28511 QComboBox: remove currentIndexChanged(const QString&)
Fixes: QTBUG-81913
Task-number: QTBUG-81845
Change-Id: I8f24b858ce4e35b495440001d7734cc8f169cd5f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-02-19 11:32:40 +00:00
Liang Qi
b9585277e7 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/corelib/tools/qlinkedlist.h
	src/plugins/platforms/wasm/qwasmintegration.cpp
	src/plugins/platforms/wasm/qwasmscreen.cpp

Change-Id: Iefca7f9f4966bdc20e7052aca736874861055738
2020-02-18 09:26:53 +01:00
Johan Klokkhammer Helsing
00eeed234f Move QOpenGLWidget from QtOpenGL to its own module
Same pattern as QtQuickWidgets. Gets rid of QtOpenGL's dependency on QtWidgets.

Task-number: QTBUG-74409
Change-Id: I4f9b55c23e25a1e0519734037b768a16e870c7d2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-02-18 09:22:51 +01:00
Shawn Rutledge
882f340f62 Deprecate QTabletEvent::device() in favor of deviceType()
The idea is to reserve device() to return a pointer to a QInputDevice
in the future, which is in sync with QQuickPointerEvent::device()
and with QTouchEvent::device().

Change-Id: Ifda6e8aea72d5121955b31bdcbd91bf1bfa4cec4
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2020-02-17 21:39:59 +01:00
Johan Klokkhammer Helsing
f2bbc9c69f Move QOpenGLFrameBufferObject from QtGui to QtOpenGL
Task-number: QTBUG-74409
Change-Id: I817ea6f052fc61a6465d443450c8017ac5d0c0e9
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-02-17 08:01:27 +01:00
Alexandru Croitor
d4c8ad79c4 Merge "Merge remote-tracking branch 'origin/wip/cmake' into dev" 2020-02-14 14:55:04 +01:00
Paul Wicking
b26b40f7e1 Doc: remove link to Qt Quarterly in example
Qt Quarterly 31 was the last edition of Qt Quarterly to be
published exclusively as a PDF. We cannot fix the typo in the
PDF. As the content is >10 years old an in an unmaintained
archive section, remove the reference to it from this example.

Fixes: QTBUG-81972
Change-Id: I41a82487ff89dbe8ea5701c02c51e7f7c79bf73d
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2020-02-14 13:59:17 +01:00
Alexandru Croitor
c53ee1f054 Merge remote-tracking branch 'origin/wip/cmake' into dev
Conflicts:
	tests/manual/rhi/hellominimalcrossgfxtriangle/CMakeLists.txt

Hopefully final merge from wip/cmake, and then all cmake changes
should target dev directly.

Change-Id: I29b04c9b0284e97334877c77a32ffdf887dbf95b
2020-02-13 23:29:51 +01:00
Christian Ehrlicher
8471d267f1 QtSql: remove compat SQL plugin names
Remove the compat SQL plugin names (QMYSQL3, QOCI8, QODBC3, QPSQL7)
since they are not needed and just confuse the user

[ChangeLog][QtSql] The compat plugin names QMYSQL3, QOCI8, QODBC3 and
QPSQL7 are no longer available.

Change-Id: I6d88f449ef3e18881a6970fb374ba0ab074ef302
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2020-02-13 22:42:26 +01:00
Liang Qi
6b2535ea15 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	examples/widgets/graphicsview/boxes/scene.h
	src/corelib/Qt5CoreMacros.cmake
	src/corelib/Qt6CoreMacros.cmake
	src/network/ssl/qsslsocket.cpp
	src/network/ssl/qsslsocket.h
	src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
	src/testlib/CMakeLists.txt
	src/testlib/.prev_CMakeLists.txt
	tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp

Disabled building manual tests with CMake for now, because qmake
doesn't do it, and it confuses people.

Done-With: Alexandru Croitor <alexandru.croitor@qt.io>
Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io>
Change-Id: I865ae347bd01f4e59f16d007b66d175a52f1f152
2020-02-13 18:31:40 +01:00
Alexandru Croitor
0d177053b9 Regenerate projects one last time before merge
Change-Id: Ia24cf56b79ca6dacd370a7e397024e9b663e0167
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-12 17:30:49 +00:00
Jan Arve Sæther
5e83a2eed2 Deprecate one overload of QInputDialog::getDouble() for 5.15
...and merge the two overloads of getDouble() in Qt6

Change-Id: I55faa2ff222b41e48889a0ef14dd00a6da691c36
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-02-12 16:10:24 +01:00
Alexander Akulich
c08b0cec2f QLocalSocket: Deprecate 'error' signal, use 'errorOccurred' instead
[ChangeLog][Deprecation Notice] QLocalSocket::error() (the signal) is deprecated; superseded by errorOccurred()

Change-Id: I579c07564f5c470cf2867864755e0a26e6afce3b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-02-11 16:54:59 +03:00
Alexandru Croitor
f1ae5ae726 Merge "Merge remote-tracking branch 'origin/wip/cmake' into dev" 2020-02-11 10:19:42 +01:00
Alexandru Croitor
3af9d49bb7 Merge remote-tracking branch 'origin/wip/cmake' into dev
Change-Id: If75ae006db6eb977cf66af4c3d36cb5c8098a1f1
2020-02-10 18:35:07 +01:00
Vitaly Fanaskov
e59094cb86 QSpinBox: remove deprecated signal valueChanged(const QString &)
Task-number: QTBUG-81845
Change-Id: I91148cac553f63b44968337ccc121e7376ee4465
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2020-02-10 18:28:47 +01:00
Vitaly Fanaskov
9cc8949cc6 QComboBox: remove deprecated signals
The following signals have been removed:
- void activated(const QString &);
- void highlighted(const QString &);

Task-number: QTBUG-81845
Change-Id: I61b552d9258987d4252202953aaf4909f9bd718e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2020-02-10 18:28:45 +01:00
Jan Arve Sæther
f415c5ad23 Remove unused variable
Change-Id: I774b1647eff5fcfa0de5bcc50ca2638644b03613
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-02-10 15:04:39 +01:00
Alexandru Croitor
1c571e5fe7 Merge "Merge remote-tracking branch 'origin/wip/cmake' into dev" 2020-02-07 18:19:51 +00:00
Alexandru Croitor
7610805879 Regenerate examples
Change-Id: I04b2adbe370ffea81d7787ad90e4ae69d2c165cb
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-04 18:50:39 +00:00
Qt Forward Merge Bot
97417e8f28 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	.qmake.conf
	examples/widgets/widgets/imageviewer/imageviewer.cpp
	src/corelib/text/qchar.cpp
	src/corelib/time/qdatetime.cpp

Change-Id: I9762f5c4ff650799219729d6aee79ac07ce9024a
2020-02-04 10:44:00 +01:00
Giuseppe D'Angelo
c29fac453f Markdown importer: use Unicode decoding
Given we feed UTF-8 data into the importer, it must be able to cope
with Unicode. Build md4c with UTF-8 support, advertise it at
usage site, and change a couple of broken decodings.

Driveby: the textedit example used the wrong codec to decode
a Markdown file. While the Markdown spec doesn't deal with encodings,
using the default one for HTML is certainly wrong. Port the loading
of both markdown and plaintext to UTF-8, as that what _saving_
via QTextDocumentWriter would use by default.

Change-Id: I51c6214cfe45ebfc5a67a7366f7866a5328366ec
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-02-03 14:58:00 +01:00
Vitaly Fanaskov
0b325602b1 QButtonGroup: remove deprecated signals
Task-number: QTBUG-80906
Change-Id: I6f697b0a070ba4c401117fe7cdf02429b47d9a11
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2020-02-02 02:05:49 +01:00
Sze Howe Koh
b90eaa3bb5 Examples: Replace deprecated QLabel API
Task-number: QTBUG-48701
Change-Id: I6fc875a35dfc3bf4d906d0f0e495c18ef566d1e1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-02-01 07:31:01 +08:00
Christian Ehrlicher
c7f59cad19 Examples: fix compile without printsupport
Checking for QT_CONFIG(printdialog) is not enough when printsupport is
completely disabled since then the macro will throw an error. Therefore
add an additional check 'defined(QT_PRINTSUPPORT_LIB)' before using the
QT_CONFIG macro.

Fixes: QTBUG-81626
Change-Id: Ie9898f057cdd6bf9daf4ba9135987cb6e901e7bf
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-01-31 06:23:58 +01:00
Alexandru Croitor
43d2b60a29 Post-merge fixes
Change-Id: I6acd29103f6cc550544e7422328d97ea0e2dcafb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-30 20:45:08 +00:00
Edward Welbourne
2130d282b1 Change examples and snippets to pass QDate and QTime by value
They're value types, so we should show them being used as such.

Change-Id: If9f0c366fac66306b7861f04e2f047540d444acc
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2020-01-30 13:32:57 +01:00
Topi Reinio
5d82cbcfc3 Doc: Specify install path for Vulkan examples
Vulkan examples, although part of the Qt GUI documentation project,
live under their own directory under /examples. Mark the correct
install path for these using the \meta command.

Fixes: QTBUG-81360
Change-Id: I0b98a19bf56d5b1953dbd90c0d5103be9041689a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-01-30 10:42:57 +00:00
Alexandru Croitor
a1dbdcbd6e Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts:
        src/corelib/Qt5CoreConfigExtras.cmake.in
        src/corelib/Qt5CoreMacros.cmake
        src/dbus/Qt5DBusConfigExtras.cmake.in
        src/widgets/Qt5WidgetsConfigExtras.cmake.in

Change-Id: Ib782f3b177c38b2cce83beebe15be9c0baa578f7
2020-01-29 16:57:27 +01:00
Simon Hausmann
a4ea0d9eac Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ia5727ce68001bcaab467f5fae3a4933d1217015f
2020-01-28 18:27:28 +01:00
Qt Forward Merge Bot
558fc903ac Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/corelib/io/qsettings.cpp
	src/corelib/kernel/qvariant.cpp
	src/corelib/serialization/qjsoncbor.cpp
	src/corelib/serialization/qjsonvalue.cpp
	src/corelib/tools/tools.pri
	src/gui/image/qimage.cpp
	src/gui/kernel/qguivariant.cpp
	src/widgets/kernel/qshortcut.cpp
	tests/auto/tools/moc/allmocs_baseline_in.json
	tests/auto/tools/moc/tst_moc.cpp
        src/opengl/qglframebufferobject.cpp

Done-With: Edward Welbourne <edward.welbourne@qt.io>
Done-With: Leander Beernaert <leander.beernaert@qt.io>
Change-Id: Ie7f5fa646c607fe70c314bf7195f7578ded1d271
2020-01-28 14:14:20 +00:00
Christian Ehrlicher
fb7c9dfc06 QButtonGroup: deprecate overloaded signals
Deprecate the overloaded signals
buttonClicked/buttonPressed/buttonReleased/buttonToggled taking an int
to avoid to need to use QOverload<> when connecting the signal. The id
of a button in a button group can be easily fetched with
QButtonGroup::id().

Task-number: QTBUG-80906
Change-Id: Idaaab54bbcb25cba543fc99f305b9f4743ee3ed8
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-01-28 06:24:25 +01:00
Jarek Kobus
4bb897a384 Deprecate all methods that use QMatrix
Don't use QMatrix in implementation classes anymore.

Task-number: QTBUG-46653
Fixes: QTBUG-81627
Change-Id: I4806c1302e42645dc6a608062c8d9c336ae8629b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-01-28 04:12:25 +01:00
Sze Howe Koh
582311d122 Doc: Replace some usages of 0/zero/null with \nullptr
Change-Id: Ibe7de11fc6fc41477c35e7d653c6a911855deabb
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-01-27 21:31:08 +08:00
Leander Beernaert
48c82e90af Post Merge Fixes
Change-Id: I1e06c01b76b119c3f23b6e6ecbaae8df719b70ce
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-24 12:29:18 +00:00
Leander Beernaert
502d3d6744 Merge remote-tracking branch 'origin/dev' into merge-dev
Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
2020-01-24 13:17:33 +01:00
Friedemann Kleint
3939640965 Fix some qdoc-warnings
src/corelib/tools/qmap.cpp:1199: (qdoc) warning: Can't link to 'QMultiMap::unite()'
src/gui/kernel/qevent.cpp:949: (qdoc) warning: Unknown command '\see'
src/gui/painting/qpaintengine_raster.cpp:344: (qdoc) warning: clang found diagnostics parsing \fn Type QRasterPaintEngine::type() const
    error: unknown type name 'Type'
src/gui/doc/src/qtgui.qdoc:45: (qdoc) warning: Can't link to 'Build with CMake'
examples/widgets/doc/src/gallery.qdoc:28: (qdoc) warning: Cannot find file 'widgets/gallery/gallery.pro' or 'widgets/gallery/gallery.pyproject'
src/widgets/kernel/qwidget.cpp:5950: (qdoc) warning: Can't link to 'setFilePath'
src/widgets/kernel/qshortcut.cpp:542: (qdoc) warning: No such parameter 'context' in QShortcut::QShortcut()

Change-Id: I2395af854efebef719d4762da466f69f7c5aab9e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-01-24 08:13:03 +01:00
Olivier Goffart
73d1476fb1 Replace most use of QVariant::type and occurrences of QVariant::Type
I made a clazy automated check that replaced the use of QVariant::Type
by the equivalent in QMetaType.
This has been deprecated since Qt 5.0, but many uses were not yet removed.

In addition, there was some manual changes to fix the compilation errors.

Adapted the Private API of QDateTimeParser and QMimeDataPrivate
and adjust QDateTimeEdit and QSpinBox.

QVariant(QVariant::Invalid) in qstylesheet made no sense.

But note that in QVariant::save, we actually wanted to use the non-user type.

In the SQL module, many changes were actually reverted because the API
still expects QVarient::Type.

Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-01-23 16:46:51 +01:00
Johan Klokkhammer Helsing
f3ecda32e0 Move QOpenGLPaintEngine and related classes from QtGui to QtOpenGL
Also moves the openglwindow test to the opengl folder, as it makes use of these
classes.

Task-number: QTBUG-74409
Change-Id: Id9f0013cedcc8bd1e87122c005641d7298525045
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-01-22 09:40:59 +01:00
Qt Forward Merge Bot
35a461d026 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I68702c9f9680772d332b5bb777ddd2663168abd5
2020-01-19 01:00:10 +01:00
Qt Forward Merge Bot
3e9f8b5249 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I12148e7b20bcdb72d9b328035d528c99633b1e92
2020-01-18 01:00:08 +01:00
Qt Forward Merge Bot
0a4e5bb265 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/widgets/kernel/qshortcut.cpp
	tests/auto/network/access/spdy/tst_spdy.cpp

Change-Id: If76c434beac2c0a393440aa365f89f77439774ce
2020-01-16 11:20:42 +01:00
Topi Reinio
e05511a364 Pad Navigator example: Remove duplicated property animations
The example created two QPropertyAnimation instances that controlled
the same property; this caused a clash for some transitions.

Remove the smoothFlipXRotation and smoothFlipYRotation animations;
they are not needed as equivalent animations are already set as
defaults for the state machine.

Fixes: QTBUG-28081
Change-Id: Ifa7a09d48cd4905df720e3327914320ed74ebae6
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-01-16 10:24:06 +01:00
Johan Klokkhammer Helsing
4772a2da15 Move QOpenGLWindow from QtGui to QtOpenGL
Task-number: QTBUG-74409
Change-Id: If7d27cdfa2c6cd5b167887ad77b9cfe413cb106a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-01-15 15:38:59 +01:00
Qt Forward Merge Bot
d14fd32d40 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
	tests/auto/network/access/spdy/tst_spdy.cpp

Change-Id: I3196c5f7b34f2ffc9ef1e690d02d5b9bb3270a74
2020-01-15 10:14:05 +01:00
Qt Forward Merge Bot
c3123c757a Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I8dbcf23835d52d3aa7d018ed250814d60c68aa83
2020-01-15 01:00:39 +01:00
Friedemann Kleint
4e93e3b574 Add documentation for the widget gallery
Task-number: PYSIDE-1112
Change-Id: I35fe85d8ac9c2dab9f1260d3736c7f65e8e45d8e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-01-14 14:52:09 +01:00
Mårten Nordheim
f494e8b58d Build the securesocketclient example for other SSL backends
Change-Id: I06b8361c116d2ae2aa2a64f63ac90b6ff1982008
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
2020-01-14 09:44:28 +01:00
Tor Arne Vestbø
0a93db4d82 Unify application palette handling between QGuiApplication and QApplication
The logic is now mostly handled in QGuiApplication, with QApplication
only dealing with the widget-specific palettes and interaction between
the style and the palette.

The application now picks up changes to the platform theme and will
re-resolve the current application palette appropriately. This also
works even if an explicit application palette has been set, in which
case any missing roles are filled in by the theme.

The palette can now also be reset back to the default application
palette that's fully based on the theme, by passing in the default
constructed palette (or any palette that doesn't have any roles set).
This is also correctly reflected in the Qt::AA_SetPalette attribute.

Conceptually this means QGuiApplication and QApplication follow the
same behavior as QWidget, where the palette falls back to a base or
inherited palette for roles that are not set, in this case the theme.

Behavior-wise this means that the default application palette of the
application does not have any roles set, but clients should not have
relied on this, nor does QWidget rely on that internally.

It also means that setting a palette on the application and then
getting it back again will not produce the same palette as set,
since the palette was resolved against the theme in the meantime.
This is the same behavior as for QWidget, and although it's a
behavior change it's one towards a more sane behavior, so we
accept it.

[ChangeLog] Application palettes are now resolved against the platform's
theme palette, the same way widget palettes are resolved against their
parents, and the application palette. This means the application palette
reflected through QGuiApplication::palette() may not be exactly the same
palette as set via QGuiApplication::setPalette().

Change-Id: I76b99fcd27285e564899548349aa2a5713e5965d
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-01-13 16:53:05 +01:00
Timur Pocheptsov
ccb2cb84f5 QNetworkReply: deprecate the 'error' getter
To disambiguate &QNetworkReply::error expression.

[ChangeLog][Deprecation Notice] QNetworkReply::error() (the getter) was deprecated; superseded by networkError().

Task-number: QTBUG-80369
Change-Id: I545f963788bce0800c9e0f0c94d5f1029946effe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-01-13 15:50:47 +01:00
Friedemann Kleint
caab0ad357 Fix Mandelbrot Example documentation with regards to qRegisterMetaType()
The call to qRegisterMetaType() has been removed since the type
is registered as a meta type in Qt 5. Assert on the meta type id instead.
Adapt the documentation accordingly.

Fixes: QTBUG-81254
Change-Id: I0cb459d0dda7a82fc37871605ff634004af0f9f9
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-01-13 12:50:03 +01:00
Qt Forward Merge Bot
cccc9d0b95 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp

Change-Id: I4d3041fa291a918c774ffa5eb5c8792a0966451d
2020-01-13 10:13:01 +01:00
Timur Pocheptsov
94b3dd77f2 QAbstractSocket: deprecate 'error' member-function
The one that is a getter for the last error found. This is to disambiguate
the expression '&QAbstractSocket::error'. Introduce a new member-function
socketError as a replacement.

[ChangeLog][Deprecation Notice] QAbstractSocket::error() (the getter) is deprecated; superseded by socketError().

Task-number: QTBUG-80369
Change-Id: Ia2e3d108657aaa7929ab0810babe2ede309740ba
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-01-10 12:54:53 +01:00
Qt Forward Merge Bot
0dc5562fa4 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I784e23d7913294225686879c9bd77dafe3580bac
2020-01-10 01:01:15 +01:00
Liang Qi
a59c768489 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/corelib/kernel/qobject.cpp

Change-Id: I4780b25665672692b086ee92092e506c814642f2
2020-01-09 20:30:39 +01:00
Sona Kurazyan
89c4bb5f24 Deprecate QJsonDocument methods for converting to/from JSON binary
Also remove the example code for deprecated methods and use CBOR instead
where it makes sense.

Task-number: QTBUG-81068
Change-Id: Iffb7a4b3d7b16a1e485fc05b3ab2e2468e9e0718
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-01-09 13:52:25 +01:00
Friedemann Kleint
7b0f341872 Add a widget gallery example
Since 072ca960f5 changed the default
of the styles example back to Norwegian Wood, it is no longer
suited as gallery example.

Extract the dialog from it and re-add it as a gallery example Add a
tooltip displaying the class name and a help shortcut opening the
documentation.

Restructure the group boxes to add more widgets.

Remove the gallery meta-tag from the styles example.

Task-number: PYSIDE-1112
Change-Id: Ie6f13084012771bd8f5bf9cad23b58d0720fdd92
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
2020-01-09 13:52:25 +01:00
Nico Vertriest
22942058aa Doc: Correct qdoc compilation errors qtbase
Task-number: QTBUG-79824
Change-Id: I4be365d92b1adfde09efd04d088f75c506666a95
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2020-01-09 02:33:08 +01:00
Friedemann Kleint
75391511ff Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ia2ce994c42adc010c453edaeea57f672556958f6
2020-01-07 08:34:53 +01:00
Qt Forward Merge Bot
68c30e372b Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2020-01-06 20:13:31 +00:00
Sona Kurazyan
82d02b7b95 Deprecate SAX classes in Qt XML
Deprecated the SAX classes and disabled or replaced their uses in
tests if applicable.

Removed the saxbookmarks example, no point in keeping examples for
the deprecated code.

[ChangeLog][QtXml] SAX classes are now deprecated. Use QXmlStreamReader,
QXmlStreamWriter in QtCore instead.

Task-number: QTBUG-76177
Change-Id: Ic171d62fa0527b0f36f94cf09a69586092269957
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2020-01-06 18:13:01 +01:00
Qt Forward Merge Bot
3a010f72b8 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/corelib/kernel/qvariant.h

Change-Id: I8f3873e74b9795ac889e7c7ec5de2619bca92160
2020-01-06 07:20:18 +00:00
Liang Qi
a503bf5470 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/corelib/tools/qvector.h
		Make QVector(DataPointer dd) public to be able to properly merge
		5b4b437b30 from 5.15 into dev.
	src/widgets/kernel/qapplication.cpp
	tests/auto/tools/moc/allmocs_baseline_in.json

Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Change-Id: I929ba7c036d570382d0454c2c75f6f0d96ddbc01
2020-01-04 15:32:34 +01:00
Friedemann Kleint
71477104eb Fix some qdoc warnings
src/corelib/serialization/qjsonvalue.cpp:174: (qdoc) warning: No such parameter 'n' in QJsonValue::QJsonValue()
...
examples/widgets/doc/src/icons.qdoc:584: (qdoc) warning: Command '\snippet (//! [24])' failed at end of file 'widgets/icons/mainwindow.cpp'
src/corelib/text/qbytearray.cpp:5177: (qdoc) warning: clang found diagnostics parsing \fn QByteArray::FromBase64Result::operator QByteArray() const
    error: out-of-line definition of 'operator QByteArray' does not match any declaration in 'QByteArray::FromBase64Result'
src/corelib/serialization/qjsonarray.cpp:178: (qdoc) warning: Overrides a previous doc
src/corelib/serialization/qjsonarray.cpp:140: (qdoc) warning: (The previous doc is here)
src/corelib/serialization/qjsonobject.cpp:1016: (qdoc) warning: clang found diagnostics parsing \fn QJsonValueRef QJsonObject::iterator::operator[](int j) const
    error: out-of-line definition of 'operator[]' does not match any declaration in 'QJsonObject::iterator'
src/corelib/serialization/qjsonobject.cpp:1267: (qdoc) warning: clang found diagnostics parsing \fn QJsonValue QJsonObject::const_iterator::operator[](int j) const
    error: out-of-line definition of 'operator[]' does not match any declaration in 'QJsonObject::const_iterator'
src/corelib/tools/qhash.cpp:2641: (qdoc) warning: Overrides a previous doc
src/corelib/tools/qhash.cpp:1492: (qdoc) warning: (The previous doc is here)
src/corelib/tools/qhash.cpp:2659: (qdoc) warning: Can't link to 'unit()'
src/corelib/text/qchar.cpp:274: (qdoc) warning: Undocumented enum item 'Script_Sundanese' in QChar::Script
src/corelib/text/qchar.cpp:274: (qdoc) warning: No such enum item 'Script_Sundaneseo' in QChar::Script
src/network/ssl/qsslsocket.cpp:1514: (qdoc) warning: Can't link to 'QSslConfiguration::addDefaultCaCertificate()'
src/widgets/widgets/qtabwidget.cpp:581: (qdoc) warning: Undocumented parameter 'visible' in QTabWidget::setTabVisible()

Change-Id: I05c2a4884873850b684fa94036cd90db1a6e7726
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-01-03 14:59:26 +01:00
Tor Arne Vestbø
05e5306787 styles example: Implement standarPalette()
Instead of polishing the (possible) system palette. Makes the checkbox
for "Use style's standard palette" actually work for the custom style,
and is how styles are supposed to provide their own preferred palette.

Change-Id: I3228ef45c023d0d058e48ff0fc14f094367b2008
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-01-02 14:14:38 +01:00
Liang Qi
ee71a9ba81 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/network/ssl/qsslsocket.cpp
	src/widgets/kernel/qapplication.cpp

Change-Id: Ib7421cc2df59d0969f89b3fbd65a17ea76ffef3b
2019-12-16 07:05:19 +01:00
Olivier Goffart
d6266c757d Replace usages of QVariant::value by qvariant_cast
This is done automatically with a clazy check

Change-Id: I3b59511d3d36d416c8eda74858ead611d327b116
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-12-15 12:30:52 +01:00
Tor Arne Vestbø
072ca960f5 styles example: Set default style up front, and react to style changes
Allows running the example with -style foo or QT_STYLE_OVERRIDE.

No changes to documentation needed.

Change-Id: Id7cef450f13faabd118badde51afb7273439c9fc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-12-12 23:24:29 +01:00
Johan Klokkhammer Helsing
d107706ab9 Move QOpenGLWidget from QtWidgets to QtOpenGL
Task-number: QTBUG-74409
Change-Id: I98a4f8a9e1d439bfdc24eb2910385273cedecd29
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-12-12 16:06:31 +01:00
Qt Forward Merge Bot
5b193e3dd4 Merge "Merge remote-tracking branch 'origin/5.15' into dev" 2019-12-11 14:52:25 +01:00
Johan Klokkhammer Helsing
f08038fca7 Remove deprecated QGL* classes
Removes QGL paths in sub-attaq and chip examples.

The boxes example depended on QGL and has been removed.

The corresponding module and test directories for the opengl module are now
empty, but has been left there so we can move the QOpenGL* classes there.

[ChangeLog][QtOpenGL] The deprecated QGL* classes have been removed.

Fixes: QTBUG-74408
Change-Id: I52f56409af8f6901359462a7ba162103d051fe3d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-12-11 11:53:15 +01:00
Liang Qi
90210d5d9c Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	tests/auto/network/kernel/qnetworkinterface/BLACKLIST

Change-Id: I1e8866c63b54bcd95fc2a044276ee15b7f60e79a
2019-12-10 13:51:40 +02:00
Eirik Aavitsland
191ac31598 Modernize shapedclock example
Relying on the hard clipping of QRegion widget masks to create
non-rectangular windows is a solution from a bygone era. The result
looks horrible with today's eyes, particularly on a high-dpi
screen. Update the example to create smooth anti-aliased edges using
translucent window bacground.

Task-number: QTBUG-64229
Change-Id: I8859d61177d2a2dc446632c23f27f42050e0d7c7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-12-10 00:38:40 +01:00
Ulf Hermann
e62d04b933 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/corelib/serialization/qcborvalue.cpp

Change-Id: I675a3029955c96e81a33ed9d98b72b55b6784b52
2019-12-03 06:57:05 +01:00
Friedemann Kleint
9a82a29000 Styles example: Use system style per Default
The example is useful as a gallery for widgets in
which case the custom Norwegian Wood style is not primarily interesting.

Change-Id: I96e304f97edeb43da6e8f572e01a768b1317722c
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2019-11-25 19:31:56 +01:00
Friedemann Kleint
4ac8505778 Show the styles example under 'gallery' on Qt Creator's example screen
Add meta tag 'gallery'.

Change-Id: I8d670d6eb7641bdc82944a85b7335eee26bcc573
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2019-11-23 11:32:14 +01:00
Allan Sandfeld Jensen
af2daafde7 Deprecate constructing QFlags from a pointer
This was used to support QFlags f = 0 initialization, but with 0 used
as a pointer literal now considered bad form, it had been changed many
places to QFlags f = nullptr, which is meaningless and confusing.

Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-11-20 19:43:38 +01:00
Leander Beernaert
26e8769124 Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: Ifecc2d9db396d783124df8567553ba5f846f30bb
2019-11-19 13:53:21 +01:00
Friedemann Kleint
d17094df60 Sub-Attaq: Fix compilation with -no-opengl
Add missing include removed by 13426aff24.

Fixes: QTBUG-80163
Change-Id: I6b81f399a3abf637a2023700baac09b631d652d5
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-11-18 15:45:41 +01:00
Qt Forward Merge Bot
adc7bbe910 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/gui/rhi/qshader.cpp
	tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp

Change-Id: I1c4ae718eb3592a0a0a90af9d11553f3ab68cad5
2019-11-15 16:29:40 +01:00
Liang Qi
d140f2f614 Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	examples/widgets/widgets/scribble/mainwindow.cpp
		This amends cb54c16584.

Change-Id: Iaae60a893330524b2973917e23b31f9d51f8bd38
2019-11-13 07:21:33 +01:00
Qt Forward Merge Bot
78c687f98e Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I963b5f48b5d6f3500ca379fbd7f1a4290b570175
2019-11-08 09:11:02 +01:00
Volker Hilsheimer
33f1eb50e2 Fix build of the sub-attaq example
QMenuBar is only forward declared in QMainWindow. I don't think this is
a recent change or breakage, just noticed then when running a complete
build of the 5.15 branch.

Change-Id: Ia1a072044bd26c5f3f51ec5f5b0f72f065a0576f
Reviewed-by: Johanna Äijälä <johanna.aijala@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-11-07 13:35:21 +02:00
Qt Forward Merge Bot
e3cc16e9fb Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	.qmake.conf
	mkspecs/features/mac/default_post.prf
	src/corelib/tools/qsimd_p.h
	src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
	util/qfloat16-tables/gen_qfloat16_tables.cpp

Change-Id: If48fa8a3bc3c983706b609a6d3822cb67c1352a4
2019-11-06 11:41:19 +01:00
Christian Ehrlicher
e85de7d787 Cleanup network examples
Cleanup network examples:
 - use nullptr
 - use member-init
 - adjust includes
 - use new-style connects

Change-Id: I80aa230168e5aec88a1bc93bbf49a471bfc30e7b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-11-06 10:57:23 +01:00
Qt Forward Merge Bot
92e888f27e Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Icd98de8592828c60cfea3d69f9c7ae2711b9f059
2019-11-05 01:00:54 +01:00
Christian Ehrlicher
c31cdb1b3f Widget examples: replace QItemDelegate with QStyledItemDelegate
The documentation was forgotten in
5d4b5dab7f

Change-Id: I4e0f8f507199601910a174a080936b9a619048a4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-11-02 13:29:17 +01:00
Qt Forward Merge Bot
ab6affac10 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I256a4b0bac4d2f5eb170967fedc4eccaec8c7f2a
2019-11-02 01:01:12 +01:00
Kavindra Palaraja
312ff6f83b Docs: Fix a typo in the documentation
Change-Id: Ice4d0842883e32f62abd27be826b1caf1c78d3b6
Fixes: QTBUG-55503
Reviewed-by: Frederik Schwarzer <schwarzer@kde.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2019-11-01 08:00:57 +01:00
Qt Forward Merge Bot
7a13a09116 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ic13ef00d76c81295076bb2432576db70ec84fe29
2019-11-01 01:00:45 +01:00
Albert Astals Cid
f121f319b9 examples: Fix -Wdeprecated-copy warnings
examples/corelib/tools/customtypesending/window.cpp: In member function ‘void Window::sendMessage()’:
examples/corelib/tools/customtypesending/window.cpp:79:71: warning: implicitly-declared ‘Message& Message::operator=(const Message&)’ is deprecated [-Wdeprecated-copy]
   79 |     thisMessage = Message(editor->toPlainText(), thisMessage.headers());
      |                                                                       ^
In file included from examples/corelib/tools/customtypesending/window.h:55,
                 from examples/corelib/tools/customtypesending/window.cpp:52:
examples/corelib/tools/customtypesending/message.h:62:5: note: because ‘Message’ has user-provided ‘Message::Message(const Message&)’
   62 |     Message(const Message &other);
      |     ^~~~~~~
examples/corelib/tools/customtypesending/window.cpp: In member function ‘void Window::setMessage(const Message&)’:
examples/corelib/tools/customtypesending/window.cpp:87:19: warning: implicitly-declared ‘Message& Message::operator=(const Message&)’ is deprecated [-Wdeprecated-copy]
   87 |     thisMessage = message;
      |                   ^~~~~~~
In file included from examples/corelib/tools/customtypesending/window.h:55,
                 from examples/corelib/tools/customtypesending/window.cpp:52:
examples/corelib/tools/customtypesending/message.h:62:5: note: because ‘Message’ has user-provided ‘Message::Message(const Message&)’
   62 |     Message(const Message &other);
      |     ^~~~~~~

Change-Id: I563d53f7dd1e0e0dc5fd4db06299b2d0a70c62ff
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-10-30 07:46:35 +02:00
Qt Forward Merge Bot
cd04181b2b Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I7f11733bda960196a96c6452bdabeb7072a8430d
2019-10-30 01:00:33 +01:00
Paolo Angelelli
ba2ee2875a Fix computegles31 example crashing on Pi4
Due to work group size configured for desktop GL.

Change-Id: Id62cf297e280e04aecba748cf41b62c64ed9a0b2
Done-with: Andrey Yaromenok <ayaromenok@gmail.com>
Fixes: QTBUG-79374
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-10-29 10:48:35 +00:00
Christian Ehrlicher
5d4b5dab7f Widget examples: replace QItemDelegate with QStyledItemDelegate
Replace QItemDelegate with QStyledItemDelegate in the examples since
QItemDelegate is deprecated.
Also fix up some unused documentation snippet references.

Change-Id: I42b8780ad0c317b9a253cc722d0b471695ed253f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-10-28 19:36:32 +02:00
Qt Forward Merge Bot
ab5153aa0b Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I5b671c89ceb8998b37f99d58df0e0a9e5785e3ad
2019-10-19 01:01:03 +02:00
Qt Forward Merge Bot
dce8849037 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I4fbbf100b673ab100997dbf2f42bf195dc3c050f
2019-10-18 01:00:35 +02:00
Simon Hausmann
02164e0288 Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: Ia1da879a7bd8f71a649661a1844144dd67d60b3a
2019-10-17 09:41:36 +02:00
Qt Forward Merge Bot
6f27bb1352 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ica69de99be9c8af4d28a52e4b69e6af748ed983c
2019-10-17 01:01:01 +02:00
Christian Ehrlicher
d5c4cd7a25 Examples: fix compiling tablet example on qnx
std::abs(int) is defined in cstdlib which is not included on QNX.

Fixes: QTBUG-78763
Change-Id: I14d087069369db7ab4e5db9d4f816a3fbffe95f6
Reviewed-by: Johanna Äijälä <johanna.aijala@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-10-16 09:18:04 +02:00
Qt Forward Merge Bot
faab18c65a Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ifd83db69416230175ddc3161f640b612755018fc
2019-10-16 01:00:49 +02:00
Sona Kurazyan
9cc040a806 Prepare for deprecating the QDesktopWidget
QDesktopWidget is marked as obsolete in docs, but it is not yet
completely deprecated, some of its methods are still in use.

Replace uses of the following methods marked as obsolete:
- QDesktopWidget::screenNumber(QWidget*) -> QWidget::screen()
- QDesktopWidget::screenGeometry(QWidget*) -> QWidget::screen()->geometry()
- QDesktopWidget::availableGeometry(QWidget*) -> QWidget::screen()->availableGeometry()

Task-number: QTBUG-76491
Change-Id: I2cca30f2b4caa6e6848e8190e09f959d2c272f33
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-15 20:09:29 +02:00
Alexandru Croitor
440286655e Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: I4a78428a8ea273b6960792e3b8043f816fa37fcf
2019-10-14 17:46:34 +02:00
Qt Forward Merge Bot
e164d61ca8 Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I129dd579f92cb2592a38ca043472b45cb926ae12
2019-10-14 01:00:34 +02:00
Qt Forward Merge Bot
8d8140dffa Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I9953c1ca16862184c2373027e946c482ce8e6f0e
2019-10-13 01:00:43 +02:00
Alexandru Croitor
f4b4c4f79b Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I3a1d7673c3c20019ab12a2ea0a60f1619920a34c
2019-10-11 16:23:19 +02:00
Christian Ehrlicher
4af00753fa Cleanup QtWidgets examples
Cleanup QtWidgets examples:
 - use nullptr (clang-tidy)
 - use member-initialization
 - adjust the style
 - fix includes

Change-Id: Ic5448606aacc525ea60b615a69227017aa2b821a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-10-11 06:32:30 +02:00
Shawn Rutledge
f1dd6addda Make QTextBlockFormat::MarkerType an enum class
This came up during API review.

Change-Id: I9198e1eb96db0c21e46a226a032919bb62d3ca66
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-10-10 21:08:08 +02:00
Frederik Gladhorn
d8c3375dbd cmake: add examples/opengl
Fixes: QTBUG-78164
Change-Id: Iccc8bb1354d2362c950de17a6c00e00f95272967
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-07 07:22:17 +00:00
Frederik Gladhorn
331d1cf9fd cmake: add examples/vulkan
Fixes: QTBUG-78216
Change-Id: Id7d936ab0b3febc6b7ad3170ec2ea67836484217
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-10-07 07:22:09 +00:00
Lars Knoll
7e2016de5e Fix compilation
Change-Id: I2f160bf47eb39c9f15fdf6ec0097495f526a6b91
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-04 17:53:43 +02:00
Qt Forward Merge Bot
3a1613c227 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I43393cf47675fd6c14972df1221986335c6f493c
2019-10-04 01:01:48 +02:00
Christian Ehrlicher
26d626436b Widgets flowlayout example: Fix crash on startup
The flowlayout example crashes on startup because the last change
removed a c-style cast which converted -1 to ~0U ...

Fixes: QTBUG-78861
Change-Id: I0dbed4472b4f68a92b3f92763d00d28baa186f9a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-10-03 13:15:47 +02:00
Christian Ehrlicher
5d3e6ef909 Examples/OpenGLWindow: do not use hardcoded indices
Don't use the hardcoded indices 0 and 1 but the ones returned from
QOpenGLShaderProgram::attributeLocation(). Also change them from GLuint
to GLint.

Fixes: QTBUG-43566
Change-Id: I582bcf899f20d90f4ec1cd61326a177aabb69992
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-10-02 08:36:36 +02:00
Qt Forward Merge Bot
8791a8398a Merge "Merge remote-tracking branch 'origin/5.14' into 5.15" 2019-10-01 11:47:42 +02:00
Qt Forward Merge Bot
4e40c54a3c Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I77ba01f09b3dbcaf13cb265a70d9da661c32a61f
2019-10-01 01:01:20 +02:00
Christian Ehrlicher
b0042601ed Cleanup QtOpenGL examples
Cleanup the OpenGL examples
 - use nullptr (clang-tidy)
 - use member-initialization
 - avoid redundant checks for != nullptr when deleting a pointer

Change-Id: I3e4702690ed79e71c3e952d51ceef83b907b45b7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-09-30 22:16:27 +02:00
Liang Qi
99cdd5fc67 Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	src/corelib/global/qrandom.cpp
	src/corelib/io/qfileinfo.cpp
	src/corelib/kernel/qeventdispatcher_win.cpp
	src/corelib/kernel/qeventdispatcher_win_p.h
	src/gui/text/qfontdatabase.cpp
	src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
	src/plugins/platforms/windows/qwindowsglcontext.cpp
	src/testlib/qtestcase.cpp

Done-With: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Done-With: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I4893212471aa24be804c989a581810e2f714545c
2019-09-30 14:43:02 +02:00
Albert Astals Cid
d12bf4eb83 Port two examples from QTime to QElapsedTimer
Change-Id: I23d13bf1e909801797a8fc2785c46f341ef5ee77
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-09-27 18:01:58 +02:00
Leena Miettinen
f92a7c1288 I18N: Load qtbase_ translation catalogs in examples
...instead of the qt_ meta catalogs. The qt_ catalogs
are needed for backwards compatibility and depend on
translations for now deprecated modules, such as qtscript,
that might not be installed in the system. This causes
loading the translation to fail.

Instead of the qt_ catalogs, the examples should use the
translation files for the Qt modules used, here qtbase_.

Task-number: QTBUG-69203
Change-Id: I13f5a3d6653cef8379a712fbc02ec320eea4e51a
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-09-27 13:48:53 +00:00
Qt Forward Merge Bot
15dc8b1d8e Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: I46ec05ade1c84e61f7f45562a218aa9ff55e2975
2019-09-19 21:54:53 +02:00
Christian Ehrlicher
cb54c16584 Cleanup QtWidgets (widgets) examples
Cleanup QtWidgets widgets examples:
 - use member-init (clang-tidy)
 - fix includes/don't include QtWidgets globally
 - include own header first
 - use nullptr (clang-tidy)
 - avoid c-style casts
 - use QVector instead QList

Change-Id: Ib56bb507eb2ef885f1ddc664050d3c7af92adb70
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-09-17 23:05:23 +02:00
Qt Forward Merge Bot
1cfa636fe2 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ie24be82ee70bf103c2664de1a42741979262b10c
2019-09-16 01:00:07 +02:00
Christian Ehrlicher
3fede6cb54 Cleanup QtWidgets (tools) examples
Cleanup QtWidgets tools examples:
 - use member-init (clang-tidy)
 - fix includes/don't include QtWidgets globally
 - include own header first
 - use nullptr (clang-tidy)
 - avoid c-style casts
 - use QVector instead QList
 - use QItemDelegate instead QStyledItemDelegate

Change-Id: Ibe9440cdf711e5cc2138c054864edebe1fc95731
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-09-11 20:36:17 +02:00
Qt Forward Merge Bot
2eead078c8 Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: If8e9d88771243fd9e221b49f53d7d8b111a8ce2a
2019-09-09 09:21:48 +02:00
Christian Ehrlicher
6f4bc3942d Widgets/GraphicsView examples: cleanup
Cleanup GraphicsView examples with the help of clang-tidy
 - modernize-use-nullptr
 - modernize-use-default-member-init
 - modernize-use-override.IgnoreDestructors
 - Some QList -> QVector changes
 - use nullptr
 - use normalized includes, remove unused includes
 - fix style

Change-Id: I79347e55bfde52f6ae7749cc7093fbd442044020
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-09-05 17:40:36 +02:00
Friedemann Kleint
72106832e4 QtWidgets/D&D/dropsite example: Add copy functionality
Add a slot copying the QMimeData contents as text.

Task-number: QTBUG-60635
Change-Id: Ided14fccd8a49029ff1aff64969454ed2232dbeb
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-09-05 10:50:49 +02:00
Friedemann Kleint
60bea1c85a QFileSystemModel: Fix naming of Option enumeration
Fix an API review finding in 5.14, amending
6b9d319b26.

Change-Id: I6c67ebde91021b87a43a86ff831b724f098019aa
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-09-02 13:21:57 +02:00
Liang Qi
0f1f7fb97f Merge remote-tracking branch 'origin/dev' into 5.14
Conflicts:
	src/widgets/kernel/qwidget.cpp
	src/widgets/kernel/qwidget_p.h
	src/widgets/kernel/qwidgetrepaintmanager.cpp
	src/widgets/kernel/qwidgetwindow.cpp
	tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp

Change-Id: Ifae457d0427be8e2465e474b055722e11b3b1e5c
2019-08-27 09:45:52 +02:00
Sona Kurazyan
1b7ce85a60 Remove usages of deprecated APIs of QWheelEvent
- Replaced the usages of deprecated QWheelEvent::delta() and
  QWheelEvent::orientation() with QWheelEvent::angleDelta().
  In most of the examples it is acceptable to use only the vertical
  component of angle delta.

- Made the docs APIs to build conditionally, based on the
  deprecation version.

Task-number: QTBUG-76491
Task-number: QTBUG-76540
Change-Id: Id4230d483f724af49e4b6349b44881c3944de2a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-08-23 21:51:43 +02:00
Leander Beernaert
bf298499a0 Update public CMake macros' version
Update all public Qt macros to use qt6/QT6 instead of qt5/QT6.

Change-Id: Ib178f4fa21f37dfb8da7d4d8c097aa0e96c9d9f9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-23 10:04:30 +00:00
Tor Arne Vestbø
ce73b4db62 Remove dead code from Qt 4 times
The benefit of keeping this code around was to inspire or inform
changes in the areas to take into account possibly missing features
in Qt 5, but at this point that benefit is questionable. We can
always use the history to learn about missing pieces if needed.

Change-Id: I87a02dc451e9027be9b97554427bf8a1c6b2c025
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-08-20 22:27:46 +00:00
Christian Ehrlicher
13426aff24 Cleanup QtWidgets animation examples
Cleanup the QtWidgets animation examples:
 - use nullptr
 - use normalized includes, remove unused includes
 - fix style
 - fix crash of sub-attaq when the game ended (error during range-based
   for loop porting)
 - don't use keyword 'final' for a variable name

Change-Id: Id23be8ff8b1b310da005d13c052fe547f6a0d63a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-08-17 09:51:32 +02:00
Alexandru Croitor
c7ec7cd2a1 Merge branch 'wip/qt6' into wip/cmake
Change-Id: I50ac36b8803c296998149e98cc61e38687cdd14b
2019-08-15 16:53:19 +02:00
Friedemann Kleint
6b9d319b26 QFileSystemModel: Add options
Add Options flags similar to QFileDialog:

- DontWatch: Do not use file system watchers for simple
  use cases like line edit completion. This brings it
  closer to QDirModel, which then can be deprecated.

- DontResolveSymlinks: Similar to
  QFileDialog::DontResolveSymlinks.

- DontUseCustomDirectoryIcons: matching
  QFileIconProvider::DontUseCustomDirectoryIcons for
  convenience.

Task-number: QTBUG-76493
Change-Id: I09d3cb73ef902a700e6ebfba427e2d990fce4b4c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-08-14 15:02:04 +02:00
Marc Mutz
c58ca4256d Deprecate QStringViewLiteral
As a macro, we can't directly deprecate it, but need to make it call
something deprecated. That is a new ctor with a new enum type
added. The type might be useful for other such ventures, so put it
into qglobal.h

Remove the QT_NO_UNICODE_LITERAL protection, as it's always false
these days, and QT_UNICODE_LITERAL is unconditionally #defined a 20
lines above.

[ChangeLog][QtCore][QStringView] Deprecated the (undocumented)
QStringViewLiteral macro. Just use u"" or QStringView(u"") instead.

Change-Id: I9141320225037e1bc6b7f920bf01a9d0144fdac2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-08-10 22:13:49 +02:00
Sona Kurazyan
376715f1a5 Remove usages of deprecated APIs of qtbase/widgets
- Replace the usages of deprecated APIs by corresponding
  alternatives in the library code and documentation.

- Build docs for deprecated APIs conditionally, based on deprecation
  version. Remove the docs of methods deprecated since 5.0.0, these
  methods are not compiled anymore.

- Modify the tests to make them build when deprecated APIs disabled:
    * Make the the parts of the tests testing the deprecated APIs to
      be compiled conditionally, only when the corresponding methods
      are enabled.
    * If the test-case tests only the deprecated API, but not the
      corresponding replacement, add tests for the replacement

Task-number: QTBUG-76491
Task-number: QTBUG-76540
Task-number: QTBUG-76541
Change-Id: I6aaf0a1369c479fb880369a38f2b8e1e86b46934
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-08-01 17:04:13 +00:00
Sona Kurazyan
d914a5ba4e Remove the remaining usages of deprecated APIs of qtbase
This change removes the leftovers form other cleanup commits.

Task-number: QTBUG-76491
Change-Id: I61440f87c5a280f9666b78e19aac4d8ac603767e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
2019-08-01 06:48:27 +02:00
Marc Mutz
082f10c9eb QOpenGLWindow example: use std::unique_ptr instead of QScopedPointer
QScopedPointer is scheduled for deprecation, and can't decide whether
it wants to be a scoped, or a unique pointer.

The use of a unique_ptr members requires that the destructor be
out-of-line, since the payload classes are only forward-declared in
the header file.

Change-Id: Id0dcdde52cb3adc30d3051d2eed1d24c76154921
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-07-25 14:17:51 +00:00
Qt Forward Merge Bot
64df0eda36 Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	src/corelib/global/qlogging.cpp
	src/gui/painting/qtextureglyphcache_p.h
	src/gui/text/qfontengine.cpp
	src/widgets/widgets/qlineedit.cpp

Change-Id: Ic8798538df466b7141caa8bbf1fb7605eb56be37
2019-07-17 10:44:21 +02:00
Sona Kurazyan
2f33e030b8 Remove usages of deprecated APIs of qtbase/gui
- Replaced the usages of deprecated APIs by corresponding
  alternatives in the library code and documentation.

- Modified the tests to make them build when deprecated APIs disabled:
    * Made the the parts of the tests testing the deprecated APIs to
      be compiled conditionally, only when the corresponding methods are
      enabled.
    * If the test-case tests only the deprecated API, but not the
      corresponding replacement, added tests for the replacement.

Change-Id: Ic38245015377fc0c8127eb5458c184ffd4b450f1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-13 10:43:15 +02:00
Qt Forward Merge Bot
77d126ccb5 Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	configure.pri

Also required s/solid\.color/solidColor/ in a couple of places in:
	src/gui/painting/qpaintengine_raster.cpp

Change-Id: I29937f63e9779deb6dac7ae77e2948d06ebc0319
2019-07-12 12:23:29 +02:00
Alexandru Croitor
4dac45c9ee Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I715b1d743d5f11560e7b3fbeb8fd64a5e5ddb277
2019-07-11 17:17:51 +02:00
Volker Hilsheimer
89984a8a61 Fix the systray example to only show an icon when requested
The "None" and "Custom icon" cases where using the same value for icon
type, which resulted in both options showing the application icon.

Use -1 to indicate the custom option, and treat all other options
the same.

Task-number: QTBUG-76916
Change-Id: Ib715f5d328175bd6e221b3f507087954fa542838
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-07-09 18:32:48 +02:00
Sona Kurazyan
9b3e8b32f2 Remove usages of deprecated APIs of corelib
- Replaced the usages of deprecated APIs of corelib by corresponding
  alternatives in the library code and documentation.

- Modified the tests to make them build when deprecated APIs disabled:
    * Made the the parts of the tests testing the deprecated APIs to
      be compiled conditionally, only when the corresponding methods are
      enabled.
    * If the test-case tests only the deprecated API, but not the
      corresponding replacement, added tests for the replacement.

Task-number: QTBUG-76491
Task-number: QTBUG-76539
Task-number: QTBUG-76541
Change-Id: I62ed4a5b530a965ec3f6502c6480808f938921aa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-05 11:25:46 +02:00
Liang Qi
d25c322729 Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	src/network/ssl/qsslsocket_openssl.cpp
	src/platformsupport/vkconvenience/qvkconvenience.cpp

Change-Id: I97ce6ed185f7fdad8102cc58d3cfec0119fd7bb4
2019-07-01 10:21:37 +02:00
Qt Forward Merge Bot
7265fb0597 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I912bd8851c390302414d3dfb3c8220df5a0d5630
2019-06-28 01:00:23 +02:00
Liang Qi
25eb97d2d4 Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	.qmake.conf
	src/network/ssl/qsslsocket_openssl.cpp

Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io>
Change-Id: Ibb57a0548b4977797b400637487a56245ac1c024
2019-06-27 14:38:03 +02:00
Venugopal Shivashankar
e3b3dbbe93 Example: Move the SQL statements
Used const variables for the SQL statements,
so that the code looks similar to its
couterpart in Qt for Python.

Change-Id: If2a505a404deff77d3d37c5ffad913c8c538d0b3
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-06-21 09:14:36 +02:00
Tor Arne Vestbø
244ff33119 styles example: Use QImage instead of QPixmap in NorwegianWoodStyle
Using QImage allows creating the style before the application has
been created, and is the more modern API.

No changes to the documentation needed.

Change-Id: Ifa0e5fa1113802fca18fbd45bb3c0a5ba1dbfeab
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
2019-06-25 20:08:26 +02:00
Liang Qi
bd9959bde2 Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	.qmake.conf
	src/gui/painting/qdrawhelper.cpp
	src/network/ssl/qsslsocket_openssl.cpp
	src/widgets/styles/qstylesheetstyle.cpp

Change-Id: Ibe1cd40f46a823c9e5edbe0a3cd16be1e1686b17
2019-06-20 07:50:44 +02:00
Paul Wicking
6398588338 Doc: Fix typo in brief
Fixes: QTBUG-76512
Change-Id: I8db4288b22416c6af9aaaa72c5005b81d79bf620
Reviewed-by: Martin Smith <martin.smith@qt.io>
2019-06-19 15:18:50 +02:00
Liang Qi
ef37ab9970 Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
	.qmake.conf
	src/gui/painting/qdrawhelper.cpp
	src/gui/text/qdistancefield.cpp
	src/gui/text/qdistancefield_p.h
	src/network/ssl/qsslsocket_openssl.cpp
	src/plugins/platforms/android/qandroidinputcontext.cpp
	src/widgets/styles/qstylesheetstyle.cpp

Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io>
Change-Id: Ia7daad21f077ea889898f17734ec46303e71fe6b
2019-06-25 13:04:27 +02:00
Alexandru Croitor
fe3bd212fc Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
This changes many different CMake places to mention Qt6 instead of
Qt5.

Note that some old qt5 cmake config files in corelib are probably not
needed anymore, but I still renamed and kept them for now.

Change-Id: Ie69e81540386a5af153f76c0242e18d48211bec4
2019-06-14 16:31:09 +02:00
Simon Hausmann
efa9998521 Fix compiling of examples on Android
* Simplify add_qt_gui_executable() to not require WIN32/MACOSX_BUNDLE
  but provide it implicitly. It's redundant :)

* When on Android, build a module (shared library), just like qmake.
  This requires an additional library destination in the install() call,
  but that's ignored on other platforms.

* Fix typos in the android deployment generation settings function

* Use the correct cache variable to determine whether we're inside a Qt
  build or not. Right now this only works inside Qt builds anyway as
  QtPlatformAndroid.cmake is not publically accessible.

Change-Id: If1c763c31a7a83d0e0d854362ba7901657f63eb5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-06-12 14:19:53 +00:00
Simon Hausmann
6732fa3a29 Fix linking of examples
Provide add_qt_gui_executable() as function in our public API that takes
care of automaticWinMain linkage. We can use this in the future to
encapsulate similarplatform-specific behavior and adjustments, such as
module generation onAndroid.

In order for the examples to see the function in Qt5CoreMacros, three more
additional fixes were required:

    * Do the build_repo_end() call _before_ attempting to build the
      examples, as we need the build_repo_end() to include QtPostProcess
      and complete the creation of all the target config files.
      Otherwise the find_package() calls in the examples see something
      incomplete.

    * Add more QT_NO_CREATE_TARGET guards

    * Always call find_dependency on the dependencies, regardless of the
      target creation mode. This way a find_package(Qt5 COMPONENTS
      Widgets) will still load Qt5CoreMacros.

Change-Id: I03ce856e2f4312a050fe8043b8331cbe8a6c93e6
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-12 14:19:34 +00:00
Leander Beernaert
053766d796 Fix Standalone Example build when crosscompiling
Added qt_examples_begin() and qt_examples_end() macros to setup the
example list so it can be re-used in other projects.

When cross-compiling, we also need to set
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to BOTH in order for find_package()
to work correctly.

Removed support for building the whole qtbase/examples folder as a
standalone project. Building examples is only supported when building
the whole of qtbase (qtbase + examples together) or each individual
example is built separately against an installed Qt version.

Change-Id: I9d26b94b48b95af230b76ab618becb21d2d45581
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-06 12:27:41 +00:00
Kevin Funk
99539a2894 Allow to build examples as standalone project
Create CMake config files which can be used from the very same CMake
project. These CMake config files simply do not create any targets,
controlled via the QT_NO_CREATE_TARGETS.

This patch also allows to build qtbase.git:examples as a standalone
project, against an already-built Qt.

Ran this:
  ag -s "QT " examples -l -0 | xargs -0 -n 1 .../util/cmake/pro2cmake.py --is-example

Task-number: QTBUG-74713
Change-Id: I44cce5a4048618b30f890c5b789592c227a8b47d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 12:53:28 +00:00
Simon Hausmann
38cd18384f Fix OpenGL vs. GLESv2 linkage, attempt number three
We introduced WrapOpenGL to link against either desktop GL or GLESv2
depending on the GL feature in QtGui. This works "fine", with two
caveats:

    (1) find_package(WrapOpenGL) must be called after
    find_package(Qt5Gui) in order for the feature check in
    FindWrapOpenGL.cmake to work. That's error prone.

    (2) More and more places are popping up, in particular examples,
    where GL linkage is required due to inline functions in Qt that
    forward to GL functions - such as on Android.

    This in particular explains the qmake behavior of making the GL
    linkage (desktop _or_ GLES) a public dependency of QtGui, so only
    Gui linkage is required.

Those two aspects combined are the nail in the coffin of FindWrapOpenGL
and it would seem much easier to simply make the Desktop GL vs. GLES
decision once in Gui's CMakeLists.txt and let Qt5GuiDependencies.cmake
propagate this well. This allows us to get rid of plenty of special
cases as well.

Change-Id: I3a7e8af49537ce5f215f24470e075a4ae9aeb944
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 09:38:02 +00:00
Alexandru Croitor
5591e82135 Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: Ide5b3408bfefca410323cf26b810b44c06d3a227
2019-06-03 15:51:20 +02:00
Alexandru Croitor
e4079eca49 Merge remote-tracking branch 'origin/dev' into wip/cmake
Take 5.

Change-Id: Ifb2d20e95ba824e45e667fba6c2ba45389991cc3
2019-06-03 15:14:42 +02:00
Edward Welbourne
84e89c1e9e Convert uses of QTime as a timer to QElapsedTimer
Change-Id: I2297f61efa5adf9ea5194c7f3ff68574cbcf452c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-06-14 10:42:33 +02:00
Alexandru Croitor
837f592c5e Regenerate more projects that are using uic
Amends fa21d29b75

Change-Id: I54d9cca77122d61016e06c4057949747b19472bb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-23 08:59:35 +00:00
Alexandru Croitor
fa21d29b75 Rerun pro2cmake on projects that use .ui files
Task-number: QTBUG-75875
Change-Id: I95109b07fc4a6e09fe7911a21fc5f27f2c895d77
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
2019-05-22 14:58:24 +00:00
Marc Mutz
eae4668afa Torrent example: replace a QMultiMap with a sorted vector
This came about trying to remove the Java-style iterator. It was used to
iterate in reverse order, something QMap can't do, easily, due to lack
of rbegin()/rend(). Instead of writing ugly loops, use a vector of pairs,
fill it, sort it, then iterate over that one in reverse.

Change-Id: I09c8a2732a0699fff4c497778745523e20d348a1
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-05-25 09:30:51 +00:00
Marc Mutz
e4c0fca194 RelationalTableModel example: use std::unique_ptr instead of QScopedPointer
There's talk that QScopedPointer may be deprecated. Don't use it
in examples anymore.

Change-Id: I3c4647a569b72cd3a628c9b92ef34c87fd588342
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-15 11:03:52 +02:00
Marc Mutz
1a872e5ff2 HTTP example: use std::unique_ptr instead of QScopedPointer
This allows the QFile factory there to actually return the payload in
a unique_ptr instead of falling back to a raw pointer.

The use of a unique_ptr member requires that the destructor be
out-of-line, since QFile is only forward-declared in the header
file. This is good hygiene, so do it for ProgressDialog, too.

Change-Id: Idb6ed327f9592526bb7d0d5b2cfbffe9f08f3eea
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-15 11:03:52 +02:00
Marc Mutz
4715d6db80 ThreadedOpenGL example: use std::unique_ptr instead of QScopedPointer
There's talk that QScopedPointer may be deprecated. Don't use it
in examples anymore.

Change-Id: I05a486c2a86fcc7015a9c21ed0ce9682b0c24034
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-15 11:03:52 +02:00
Marc Mutz
bc6ffcd0c5 Torrent example: Replace the last Java-style iterator with STL ones
Scope a previous iterator variable better so we can re-use 'it' as the
iterator name.

Change-Id: I46d239ad2d3646168408d1ef29ed74fd07bc663f
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-23 13:55:40 +02:00
Marc Mutz
fbb2ed1505 Icons example: use std::unique_ptr instead of QScopedPointer
There's talk that QScopedPointer may be deprecated. Don't use it
in examples anymore.

Change-Id: Ia50ef66de84dae2885f71a9dd83c5909bfa253f0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-05-15 11:03:53 +02:00
Marc Mutz
f0463f0cc6 Torrent example: add missing qAsConst()
The function is const, but the d-pointer doesn't propagate it (raw pointer),
so we need the qAsConst() even here.

Change-Id: I9d2e1f7715abb3dc67a87cdadaa7ded971b15848
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-23 13:35:16 +02:00
Marc Mutz
54590c4f8a Torrent example: rewrite some very convoluted code
The old code iterated over the peer list, inserting active peers into
a QSet, curiously not stopping to search for clients if it had already
determined the peer to be active.

It then iterated over the peers again, storing the indexes of the
peers it had determined to be active in the first loop, in a QList.

It _then_ iterated over the index list, in reverse, calling removeAt()
on the peers list.

<sean parent>That's a remove_if!</sean parent>

The twist is, that only some maximum number of inactive peers should
be removed, just enough to bring the number of peers below a
predefined number.

To solve, use a lambda that keeps track of the number of times it has
returned true, returning false once the count drops to zero. We can't
use a mutable lambda here, since the STL algorithms are allowed to
copy the predicate as many times as they wish, and, indeed, remove_if
is commonly implemented by calling find_if. But the standard
guarantees exactly one application of the predicate per element, so we
can assume that we're not called again on the same element, and
therefore keep a reference to an external count.

With this, what was a horrible mess becomes a single call to remove_if.

Also change a while(--n) c.removeFirst() loop to a single call of
range-erase.

Change-Id: I6c6a54a1805e5b376800e1116e7aec643e95e4e1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-24 12:27:36 +00:00
Marc Mutz
77e708d167 Torrent example: replace Java-style iteration with STL iterators
Java-iterators are going to be deprecated.

Change-Id: I2e6353f3fd9e2ddaf0767e7f6cea713249d9591e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-05-23 13:35:15 +02:00
Joerg Bornemann
c9b7cc349a Remove usages of Q_OS_WINCE
This platform is history.

Change-Id: Iddfab008a509f4828c321730414c8204055cf7af
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2019-05-23 13:51:05 +02:00
Simon Hausmann
b4a1336bb0 Fix memory leak with arthur style
ASAN reports a leak here, so let's delete the style after the widgets
using them have been destroyed.

Change-Id: I0e8603fc5d2d0c13deca35a1c0020646c65eaf49
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-05-23 15:57:51 +02:00
Friedemann Kleint
ce211b1f83 Fix qdoc warnings for Qt 5.14
src/corelib/tools/qstring.cpp:9505:clang found diagnostics parsing \fn int QLatin1String::indexOf(QLatin1String l1, int from Qt::CaseSensitivity cs) const error: expected ')' error: out-of-line definition of 'indexOf' does not match any declaration in 'QLatin1String'
src/corelib/tools/qstringview.cpp:723:clang found diagnostics parsing \fn qsizetype QStringView::indexOf(QLatin1String l1, qsizetype from Qt::CaseSensitivity cs) const error: expected ')' error: out-of-line definition of 'indexOf' does not match any declaration in 'QStringView'
src/corelib/tools/qstringview.cpp:822:Unknown command '\t'
src/corelib/tools/qstringview.cpp:825:Unknown command '\t'
src/corelib/tools/qstringview.cpp:826:Unknown command '\t'
src/corelib/tools/qstringview.cpp:831:Unknown command '\t'
src/corelib/global/qnamespace.qdoc:2448:Undocumented enum item 'MarkdownText' in Qt::TextFormat
src/corelib/tools/qstringmatcher.cpp:183:No such parameter 'pattern' in QStringMatcher::QStringMatcher()
src/network/ssl/qsslerror.cpp:58:Undocumented enum item 'CertificateStatusUnknown' in QSslError::SslError
src/gui/kernel/qevent.cpp:5321:Undocumented parameter 'screenOrientation' in QScreenOrientationChangeEvent::QScreenOrientationChangeEvent()
src/gui/kernel/qevent.cpp:5321:Undocumented parameter 'screen' in QScreenOrientationChangeEvent::QScreenOrientationChangeEvent()
src/gui/kernel/qevent.cpp:5321:No such parameter 'orientation' in QScreenOrientationChangeEvent::QScreenOrientationChangeEvent()
src/gui/text/qtextformat.cpp:532:Undocumented enum item 'BlockCodeLanguage' in QTextFormat::Property
src/gui/text/qtextformat.cpp:532:Undocumented enum item 'BlockQuoteLevel' in QTextFormat::Property
src/gui/text/qtextformat.cpp:532:Undocumented enum item 'BlockMarker' in QTextFormat::Property
src/gui/text/qtextdocument.cpp:3294:Undocumented parameter 'features' in QTextDocument::toMarkdown()
src/gui/painting/qcolorspace.cpp:659:Undocumented parameter 'colorSpace1' in QColorSpace::operator!=()
src/gui/painting/qcolorspace.cpp:659:Undocumented parameter 'colorSpace2' in QColorSpace::operator!=()
src/gui/painting/qcolorspace.cpp:659:No such parameter 'colorspace1' in QColorSpace::operator!=()
src/gui/painting/qcolorspace.cpp:659:No such parameter 'colorspace2' in QColorSpace::operator!=()
examples/widgets/doc/src/icons.qdoc:269:Command '\snippet (//! [43])' failed at end of file 'widgets/icons/iconpreviewarea.cpp'
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogRetryButton' in QStyle::StandardPixmap
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogYesToAllButton' in QStyle::StandardPixmap
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogIgnoreButton' in QStyle::StandardPixmap
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogNoToAllButton' in QStyle::StandardPixmap
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogAbortButton' in QStyle::StandardPixmap
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_RestoreDefaultsButton' in QStyle::StandardPixmap
src/widgets/styles/qstyle.cpp:2026:Undocumented enum item 'SP_DialogSaveAllButton' in QStyle::StandardPixmap
src/testlib/qtestcase.qdoc:439:Undocumented parameter 'TestClass' in QTest::QTEST_HIGHDPI_SCALING_MAIN
src/testlib/qtestcase.qdoc:452:Undocumented parameter 'TestClass' in QTest::QTEST_NO_HIGHDPI_SCALING_MAIN

Change-Id: Ib0e9bf81c5caaa6b1fc644ac92085af47c600e0e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-05-21 17:39:58 +02:00
Marc Mutz
b4a88aa758 examples: port away from Java-style iterators
There's no reason to use them here, the Mutable is misleading in a
few instances, ranged-for is much simpler, and more future-proof.

Change-Id: Ifd5eaae95bbaa0b4cf0f435e6cfee6d778817b44
Reviewed-by: David Faure <david.faure@kdab.com>
2019-05-23 17:30:51 +02:00
Alexandru Croitor
9b0b464e82 Write find_dependency() calls in Qt Module config files
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.

This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.

For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.

The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.

The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.

Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.

In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.

Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.

Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-05-02 07:30:42 +00:00
Tobias Hunger
6630937e63 Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
2019-04-16 16:32:08 +02:00
Qt Forward Merge Bot
f8212b87d9 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I0c00ffe0eabebc919f22d6faa4bf958b288e8fd9
2019-05-12 01:00:08 +02:00
Laszlo Agocs
45aa3c73f7 hellogles3: Request core profile context
...instead of compatibility, in order to play nice with systems
that have no compatibility profile support (macOS). Instancing
needs OpenGL 3.x so sticking with 2.x contexts is not an option.

The example looks fully compatible with core profile so its
functionality should not change.

Change-Id: If0d554a6208973aa8a4fb86757e246d170cd0e71
Fixes: QTBUG-75680
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-05-11 12:01:53 +00:00
Miguel Costa
7ab84cfe74 factorial example: Fix issue with WinRT console output
Replaced the display of the calculation output, generated using
fprintf(stdout, ...), with qInfo() << ... In WinRT, fprintf to stdout
does not cause output to be generated.

Task-number: QTBUG-67566
Change-Id: I3b95bbf888e863683cbaf54deb26c3821433a5b8
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2019-04-03 13:59:47 +00:00
Edward Welbourne
4690d4efa6 Fix use of qrand/qsrand in an example
Convert an example to use QRandomGenerator::global().
This saves the need for seeding.

At the same time, use continuum random values rather than discrete
ones, to better fit what the example using it is doing.

Change-Id: I0adebaadb2e35832c629e314fda37e60b51f760d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-01 14:39:53 +00:00
Liang Qi
e104c19728 Merge "Merge remote-tracking branch 'origin/5.13' into dev" into refs/staging/dev 2019-03-31 18:45:03 +00:00
Christian Ehrlicher
c19d556863 QVariant: deprecate qVariantFromValue/qVariantSetValue()
qVariantFromValue/qVariantSetValue() was marked as obsolete since Qt4.
Therefore mark them as deprecated with Qt5.14.
Since QVariant::setValue/fromValue() were using the now deprecated
functions move the implementation to them and let
qVariantFromValue/qVariantSetValue() call
QVariant::setValue/fromValue().

Fixes: QTBUG-74043
Change-Id: I46617cc4d5c1e8c162d0f1f7ae32e4cfe9ce915c
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-03-31 12:25:46 +00:00
Liang Qi
29f01b32f5 Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
	src/corelib/configure.json

Change-Id: I93ac67f3bf4844bc7c691183e94bceb922b7b919
2019-03-31 12:39:42 +02:00
Tobias Hunger
72404ef3e1 CMake: allow custom plugin output/install directories
Only require TYPE if no OUTPUT_DIRECTORY, ARCHIVE_INSTALL_DIRECTORY
and INSTALL_DIRECTORY is provided.

Change-Id: I6db1cfaa576bfa3ee3dc8ecf81db20e3afcd61e2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-27 14:35:46 +00:00
Tobias Hunger
aa50b377a7 CMake: Add widgets examples
Change-Id: Ib6142b93df066e3658eb189b50ca74c455fe7e56
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-26 15:25:39 +00:00
Tobias Hunger
64c6c943c7 CMake: Add more examples
Change-Id: I7a8a3fd0a844a518592957fe07c6e707dd452d5f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-03-26 13:03:01 +00:00
Friedemann Kleint
8f1acd29e4 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I71cc71881fb638e207d83a8733bad8f267701c0f
2019-03-26 08:27:02 +01:00
Friedemann Kleint
7f635d9777 Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: I38389a69411f4549fed432f1181dbe23398b34a2
2019-03-26 08:24:59 +01:00
Thiago Macieira
66fc17eb5c Examples: properly parse more than one element in maps and lists
Change-Id: I46363e5b8944459e8c48fffd158c03bca4b7394e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-03-22 02:08:02 +00:00
Qt Forward Merge Bot
6893919b0c Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	src/gui/kernel/qplatformintegration.cpp
	src/gui/kernel/qplatformintegration.h
	src/plugins/platforms/wasm/qwasmintegration.cpp
	src/plugins/platforms/xcb/qxcbconnection_screens.cpp

Change-Id: I15063d42e9a1e226d9d2d2d372f75141b84c5c1b
2019-03-20 14:09:30 +01:00
Friedemann Kleint
8c9e41cc78 Use QSaveFile in MainWindow examples
QSaveFile should preferably be used by editor applications to catch
write errors.

Task-number: QTBUG-60635
Change-Id: Ia609435871b56b45714c3dd3d32bbc85b5cb4dd5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-06-12 09:29:31 +02:00
Marc Mutz
c6a3507de2 SecureUDPServer example: use std::unique_ptr instead of QSharedPointer
The only reason the code used QSharedPointer is that it used QVector
to hold a collection of them, and QVector infamously cannot hold
move-only types such as std::unique_ptr.

Fix by using std::vector<std::unique_ptr> instead. Also, pass the
objeccts into non-sink functions by raw pointer instead of shared_ptr.

As a drive-by, replace clear-following-iterate by the for-exchanged
pattern.

Change-Id: I605fbb98af840c1b93eab9e65c07defd6e7b39e1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-15 14:40:23 +02:00
Friedemann Kleint
50f3f8f6bb Use High DPI pixmaps in prominent examples and tests
Set AA_UseHighDpiPixmaps.

Task-number: QTBUG-52622
Change-Id: Ic4373a9c94952f50bc1ad36bcc0dec850efc124a
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2019-03-15 18:26:56 +00:00