qt6-bb10/examples/widgets
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
..
animation Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
desktop Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
dialogs Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
doc Doc: Update Notepad tutorial 2022-01-31 14:24:11 +01:00
draganddrop Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
effects Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
gallery Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
gestures Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
graphicsview Chip example: fix an accidental bool->int conversion when using PMF connections 2022-04-13 11:36:34 +08:00
itemviews Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
layouts Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
mainwindows Examples: Do not depend on transitive includes 2022-03-17 17:14:38 +01:00
painting Examples: Do not depend on transitive includes 2022-03-17 17:14:38 +01:00
qnx/foreignwindows Repair parameter type 2021-12-03 11:52:21 +08:00
richtext qtextstream.h: streamline includes 2022-02-10 04:34:13 +01:00
scroller Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
tools Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
touch Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
tutorials Doc: Update Notepad tutorial 2022-01-31 14:24:11 +01:00
widgets CMake: Don't build the movie example if the feature is disabled 2022-03-19 14:19:13 +01:00
windowcontainer Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
CMakeLists.txt Examples: Remove remaining conversion markers in CMakeLists.txt 2021-12-13 14:16:26 +00:00
widgets.pro Move QStateMachine from QtCore to QtScxml 2020-08-24 20:10:25 +02:00