7a7023b7b1
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
|
||
---|---|---|
.. | ||
aggregate | ||
corelib | ||
dbus | ||
embedded | ||
gui | ||
network | ||
opengl | ||
qmake | ||
qpa | ||
qtconcurrent | ||
qtestlib | ||
sql | ||
vulkan | ||
widgets | ||
xml | ||
CMakeLists.txt | ||
examples.pro | ||
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.