-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.0
-
None
-
586258bfb520452860d8ff94c2db132d6ffd9e42
In mainwindow.cpp in the Diagram Scene example, the method backgroundButtonGroupClicked(QAbstractButton *button) contains this code:
mainwindow.cpp
//! [1] void MainWindow::backgroundButtonGroupClicked(QAbstractButton *button) { QList<QAbstractButton *> buttons = backgroundButtonGroup->buttons(); foreach (QAbstractButton *myButton, buttons) { if (myButton != button) button->setChecked(false); }
It seems that this snippet tries to uncheck all other buttons in the group, except the one just clicked. However setChecked(false) is called repeatedly on button, which is the button that the user just clicked and which is precisely the one that should remain checked.
The correct method call is myButton->setChecked(false);.