qt5base-lts/examples
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
..
aggregate
corelib Examples: Do not depend on transitive includes 2022-03-17 17:14:38 +01:00
dbus Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
embedded Do not assume implicit string-ish → QColor conversion 2022-03-11 20:15:49 +01:00
gui Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
network secure UDP server: do not use deprecated protocol (DTLS 1.0) 2022-03-10 08:23:00 +00:00
opengl Examples: Do not depend on transitive includes 2022-03-17 17:14:38 +01:00
qmake Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
qpa Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
qtconcurrent Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
qtestlib Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
sql Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
vulkan Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
widgets Chip example: fix an accidental bool->int conversion when using PMF connections 2022-04-13 11:36:34 +08:00
xml Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
CMakeLists.txt Build examples in isolated sub-builds using ExternalProject 2021-05-26 13:33:29 +02:00
examples.pro Turn off the dbus examples for qmake-generated VS projects 2021-02-09 15:45:06 +01:00
README

Qt is supplied with a number of example applications that have been
written to provide developers with examples of the Qt API in use,
highlight good programming practice, and showcase features found in each of
Qt's core technologies.


Documentation for examples can be found in the Examples section
of the Qt documentation.