I need to add one or several radiobuttons (depends on registered GPU Models). It looks like:
QVBoxLayout *vLayout = new QVBoxLayout(this);
QList<OpenCLGpuModel *> gpus = getGpus();
foreach (OpenCLGpuModel *gpu, gpus) {
QRadioButton *rb = new QRadioButton(gpu->getName(), this);
rb->setChecked(gpu->isEnabled());
vLayout->addWidget(rb);
}
setLayout(vLayout);
There is only one radio button should be selected in each moment. If I have several radio buttons the behaviour is good. But, if I have the only one it works as it a checkbox - if I click on it and it's already checked, then it'll be unchecked. How can I fix this behavior in the case of one QRadioButton?