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 get arrow to align within button?
Forum Updated to NodeBB v4.3 + New Features

How to get arrow to align within button?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.4k 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.
  • V Offline
    V Offline
    Vadi2
    wrote on last edited by
    #1

    How can one get a triangle to align within a button in the macOS style properly? While it looks correctly on Fusion:

    0_1491457010238_Selection_040.png

    Qt is showing me something me something different in macOS:

    0_1491457029390_Selection_038.png

    Something that's rather unaesthetic as well. The same issue is present when we use a down arrow:

    0_1491457060561_Selection_039.png

    The .ui is available in this PR.

    Any help is appreciated, we've tried quite a few variations at this point. Thanks!

    A 1 Reply Last reply
    0
    • V Vadi2

      How can one get a triangle to align within a button in the macOS style properly? While it looks correctly on Fusion:

      0_1491457010238_Selection_040.png

      Qt is showing me something me something different in macOS:

      0_1491457029390_Selection_038.png

      Something that's rather unaesthetic as well. The same issue is present when we use a down arrow:

      0_1491457060561_Selection_039.png

      The .ui is available in this PR.

      Any help is appreciated, we've tried quite a few variations at this point. Thanks!

      A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      @Vadi2 Image upload is broken on the forums. Try uploading them to a 3rd party website so we can see what you're talking about.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vadi2
        wrote on last edited by
        #3

        Here they are: https://imgur.com/a/cY03B

        J.HilkJ A 2 Replies Last reply
        0
        • V Vadi2

          Here they are: https://imgur.com/a/cY03B

          J.HilkJ Online
          J.HilkJ Online
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @Vadi2

          You don't have a text in your button therefore I would suggest using stylesheets for this.

          myButton->setStyleSheet("QPushButton{border-image:url(:/images/img.png);}");
          

          Than you only have to make sure, that your button has the correct apsect ratio, because the stylsheet will stretch it.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          V 1 Reply Last reply
          2
          • V Vadi2

            Here they are: https://imgur.com/a/cY03B

            A Offline
            A Offline
            ambershark
            wrote on last edited by
            #5

            @Vadi2 I for some reason @J-Hilk's stylesheet idea doesn't work out, post your code for the button and the image loading and we'll give you a solution (hopefully) for centering it. :)

            I'm betting the stylesheet will work though, and it's nice and easy to do.

            My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

            1 Reply Last reply
            0
            • J.HilkJ J.Hilk

              @Vadi2

              You don't have a text in your button therefore I would suggest using stylesheets for this.

              myButton->setStyleSheet("QPushButton{border-image:url(:/images/img.png);}");
              

              Than you only have to make sure, that your button has the correct apsect ratio, because the stylsheet will stretch it.

              V Offline
              V Offline
              Vadi2
              wrote on last edited by
              #6

              @J.Hilk said in How to get arrow to align within button?:

              @Vadi2

              You don't have a text in your button therefore I would suggest using stylesheets for this.

              myButton->setStyleSheet("QPushButton{border-image:url(:/images/img.png);}");
              

              Than you only have to make sure, that your button has the correct apsect ratio, because the stylsheet will stretch it.

              Thanks, that worked.

              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