Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Creator help navigation buttons with time delayed menus



  • I'm looking to implement a pushbutton that has functionality similar to the Help navigation "<" ">" buttons used in QtCreator. These buttons have the down arrow indicating that they have an associated menu, however they behave slightly differently than a standard QButton with an assigned QMenu in that if you just click the button it behaves like a button without a menu (no menu shown), however if you click and hold the button then the menu is shown.

    I've been looking through the QtCreator code but haven't found the code to see how they did it. Does anyone have any ideas how it was done? 0_1521563994323_2018-03-20_113922.png


  • Lifetime Qt Champion

    Hi @Will,

    I cannot check right now but I think these are QToolButtons.

    Regards



  • @aha_1980 You are right.

    QToolButton::DelayedPopup After pressing and holding the tool button down for a certain amount of time (the timeout is style dependent, see QStyle::SH_ToolButton_PopupDelay), the menu is displayed.
    

    I'll see if I can implement this feature in a regular QButton.


  • Lifetime Qt Champion

    @Will I think you can use a QToolButton as "regular button" ;)


Log in to reply