Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    QML and Qt Quick
    2
    4
    855
    Loading More Posts
    • 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
      Binary91 last edited by

      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 Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

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

        (Z(:^

        1 Reply Last reply Reply Quote 0
        • B
          Binary91 last edited by

          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 Reply Quote 0
          • sierdzio
            sierdzio Moderators last edited by

            You are welcome, happy coding! :-)

            (Z(:^

            1 Reply Last reply Reply Quote 0
            • First post
              Last post