Important: Please read the Qt Code of Conduct -

Hide Widget after 3 seconds with QTimer problem

  • Hi I wanna hide the widget after 3 seconds (3000 miliseconds). I done something like that:
    I used variable
    @QTimer timer;@
    in class Class.
    where I call function I'm doing:
    In constructor there is something like:
    @connect(timer, SIGNAL(timeout()), button, SLOT(hide()));@
    When I'm compiling it throws me an error:
    @file.cpp:34: error: no matching function for call to ‘Class::connect(QTimer&, const char [11],
    QPushButton*&, const char [8])’@
    What is all about? how to fix it? button is a pointer, timer is a variable

  • Try this
    @connect(&timer, SIGNAL(timeout()), button, SLOT(hide())); @

  • yes, it works. Thx for answer.

Log in to reply