This does not do what you describe for me on Linux:
#include <QtGui>
Q_OBJECT
public:
{
for (int i = 0; i < 5; ++i) {
p->setCheckable(true);
layout->addWidget(p);
}
setLayout(layout);
}
};
int main(int argc, char **argv)
{
Widget w;
w.show();
return app.exec();
}
#include "main.moc"
#include <QtGui>
class Widget: public QGroupBox {
Q_OBJECT
public:
Widget(QWidget *p = 0): QGroupBox("Test", p)
{
QVBoxLayout *layout = new QVBoxLayout(this);
for (int i = 0; i < 5; ++i) {
QPushButton *p = new QPushButton(this);
p->setCheckable(true);
layout->addWidget(p);
}
setLayout(layout);
}
};
int main(int argc, char **argv)
{
QApplication app(argc, argv);
Widget w;
w.show();
return app.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
What's going on? Where can I find documentation that explains?
If setting Qt::NoFocus on the buttons changes the behaviour then it seems likely the behaviour is related to keyboard focus. Given it is a QDialog this is likely related to default and autodefault buttons on the dialog
Bookmarks