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. [SOLVED] Best way to create image based button with variable size
QtWS25 Last Chance

[SOLVED] Best way to create image based button with variable size

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.1k 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.
  • B Offline
    B Offline
    Binary91
    wrote on last edited by
    #1

    Hi,

    I'm trying to create a button (background is an image with ROUND corners) that streches over the whole horizontal of a mobile device.

    As I also have practice in web designing, I know that this is solved with three images:

    1. the left part of the button with its two round corners (about 5 pixels, not strechable)
    2. the main part of the button --> a 1 pixel extract of the button that is repeated as often as needed
    3. the right part of the button with its two round corners (also about 5 pixels, not strechable)

    My question now:
    Is this also the most comfortable solution for QML?
    If not, how can I manage variable image sizes when simple streching would result in horrible look (like ellipse buttons --> not the wanted effect) ?

    Thank you in anticipation!

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

      Take a look at "BorderImage":http://doc.qt.io/qt-5/qml-qtquick-borderimage.html QML component.

      (Z(:^

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Binary91
        wrote on last edited by
        #3

        Hi sierdizio,
        thank's for that hint, that is a great functionallity!!

        I have to play a bit with the border widths, because I use different button sizes with the same image, so it looks a bit dirty while using the same settings for every button...

        Thank's :-)

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

          You are welcome, happy coding! :-)

          (Z(:^

          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