2226 Commits

Author SHA1 Message Date
Nicholas Bennett
f5de04d9c4 Docs: Create \Q4A macro for "Qt for Android" and replace instances
"Android" is trademarked and needs to be referenced in a certain way.
The following steps were taken:
-Created qdoc macro.
-Updated "Qt Android" and "Qt for Android" to use \Q4A in qdoc files.

The macro will need to be adopted in all documentation projects.

Task-number: QAA-2836
Pick-to: 6.8 6.5
Change-Id: I4b52247a4ed52047242a06404e6d3aa19de9c16c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9c6c6d7d388bee01ea4e5ea102d3b0ed359c3f00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-03-02 07:10:47 +00:00
Axel Spoerl
4c1aef25ce Correct childNumber() reference in editable tree model example
childNumber() has been renamed to row() in the code, but not in
the documentation.
Correct it.

Pick-to: 6.8 6.5
Change-Id: Ibe6f1f27c0dd1982ff663dc680738babf2db87d7
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit d0cb3c0acdd4a482fd749684f282451bdd13557f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-02-18 22:58:21 +00:00
Friedemann Kleint
4924480944 Notepad example: Use theme icons
Pick-to: 6.8
Change-Id: Id915ecbf218d419b972ff97637673827facf84a2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ead6f79dc015aa8e7c152fac315d0426967c0c7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-28 19:35:30 +00:00
Joerg Bornemann
e50ae83c8c CMake: Fix examples built as external projects
Usage of a private module needs a respective find_package call now.

Task-number: QTBUG-87776
Change-Id: I3a00a241c5e8637d28606c1f45a843b491c0a8bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 483768fb8ed18fe5911d96f990ddbc69858146bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-27 22:38:51 +00:00
Friedemann Kleint
84ad506420 Standard dialogs example: Fix compilation with QT_NO_CAST_FROM_ASCII
Add missing tr(), use literals.

Pick-to: 6.8
Change-Id: I35387e29ce1b08f9df0ade5ee743b33561639f7a
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 3e1707d43068d43b078a2e626a0c46ff78da997b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 11:26:05 +00:00
Friedemann Kleint
82e7d1e56e Standard dialogs example: Fix some clang-tidy warnings
- Use auto * when initializing with new
- Initialize variables
- Fix static invocations
- Use per-class includes
- Minor cleanups

Pick-to: 6.8
Change-Id: I137bc7dfad63bc55a1b1bbc3f42d758bbfdb86ba
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit f388ca8841ad25cf79e5fdf8fa3e9d2f4de48ebc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-21 11:26:04 +00:00
Alexandru Croitor
b51ee7068c CMake: Use a unique resource identifier in simpletreemodel example
To avoid the following error:

 The custom command generating
    .rcc/qrc_editabletreemodel.cpp
  is attached to multiple targets:
    editabletreemodel
    editabletreemodel_tester
  but none of these is a common dependency of the other(s).  This is
  not allowed by the Xcode "new build system".

Pick-to: 6.8
Fixes: QTBUG-131631
Change-Id: I1c5d0702596a4f8f723d9080bc5304d6ad06853b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 9f593791988da197dbe956669b8a4647dc50124a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-20 17:42:01 +00:00
Ahmad Samir
11f94598da Replace qdebug.h includes in public headers with forward-declarations
qdebug.h includes many Qt and STL headers, so if you include a Qt header
you get all those transitive includes, which may affect build time.

- Where appropriate use the printf-like syntax of qDebug() and co.,
  these don't need the QDebug streaming operators
- qfloat16 is used in an inline member function, so include it
  explicitly

[ChangeLog][Potentially Source Incompatible Changes] Various Qt public
headers don't include QDebug any more; if you need QDebug's streaming
you'll have to include it in your code.

Task-number: QTBUG-132439
Change-Id: I750587e17a3b38fa226cd3af8eaccc8da580f436
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 185cba6e95a006d2548f20599f84390e5a3ad653)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-15 11:28:28 +00:00
Friedemann Kleint
7f78908b44 Mime type browser example: Add translator loader code
Enable testing translations.

Task-number: QTBUG-127004
Pick-to: 6.8
Change-Id: Ie83092b4db5bcf516834cf0b5b564a67d7ab6227
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8778a493606c8733d72db1c09fff5e4bf1f13cc0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-06 18:08:10 +00:00
Marc Mutz
c806d2bbbc sqlbrowser example: use = default on empty dtors
Idiomatic C++11 code.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited the issue from older code.

Pick-to: 6.8
Change-Id: Iba1fb9874bd93b4a560c33e3ecf62ecaa96d8bda
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 19564e033cf65a0a67680285d1cbcc85c9437aaf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:54 +00:00
Marc Mutz
101fedb17f sqlbrowser example: fix ugly margin around ConnectionWidget
When a layout is used to arrange the children of a non-top-level
custom widget, the layout's contentsMargins need to be manually set to
zero to avoid extra empty space around the widgets, misaligning it
w.r.t. its siblings.

Add the necessary call.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited the missing margin adjustment from older code.

Pick-to: 6.8
Change-Id: Icd1945a4f2b1635f031e50758ec2f1ec9313ae27
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 15524d1623a1400e4de15e57408e37020d394986)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:48 +00:00
Marc Mutz
cc1af8409a sqlbrowser example: use explicit / override
Examples should show idiomatic use of Qt and C++, so mark the custom
widget constructors in this example as explicit and their destructors
are override.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited the missing explicit from older code.

Pick-to: 6.8
Change-Id: I5b5b49f69330c6f139345bed7264c85a36c36e9b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e0e9a5627376e04aba1b2ca2591554851d7de240)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:42 +00:00
Marc Mutz
88600c3096 sqlbrowser example: use unique_ptr to hold m_ui
The old code used manual memory mangement (raw new/delete) to
(de)allocate the Ui struct. This is so 80s.

Use an owning smart pointer to manage the memory. Ordinarily, this
would have been QScopedPointer, but seeing as that doesn't have a
create() method to hide the raw new, use std::unique_ptr and
std::make_unique() instead.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e.

Pick-to: 6.8
Change-Id: Icabb9154eb38630855e14094b958af0214516f6b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0da2c2c4ef2219967db87021eece2a60b6e207af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:35 +00:00
Marc Mutz
02f05bdb5f sqlbrowser example: use idiomatic Qt [3/3]: use form-layout
The old code used a grid layout inside the QGroupBox, but the design
with labels in the first and edit-widgets in the second column lends
itself to a QFormLayout, which adapts the alignment of the widgets to
the platform style, so use that.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited all of the above from even older code.

Pick-to: 6.8
Change-Id: I528f0ce9d8cb7a997fbfabcdca887c059f571b38
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9c099ef942216d01261c26b60e3727a2a467f12a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:29 +00:00
Marc Mutz
8dbd0828e9 sqlbrowser example: use idiomatic Qt [2/3]: use button-box / override accept()
- The old code used two QPushButtons in a QHBoxLayout to provide
  Ok/Cancel buttons. This hard-codes the positions and text (and
  icons) of these buttons, instead of adapting to the platform style.

  The new code simply uses QDialogButtonBox, which is designed for
  this purpose.

- Also, the old code connected the Ok button's clicked() signal to a
  custom slot that then called QDialog::accept(). This means that the
  code in the custom slot is not executed when the dialog is accepted
  by other means (e.g. return press in one of the line edits
  ("auto-default"), though I'm not sure here).

  The new code uses the idiomatic Qt way of overriding
  QDialog::accept() instead, and connects the button-box's accepted()
  signal to it. This is done in the .ui file, so it already works in
  Designer preview.

- Finally, the old code made a manual connection from the Cancel
  button to QDialog::reject().

  The new code uses the Qt idiom of connecting in the .ui file
  directly, using QDialogButtonBox::rejected() as the signal.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however,
inherited all of the above from even older code.

Pick-to: 6.8
Change-Id: I83afd6156a0811e0c0f99f2480625ea6b69ff78b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3419c299369ac1da94ba5710aaf5f5f65c38c33c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:23 +00:00
Marc Mutz
f2b88b3225 sqlbrowser example: use idiomatic Qt [1/3]: disabling group-box
The old code connected to the wrong signal and therefore had to write
a custom slot to perform the disabling of the group-box.

The new code simply connects the QCheckBox::toggled(bool) signal to
the directly-compatible QWidget::setDisabled(bool) slot, removing the
need for a custom slot.

Also move the connection into the .ui file, so it works already when
checking the form in QtDesigner.

Amends 2690822428deec4f0c08f4d118d69a7c6036369e, which, however, only
inherited the issues from older code.

Pick-to: 6.8
Change-Id: Ia834f92de270bb7b18981273188f6e5b6cd457a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 53826d1cde26f825d1983476c6697f72130e351f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-01-02 09:57:17 +00:00
Friedemann Kleint
6cd5ea15ef Use QPainterStateGuard in examples
Complements 9ecf47a8a8d11227ecf192246d7df7c2c4dc9105.

Change-Id: I65456f8fd34bf9d316b72c4286e1b15789309f7c
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 1dc15c11db88f96a916258acea80a86bfa7c87cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-12-17 21:18:54 +00:00
Patryk Stachniak
8e3f04f54c Improve drag-and-drop visual handling in DragWidget
Modified the mousePressEvent in DragWidget to
temporarily detach the dragged QLabel from its
parent using setParent(nullptr). This ensures the
dragged widget remains visible and above other
widgets during the drag operation. Re-parenting
logic was added to restore the QLabel to its o
riginal container if the drag action is not a
MoveAction. This change addresses visual issues
where dragged items could disappear behind
overlapping widgets, enhancing user experience
and maintaining consistent behavior.

Task-number: QTBUG-123777
Pick-to: 6.6.2
Change-Id: I3edce9c96815e32eb8f00b61f7eda1709de04b4d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-12-06 00:29:01 +01:00
Patryk Stachniak
ebe9a6ca4b Removal of generic stylesheet rule for dropdown
The generic stylesheet rule (* { border: none; })
was overriding specific styles for
the menu-indicator, causing the dropdown arrow
to appear larger than intended. This rule was
removed to restore default or explicitly set
styles for the arrow, ensuring consistent
visual appearance

Task-number: QTBUG-120604
Pick-to: 6.8 6.5
Change-Id: If93de1e1595a2155e9a76644a3c615bd432bf53f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2024-12-02 17:43:50 +01:00
Allan Sandfeld Jensen
577946c1f0 Add Qt::Orientations based flip and flipped functions
Is easier to read and more bool-trap safe. Old form header deprecated from 6.10

Fixes: QTBUG-129575
Change-Id: Id785b9ce159007ce745c04120b2112c8bb9b0802
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-11-29 15:07:14 +01:00
Kai Köhne
ced47a590a Examples: Disable QtC junction points for examples using 'shared' directory
To work around path length limiations, Qt Creator optionally uses junction
points to shorten the build directories. This however breaks examples
that require sources outside their 'root' directory.

QUIP 13 states that examples should be self-contained. Anyhow, fixing this
is a larger effort, so for now just disable junction points in Qt Creator
for these examples.

Task-number: QTBUG-128914
Pick-to: 6.8
Change-Id: Ifb5e6944d936c82b1dba9fe3b81bebc1c8320168
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2024-11-26 15:20:41 +02:00
Paul Wicking
382fd3010b Doc: Move Easing Curve example into Graphics category
This example is for the animation framework (graphics),
it isn't about multimedia. Use the correct category.

Pick-to: 6.8
Change-Id: I32f0ce13a5496c8fbc871d8f2454575c25684eba
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2024-11-12 18:36:02 +01:00
Kai Köhne
2f50933fa4 Show Custom Completer example as part of UI Components category
Pick-to: 6.7 6.8
Change-Id: I6f91d5b684bcc16eb145d5c504ccc8dbe9149c8a
Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
2024-10-31 17:36:09 +02:00
Magdalena Stojek
0ac8ab0d20 Use delegate to draw ComboBox Label
Allows customization and dynamic rendering of items
in the labels.

Task-number: QTBUG-126696
Change-Id: I6261131808aa303660f991e2f19248e547b14566
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
2024-10-29 15:17:52 +02:00
Alexei Cazacov
dcc11ef277 Organize the tutorials in Qt Widgets so they are visible and reachable
This commit makes visible in the TOC:
- both of the tutorials
- a set of examples for completer, undo framework, and regex'es

Fixes: QTBUG-129818
Change-Id: Id6636782789c4e5b11349af3c4fb33f75035f1a0
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2024-10-23 19:17:07 +03:00
Alexei Cazacov
10e0ce7f82 Docs: Update images for Widgets and remove unused images
This commit updates the images used to illustrate Qt Widgets.
The commit also removes old unused images.

Task-number: QTBUG-69988
Pick-to: 6.8
Change-Id: I89e363c6c854c36bb0d763532d4cb359bdc85a38
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2024-10-17 08:25:19 +03:00
Morten Sørvig
d211b2ba7c wasm: disable network examples
http and rsslisting compile and can work, the rest are
don't build and are probably too low level.

Pick-to: 6.8
Change-Id: I031494178d0cace10951c3eb5495fbbf0f73d717
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2024-10-15 17:27:57 +02:00
Alexei Cazacov
618b1faf37 Docs: Update the screenshots for the Qt Widgets examples
This commit updates the screenshots for the Qt Widget examples. It also
removes several unused screenshots and adds several minor edits.

Task-number: QTBUG-69988
Pick-to: 6.8
Change-Id: I23b90fd6c8b798169d158854609c09ef3f1c1a20
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2024-10-11 08:21:03 +03:00
Ahmad Samir
50cdba38ad CompositionWidget example: use QBasicTimer instead of raw timer IDs
Change-Id: I011645d915193c9ab1e3f001898c88fdd48e64a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-10-03 23:03:32 +03:00
Ahmad Samir
07593900dc GraphWidget example: use QBasicTimer instead of raw timer IDs
Change-Id: I9ba66ff37112b749d29a9121f4c89cab1a8e9d07
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-10-03 23:03:30 +03:00
Ahmad Samir
c07c414609 examples/*/network-chat: port to std::chrono intervals
Change-Id: Id5ba0f412f1643f6a0588ae69d5bfcb163dc1c81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-10-03 23:03:28 +03:00
Ahmad Samir
401a840adb examples/network/network-chat: use QBasicTimer instead of raw timer IDs
Change-Id: I6ea464a6d19c775edca187fea1d7cd82f5f22d3f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-10-03 23:03:26 +03:00
Christian Ehrlicher
5a28fe86af Examples/Sql/Masterdetail: Fix deleting rows
Completely deleting a row in a QSqlTableModel needs a call to select()
afterwards, otherwise a blank column will stay according the
documentation of QSqlTableModel::removeRows()
Also add albumdetails.xml to the resource file to make sure it's found
during runtime.

Pick-to: 6.8
Task-number: QTBUG-128434
Change-Id: Ie5cc38edfa27984d186467e3372b05987f78d14c
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-09-07 23:12:43 +02:00
Ahmad Samir
2226581b0b examples/network/torrrent: port to QBasicTimer
Instead of using raw timer IDs. QBasicTimer is a value class with
sizeof(int), so not much overhead, and easier to use API. Examples
should show best practices.

Change-Id: I5b9efe47ced69c0067eac891398185be7e87bd0e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-08-31 18:57:15 +03:00
Paul Wicking
cd8244131e Doc: Remove usage of defunct QDoc command
The QDoc command `\tableofcontents` was rendered useless by a change
more than a decade ago. Remove the use of `\tableofcontents` as it
serves no purpose, and ensure that the surrounding context still makes
sense for the reader, by removing preceding text that refers to a
non-existing table of contents, such as `Contents:`.

Task-number: QTBUG-128173
Pick-to: 6.8
Change-Id: Ibb5a6af0e80f70fa487cdf6a7e38009a9ef60cbf
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2024-08-28 08:25:30 +02:00
Volker Hilsheimer
00ce45efe1 QSortFilterProxyModel: add a protected beginFilterChange
If the filter gets changed and invalidated while there is no mapping
(perhaps because the model had been invalidated first), then we fail
to notice the change and don't emit rowsInserted/Removed. And as the
new filter is already in place by the time invalidateFilter gets
called, we cannot know what the size of the model was before the
change.

The only way to fix that is to introduce a beginFilterChange protected
function that makes sure that we have a mapping from the source model
with the old filter. That is a no-op if a mapping is already in place,
costing only the lookup in a hash table.

By calling this function, custom models with their own filtering logic
can make sure that their model emits the changed-signals as expected.

Add test coverage and documentation and fix the relevant examples
snippet to use that new protected function as recommended, and to
invalidate only the rows filter.

[ChangeLog][Core][QSortFilterProxyModel] Added a new protected
function beginFilterChange() that subclasses overriding
filterAcceptsRow or filterAcceptsColumn should call before the filter
parameter is changed. This makes sure that the signals informing
about rows or columns changing get correctly emitted.

Fixes: QTBUG-115717
Change-Id: Ib73a7119ac9dd9c4bcf220f1274d6b4ed093e7ff
Reviewed-by: David Faure <david.faure@kdab.com>
2024-08-28 02:28:24 +02:00
Leena Miettinen
7419c9f77c Doc: Update \externalpage entries for Qt Creator documentation
- The docs were restructured in v. 13.0 and 14.0, so most headings
  changed, some topics were removed and lots of topics were added
- Use the macro \QC
- Fix the broken links in qtbase

Change-Id: Ic173a3e9a1c80322162c3feb277098de2a9f1cc6
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2024-08-02 14:18:19 +02:00
Alexandru Croitor
98847d2153 CMake: Fix project structure of calendarbackendplugin project
Before this change, installing the example with a multi-config
generator failed with

  CMake Error at cmake_install.cmake:123 (include):
  include could not find requested file:
    <build_dir>/.qt/deploy_calendarPlugin_49e753a159-$<CONFIG>.cmake

When configuring the project, cmake mentions the following warning:

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0087 is not set: Install CODE|SCRIPT allow the use of
  generator expressions.  Run "cmake --help-policy CMP0087" for policy
  details.

This happens because the specified minimum cmake version of the project
was 3.5, so the above policy was not enabled, and the generator
expressions we use for the deployment api failed to be evaluated.

Fix the minimum version to be 3.16.

Clean up the project a bit to be in line with our other examples.
Use qt_internal_add_example, remove redundant find_package(Qt) calls,
remove redundant project() and cmake_minimum_required() calls, use
target_include_directories.

Amends f071d4ee8abf6fd0f1b6e187b4e99fa6fad7b642

Fixes: QTBUG-127616
Task-number: QTBUG-115200
Change-Id: I06ca1d38a8e5e7cb18ade205616a603db98a17be
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-07-30 16:12:14 +02:00
Magdalena Stojek
f071d4ee8a QCalendar example illustrating the user-supplied plugin mechanism
This example demonstrates how to write a calendar backend plugin
using a low-level API for extending Qt applications.

Fixes: QTBUG-115200
Change-Id: If0b7f2552ba8c2203acdcbff238fb0ffa7cfca55
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2024-07-04 15:25:29 +02:00
Even Oscar Andersen
e40fdf19ab wasm: hellogl2 screen is black
We need to reset the OpenGL state in paintGL for the drawing
to work,

Also, disable the dock/add window functionality as it does not
work on webassembly.

Change-Id: I480d944bc2029a07d5d49f0a85c3754fbc8cd53c
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2024-07-01 17:33:48 +02:00
Volker Hilsheimer
88322f69a2 Widget gallery example: set color scheme before constructing UI
On macOS, we see unexplained white flashes of the UI when
overriding the scheme in the widget's constructor. This only
happens when running the bundle, but not when running the
executable.

Work around that problem by setting the scheme immediately
after constructing QApplication.

Pick-to: 6.8
Task-number: QTBUG-126248
Change-Id: I4a5fe467d628fca5e52e1e36f43af8143239c7fa
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-06-11 20:28:07 +02:00
Shawn Rutledge
82cba0ca5c systray example: if there is no system tray, allow waiting for one
Demonstrate that QSystemTrayIcon can wait for a tray to become
available. For example QDBusTrayIcon::init() connects to
QDBusServiceWatcher::serviceRegistered to detect the StatusNotifier
service becoming available. So instead of unconditionally quitting
if there is no tray, allow the user to choose to "Ignore" its absence,
or "Close" the application. Realistically, applications in which a tray
icon is an optional feature should not quit just because there's no
tray.

Task-number: QTBUG-94871
Change-Id: Ia8efd95fcfb9ff7c915ee8e259e9a0903fa7bcb3
Pick-to: 6.8 6.7 6.5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
2024-06-05 01:40:10 +00:00
Assam Boudjelthia
529267972b Android: cleanup AndroidManifest.xml files in examples
Change-Id: I6b0a11ace348891da7ed16dd9039b807902cb828
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-05-23 17:52:21 +03:00
Lucie Gérard
421b05331c Add Copyright and licensing information in file
Task-number: QTBUG-124453
Change-Id: I380ea0ad99b187c736e6f80fa8825ee9866f54c9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-21 17:23:21 +02:00
Lucie Gérard
0f7a64a3ad Add copyright and licensing to build system files missing it
Task-number: QTBUG-124453
Change-Id: Ibb6a0ab839a16ceef3c68861bac2f508ddb3d1ae
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-21 17:23:21 +02:00
Kai Köhne
5e699c2a8b Replace 'Qt Designer' and 'Qt Widgets Designer' in code
Use new term in examples, code comments, error messages and and mime types.

Task-number: QTBUG-122253
Change-Id: I355452d6eb02a7a0ffbb20acf82ddb8ebbfa4837
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-16 13:04:41 +01:00
Volker Hilsheimer
95d4e6baba ColorScheme: make QStyleHints::colorScheme writable for applications
Applications can request the color scheme to be either explicitly light
or dark, or to follow the system default by setting the scheme to
Qt::ColorScheme::Unknown.

Setting the color scheme will make the request to the QPlatformTheme
implementation, which can then use the appropriate implementation to
set the application's appearance so that both palette and window
decoration follow the requested color scheme. This should trigger
theme change and palette change events. A change to the effective
scheme should then call back into QStyleHintsPrivate::updateColorScheme,
which will emit the changed signal for the property.

Implement this for macOS (Cocoa), iOS, Android, and Windows.

On macOS, we have to use deprecated AppKit APIs; the replacements for
those APIs are not suitable for this use case. On iOS, the setting is
for each UIWindow, which we can update or initialize based on an
explicitly requested scheme.

On Android we can piggy-back on the logic added when dark theme support
was introduced in b4a9bb1f6a40e6d504c1f48f0d9ea2b70ab1a9f0.

On Windows, we have to fake a dark palette if the dark scheme is
requested on a light system, as there is no API to read a dark palette.
However, we also have to ignore any application preference if a high-
contrast accessibility theme is selected by the user (we report the
color scheme as unknown; there are both light and dark high-contrast
themes), and read the system palette using the GetSysColor API, which
is used for light mode. And we need to initialize windows with the
correct frame if the application explicitly overrides the system color
scheme.

Add an auto-test to the QApplication test, as that gives us the most
coverage to confirm that QStyleHints emits the changed signal, and that
Theme- and PaletteChange events are received by the toplevel widget
when the color scheme actually changes. This test has to be skipped
on platforms where we cannot set the color scheme programmatically.

Add the option to explicitly select the color scheme to the widget
gallery example, and default it to dark mode.

Fixes: QTBUG-124490
Change-Id: I7302993c0121284bf9d3b72e3149c6abbe6bd261
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-05-10 01:15:12 +02:00
Assam Boudjelthia
6e8f97b83b Remove check for Qt version > 4 that's not useful now
Pick-to: 6.7
Change-Id: Ia24b2b9fb9f3b070f8eccaf74a09787b324ab01e
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2024-04-24 18:46:34 +02:00
MohammadHossein Qanbari
4e1a1f3697 Convert "Color Editor Factory" Example to snippets
The color editor factory example is removed and part of the codes are
used as snippets.

Fixes: QTBUG-119985
Pick-to: 6.7 6.6
Change-Id: I421e473e7db09a5af7543b80b87a338d8ff2ab7e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-04-19 13:39:41 +02:00
Tor Arne Vestbø
a78938e0f6 rhiwindow: Set DPR on image texture to ensure DPR-agnostic drawing
Otherwise the 20x20 margins will produce different layouts depending
on the DPR, which is not what we want.

Pick-to: 6.7
Change-Id: I4153d0843ef51c8e0f60d7d5166b153d45201c95
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2024-04-18 23:15:25 +02:00