Hello!
I'm a student and currently am working at a small company as an intern. I have to control some LEDs through usage of Qt, and made an interface to be able to do so. The interface issue concerned contains four checkboxes, and a button. It's supposed to send bytes to the MOXA board after having pressed the Send Data button.
My function checks whether the checkbox is enabled, and if so, send the bytes. However, it only seems to work when using one checkbox at a time. I want to be able to select all of them, so all four functions are processed, and thus, all four LEDs go on (or off).
I've done this, but this doesn't seem to work (enabling multiple checkboxes at once, that is):
void ETClient::on_pushSendData_clicked()
{
bool dio0 = this->ui->chkDIO0->isChecked();
bool dio1 = this->ui->chkDIO1->isChecked();
bool dio2 = this->ui->chkDIO2->isChecked();
bool dio3 = this->ui->chkDIO3->isChecked();
if(dio0 == true) this->dio0_enabled();
if(dio1 == true) this->dio1_enabled();
if(dio2 == true) this->dio2_enabled();
if(dio3 == true) this->dio3_enabled();
else ;
}
void ETClient::on_pushSendData_clicked()
{
bool dio0 = this->ui->chkDIO0->isChecked();
bool dio1 = this->ui->chkDIO1->isChecked();
bool dio2 = this->ui->chkDIO2->isChecked();
bool dio3 = this->ui->chkDIO3->isChecked();
if(dio0 == true) this->dio0_enabled();
if(dio1 == true) this->dio1_enabled();
if(dio2 == true) this->dio2_enabled();
if(dio3 == true) this->dio3_enabled();
else ;
}
To copy to clipboard, switch view to plain text mode
Any help would be greatly appreciated!
Bookmarks