Solved How to disable widget for 1second
-
How can I disable the listWidget for 1second and enable it again?
-
widget->setEnabled(false); QTimer::singleShot(1000,widget,std::bind(&QWidget::setEnabled,widget,true));
-
@VRonin
That looks right. But I got an error "no matching function for call to 'bind'". -
Fixed my code above, I was missing an argument
- did you
#include <functional>
? - are you using Qt >= 5.4?
- did you
-
@Kinesis
I'm to lazy to google my way to the correct include for std::bind, so my suggestion lambda your way through itwidget->setEnabled(false); QTimer::singleShot(1000,widget,[widget]{widget->setEnabled(true);});
-
@VRonin
I did #include <functional>
I am using Qt>=5.11.0. -
@J.Hilk
It works ! THANKS :-)