Commit Graph

1680 Commits

Author SHA1 Message Date
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