All the following code produces the same result: I query the radio/checkbox buttons on a simple dock and can successfully get all the correct information from the buttons except for the currently checked state. What is returned is always the default checked state as set in ui->, not the checked state as it appears on screen after checking it. I'm providing the code and the output. Is there anything in the rest of the extensive program, such as an event filter or something that is too big or I can't think of to post, that could interfere with this?
qDebug()<< qb << "Checked Btn:"<< qb;
QList<QAbstractButton*>btns = ui->accBtnGrp->buttons();
qDebug()<< b << "Checkable:"<< b->isCheckable();
qDebug()<< b << "Checked:"<< b->isChecked();
}
bool cb = ui->ckbx_DottedNote->isChecked();
qDebug()<< ui->ckbx_DottedNote << "Checkable:"<< ui->ckbx_DottedNote->isCheckable();
qDebug()<< ui->ckbx_DottedNote << "Checked:"<< ui->ckbx_DottedNote->isChecked();
QAbstractButton* qb = ui->accBtnGrp->checkedButton();
qDebug()<< qb << "Checked Btn:"<< qb;
QList<QAbstractButton*>btns = ui->accBtnGrp->buttons();
foreach(QAbstractButton* b, btns ) {
qDebug()<< b << "Checkable:"<< b->isCheckable();
qDebug()<< b << "Checked:"<< b->isChecked();
}
bool cb = ui->ckbx_DottedNote->isChecked();
qDebug()<< ui->ckbx_DottedNote << "Checkable:"<< ui->ckbx_DottedNote->isCheckable();
qDebug()<< ui->ckbx_DottedNote << "Checked:"<< ui->ckbx_DottedNote->isChecked();
To copy to clipboard, switch view to plain text mode
In the results below, the "Normal" rbtn shows "Checked" but on screen it is actually the sharp button that was clicked and is now the checked button.The checkbox is also checked but since it is not checked by default it polls as false. All buttons (except the checkbox which is separate) are autoexclusive and are in the same buttongroup.
QRadioButton(0x3b61a78, name
= "rbtn_Normal") Checkable
: true QRadioButton(0x3b61a58, name
= "rbtn_Sharp") Checkable
: true QRadioButton(0x3b61a98, name
= "rbtn_Natural") Checkable
: true QRadioButton(0x3b61a98, name
= "rbtn_Natural") Checked
: false QCheckBox(0x3b61b18, name
= "ckbx_DottedNote") Checkable
: true QCheckBox(0x3b61b18, name
= "ckbx_DottedNote") Checked
: false
QRadioButton(0x3b61a78, name = "rbtn_Normal") Checked Btn: QRadioButton(0x3b61a78, name = "rbtn_Normal")
QRadioButton(0x3b61a78, name = "rbtn_Normal") Checkable: true
QRadioButton(0x3b61a78, name = "rbtn_Normal") Checked: true
QRadioButton(0x3b61a58, name = "rbtn_Sharp") Checkable: true
QRadioButton(0x3b61a58, name = "rbtn_Sharp") Checked: false
QRadioButton(0x3b61a98, name = "rbtn_Natural") Checkable: true
QRadioButton(0x3b61a98, name = "rbtn_Natural") Checked: false
QRadioButton(0x3b61af8, name = "rbtn_Flat") Checkable: true
QRadioButton(0x3b61af8, name = "rbtn_Flat") Checked: false
QCheckBox(0x3b61b18, name = "ckbx_DottedNote") Checkable: true
QCheckBox(0x3b61b18, name = "ckbx_DottedNote") Checked: false
To copy to clipboard, switch view to plain text mode
Bookmarks