lundi 26 juin 2017

QT: clicks queuing up during process, while the UI is disabled

So I have a plugin with lots of buttons and checkboxes. Upon each button click, I disable the UI, there is a long process after which it is enabled again.

The problem is, during this process, if I click anywhere on the UI, eg: a button or check box, it does not react instantly, but as soon as the UI is enabled again, it registers the click that I did about 10 seconds, or even a few minutes ago, and executes it.

I have tried disabling the ui and the buttons

widget->setDisabled(true);

and also used EventFilter for clicks.

bool ShortcutManager::eventFilter(QObject *obj, QEvent *event)
{
    if (m_isBlocked && (event->type() == QEvent::MouseButtonPress
    || event->type() == QEvent::MouseButtonDblClick
    || event->type() == QEvent::MouseButtonRelease) )
    return true;
//more code...
}

Even installed the eventfilter onto the UI

sceneLayout->installEventFilter(m_shortcutManager);
m_sceneTree->installEventFilter(m_shortcutManager);

But the clicks always seem to get through somehow.

Is there something I am missing?

N.B: Qt 4.6, C++ 11

Thanks

Aucun commentaire:

Enregistrer un commentaire