Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QPushButton pressed.
Qt 6.11 is out! See what's new in the release blog

QPushButton pressed.

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 3 Posters 1.5k Views
  • 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.
  • P Offline
    P Offline
    patcs
    wrote on last edited by
    #1

    Hi to everyone, I put some buttons in Qt Creator, but I would like that when I pressed it, this become with some oppacity so, the user can see which button he has pressed.

    I put this in the "Change styleSheet" part:

    #buenaVal{
    background-color:transparent;
    border-image: url(:/HappyFace.png);
    background: none;
    border:none;
    background-repeat: none;
    }
    #buenaVal:pressed{
    background-color:transparent;
    border-image: url(:/HappyFace.png);
    background: none;
    border:none;
    background-repeat: none;
    opacity:0.5
    }

    but it doesn't work...
    Could someone help me, please?
    thank youuu!

    1 Reply Last reply
    0
    • m.sueM Offline
      m.sueM Offline
      m.sue
      wrote on last edited by
      #2

      Hi,
      you can probably use a PNG image that is half transparent for the pressed button.
      -Michael.

      1 Reply Last reply
      1
      • ibiaI Offline
        ibiaI Offline
        ibia
        wrote on last edited by
        #3

        I do not understand very clearly the goal you want to achieve. If you just want to apply a style on the #buenaVal between the moment the user presses the button and until he releases it, then I think the code above should work.

        But, if you want to apply the style even if the the user has released the mouse, so the :checked pseudo state should be used instead of :pressed.

        Note : You do not have to repeat a style if it does not changes. I think that only the opacity property must be set.

        1 Reply Last reply
        2
        • P Offline
          P Offline
          patcs
          wrote on last edited by
          #4

          Thank you a lot, I did!

          1 Reply Last reply
          1
          • ibiaI Offline
            ibiaI Offline
            ibia
            wrote on last edited by
            #5

            Happy that it helped! You should mark the subject as solved.

            1 Reply Last reply
            1

            • Login

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