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. BorderImage doesn't work as it's supposed to
Forum Updated to NodeBB v4.3 + New Features

BorderImage doesn't work as it's supposed to

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 331 Views 2 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.
  • Q Offline
    Q Offline
    qcoderpro
    wrote on last edited by
    #1

    In the following code I've used both Image and BorderImage, but

    horizontalTileMode: BorderImage.Stretch
    verticalTileMode: BorderImage.Stretch
    

    have no effect apparently!

    import QtQuick 2.15
    import QtQuick.Window 2.15
    
    Window {
        width: 800
        height: 700
        visible: true
    
        Image {
            id: image
            anchors.centerIn: parent
            source: "qrc:/test.png"
        }
        BorderImage {
            x: image.x
            y: image.y + image.height + 10
            border { left: 30; top: 30; right: 30; bottom: 30 }
            source: "qrc:/test.png"
            horizontalTileMode: BorderImage.Stretch
            verticalTileMode: BorderImage.Stretch
        }
    }
    

    4.PNG

    What's the problem, please?

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qcoderpro
      wrote on last edited by
      #2

      Isn't there any reply for my issue about the project!? :(

      1 Reply Last reply
      0
      • jeremy_kJ Offline
        jeremy_kJ Offline
        jeremy_k
        wrote on last edited by
        #3

        The code above doesn't specify a height, width, or anchors for the BorderImage. As a result, it uses the implicit size of test.png. There's no need for it to scale.

        Asking a question about code? http://eel.is/iso-c++/testcase/

        Q 1 Reply Last reply
        1
        • jeremy_kJ jeremy_k

          The code above doesn't specify a height, width, or anchors for the BorderImage. As a result, it uses the implicit size of test.png. There's no need for it to scale.

          Q Offline
          Q Offline
          qcoderpro
          wrote on last edited by
          #4

          @jeremy_k
          Thank you.

          I use the code below and it worked:

          import QtQuick 2.15
          import QtQuick.Window 2.15
          
          Window {
              width: 800
              height: 700
              visible: true
          
              Image {
                  id: image
                  width: 200; height: 200
                  anchors.centerIn: parent
                  source: "qrc:/test.png"
              }
              BorderImage {
                  id: brdrImage
                  x: image.x
                  y: image.y + image.height + 10
                  width: 200; height: 200
                  border { left: 30; top: 30; right: 30; bottom: 30 }
                  source: "qrc:/test.png"
                  horizontalTileMode: BorderImage.Stretch
                  verticalTileMode: BorderImage.Stretch
              }
          }
          

          Capture.PNG

          But one more question, this time on the corners of the image. They shouldn't change based of the definition of BorderImage but in the output image (the one in the bottom) they have changed. why, please?

          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