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
|
||
---|---|---|
.. | ||
chip.cpp | ||
chip.h | ||
chip.pro | ||
CMakeLists.txt | ||
fileprint.png | ||
images.qrc | ||
main.cpp | ||
mainwindow.cpp | ||
mainwindow.h | ||
qt4logo.png | ||
rotateleft.png | ||
rotateright.png | ||
view.cpp | ||
view.h | ||
zoomin.png | ||
zoomout.png |