qt5base-lts/examples/widgets/graphicsview
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
..
anchorlayout Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
basicgraphicslayouts Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
chip Chip example: fix an accidental bool->int conversion when using PMF connections 2022-04-13 11:36:34 +08:00
collidingmice Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
diagramscene Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
dragdroprobot Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
elasticnodes Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
embeddeddialogs Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
flowlayout Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
simpleanchorlayout Examples: Remove unneeded CMake options 2022-01-24 14:00:00 +01:00
weatheranchorlayout 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
graphicsview.pro Move QStateMachine from QtCore to QtScxml 2020-08-24 20:10:25 +02:00
README Moving .qdoc files under examples/widgets/doc 2012-08-20 12:20:55 +02:00

Qt is provided with a comprehensive canvas through the GraphicsView
classes.

These examples demonstrate the fundamental aspects of canvas programming
with Qt.


Documentation for these examples can be found via the Examples
link in the main Qt documentation.