I have a 10 X 10 square QFrame grid. my goal is to have a button to be checked for what color you want and then mouse over the frame and click and the QFrames background changes to the color that was selected.
void matrix::REDBTN()
{
if (ui->REDbtn->isChecked())
{
ui->GREENbtn->setChecked(false);
ui->BLUEbtn->setChecked(false);
ui->WHITEbtn->setChecked(false);
ui->PURPLEbtn->setChecked(false);
ui->YELLOWbtn->setChecked(false);
ui->CYANbtn->setChecked(false);
if (ui->REDbtn->isChecked())
{
ui->box_0_0->mousePressEvent(setStyleSheet("background-color: rgb(255,0,0)"));
}
}
}
void matrix::REDBTN()
{
if (ui->REDbtn->isChecked())
{
ui->GREENbtn->setChecked(false);
ui->BLUEbtn->setChecked(false);
ui->WHITEbtn->setChecked(false);
ui->PURPLEbtn->setChecked(false);
ui->YELLOWbtn->setChecked(false);
ui->CYANbtn->setChecked(false);
if (ui->REDbtn->isChecked())
{
ui->box_0_0->mousePressEvent(setStyleSheet("background-color: rgb(255,0,0)"));
}
}
}
To copy to clipboard, switch view to plain text mode
i get an error when using this code. what am i doing wrong?
Bookmarks