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. How do I elide Rectangle that is wider than its parent Rectangle?
Forum Updated to NodeBB v4.3 + New Features

How do I elide Rectangle that is wider than its parent Rectangle?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 3 Posters 693 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.
  • M Offline
    M Offline
    mirro
    wrote on last edited by mirro
    #1
    1 Reply Last reply
    0
    • E Offline
      E Offline
      ebatsin
      wrote on last edited by ebatsin
      #4

      Elision is only related to text.

      If you want to "hide" the part of a rectangle that overflows out of its parent, you can use the clip property:

      Rectangle {
          width: 50
          height: 50
          clip: true
      
          Rectangle {
              width: 100
              height: 100
          }
      }
      

      Note that using clip should be your last solution, on big items, this can be bad for performances.

      Instead you should try to prevent your child item from being bigger than its parent so you don't have to use clip.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Allon
        wrote on last edited by
        #2

        Hi,
        Why do you not write
        width: parent.width ?
        Regards,
        Emmanuel

        M 1 Reply Last reply
        0
        • A Allon

          Hi,
          Why do you not write
          width: parent.width ?
          Regards,
          Emmanuel

          M Offline
          M Offline
          mirro
          wrote on last edited by
          #3

          @Allon Is there a similar elide:Text.ElideRight method?

          A 1 Reply Last reply
          0
          • E Offline
            E Offline
            ebatsin
            wrote on last edited by ebatsin
            #4

            Elision is only related to text.

            If you want to "hide" the part of a rectangle that overflows out of its parent, you can use the clip property:

            Rectangle {
                width: 50
                height: 50
                clip: true
            
                Rectangle {
                    width: 100
                    height: 100
                }
            }
            

            Note that using clip should be your last solution, on big items, this can be bad for performances.

            Instead you should try to prevent your child item from being bigger than its parent so you don't have to use clip.

            1 Reply Last reply
            0
            • M mirro

              @Allon Is there a similar elide:Text.ElideRight method?

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

              @mirro Hi,
              Your question was not "how to elide a rectangle but, how do I elide the text contained in a rectangle? Am I right?
              Regards

              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