QDialog: how to use question mark (?) button?

前端 未结 3 657
逝去的感伤
逝去的感伤 2021-01-12 01:39

By default, QDialog windows have a question mark pushbutton in the upper-right corner. When I press it, the mouse cursor is changed to the \'Forbidden\' cursor,

3条回答
  •  情书的邮戳
    2021-01-12 01:52

    It is not a button documented by Qt. You can detect this by catching events and checking event type:

    http://qt-project.org/doc/qt-5/qevent.html#Type-enum

    There are different types as QEvent::EnterWhatsThisMode QEvent::WhatsThisClicked and so on. I achieved something similar to what are you looking for using event filter in mainwindow.

    if(event->type() == QEvent::EnterWhatsThisMode)
        qDebug() << "click";
    

    I saw "click" when I clicked on ? button.

提交回复
热议问题