windowHandle() will return NULL;

  • In manual ,QWidget::windowHandle() returns a valid instance of a QWindow only after the widget has been shown. It is therefore recommended to delay the initialization of the QWinTaskbarButton instances until QWidget::showEvent().
    But how to know the time widget has been shown? I didn't override showEvent.

    _taskbarbutton = new QWinTaskbarButton( this);

    this code will be wrong,because windowHandle() return NULL;

     _taskbarbutton = new QWinTaskbarButton( this);

    This code will be ok!

    So,How to know what time windowHandle()is valid?
    thank for your help.

    [Edit: Added code tags ~kshegunov]

  • Lifetime Qt Champion


    Then, why not just re-implement the showEvent method ?

Log in to reply

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