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
|
||
---|---|---|
.. | ||
anchorlayout | ||
basicgraphicslayouts | ||
chip | ||
collidingmice | ||
diagramscene | ||
dragdroprobot | ||
elasticnodes | ||
embeddeddialogs | ||
flowlayout | ||
simpleanchorlayout | ||
weatheranchorlayout | ||
CMakeLists.txt | ||
graphicsview.pro | ||
README |
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.