Important: Please read the Qt Code of Conduct -

How to replicate the Windows 8 button 'shrink' on mouse 'press'

  • Is it possible to replicate the button press animation present in Windows 8 using QT? (An example can be found when clicking tabs in "PC Settings")

    The mouse press/click has the effect of depressing the button, by shrinking it along with the live text. I would like to implement a similar action into a desktop windows application (compatible with XP/Vista/7/8).


  • Disclaimer: I haven't seen the win8 UI.

    However, you can change the button image for each state (selected/hover/etc) using a stylesheet.

    You can also do it by changing the icons assigned to a button in designer.

    I don't know if or how this would affect "live text".

  • Moderators

    Are we talking about QtWidgets or QtQuick here? In QML, it should be enough to simply scale the button down when it's being clicked, assuming it's anchored well. In Widgets it should still be doable, although a bit more challenging.

  • We're talking Widgets, but I like a challenge ;)

  • To be clear, my reply is about using QtWidgets.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Then you should take a look at the Animation Framework. You can change the geometry of the button with it, which should have the effect you want.

    Hope it helps

  • Thanks for your response!

    Will Animation Framework allow changes to the geometry of items contained within a button, such as live text and 'floating' icons?


Log in to reply