Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to replicate the Windows 8 button 'shrink' on mouse 'press'
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Richard Marshall
    wrote on last edited by
    #1

    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).

    Thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      ScottR
      wrote on last edited by
      #2

      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".

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        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.

        (Z(:^

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Richard Marshall
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • S Offline
            S Offline
            ScottR
            wrote on last edited by
            #5

            To be clear, my reply is about using QtWidgets.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Richard Marshall
                wrote on last edited by
                #7

                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?

                Thanks

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved