QCheckBox does not update unless mouse over it again



  • QCheckBox
    check not updated



  • @wainCam Can you please be a bit more specific about your problem?

    What did you try? What did you expect to happen? What did actually happen?



  • I have a Qt Application built with Qt Creator.
    I have check boxes on different tabs of a QTabWidget, and it has a video display window. It is keeps my computer pretty busy.

    When I click on a checkbox, the check on the checkbox takes a while to show up.
    If I quickly check the box and move by mouse away, the "check" in the box does not show up. I need to mouse over the check-box again for the check to be shown.

    I have added a stateChanged() function for the "Display_box_fit" check box. When I update the text associated with the check box, this happens right away. I can set the state of another check box and the check in this box happens right away. However, the check for the "Display_box_fit" is slow, and if I mouse away (ie out of focus for the check-box), the check is never displayed on the check box.
    No amount of repaint() calling in the "Display_box_fit_stateChanged()" function seems to fix the problem.

    I have googled the problem for far too long and have found no good solutions.
    It seems like a pretty fundamental issue.

    Is there someway to get this to work without requiring the user to re-mouse over the checkbox to see its state?

    I am using visual studio under windows with Qt5 under c++

    Code:
    void on_Display_box_fit_stateChanged(){
    if (ui.Display_box_fit->isChecked()){
    ui.Display_box_fit->setText("pushed");
    ui.Display_box_fit->setChecked(true);
    }else{
    ui.Display_box_fit->setText("no pushed");
    }
    ui.Display_box_fit_2->toggle();

    ui.tabWidget->currentWidget()->repaint();
    //ui.Display_box_fit->repaint();
    //ui.Display_box_fit->parentWidget()->repaint();
    //ui.Display_box_fit->parentWidget()->parentWidget()->repaint();
    //ui.tabWidget->setCurrentWidget(ui.tab_debug);
    //ui.tabWidget->setCurrentWidget(ui.tab_Display);
    

    };


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What version of Qt are you using ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.