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. Set Different values for Rectangle border
Forum Updated to NodeBB v4.3 + New Features

Set Different values for Rectangle border

Scheduled Pinned Locked Moved QML and Qt Quick
qml
6 Posts 2 Posters 1.4k 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.
  • S Offline
    S Offline
    shwt.saxena
    wrote on last edited by
    #1

    Hey,

    Is there any way to give different values in rectangle radius.

    like... radius : 4,10

         Rectangle{
              width:(parent.width-8)
              height:(parent.height-8)
               radius: 12
                z: 9
               smooth:true
               opacity: 0.96
               color:"#fff"
               anchors.horizontalCenter: parent.horizontalCenter
               anchors.verticalCenter: parent.verticalCenter
               Rectangle{
                      width: parent.width/2
                      anchors.bottom:  parent.bottom
                      height:50
                      color:"#a9511d"
                      radius:0
               }
               Rectangle{
                     width: parent.width/2
                     anchors.bottom:  parent.bottom
                     anchors.right: parent.right
                     height:50
                     color:"#7f2a00"
               }
        }
    
    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi,
      do you mean you want different radii on the corners of a rectangle at the same time?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shwt.saxena
        wrote on last edited by
        #3

        yes, I want to set radius top:5, bottom :5

        but left and right should be zero

        ? 2 Replies Last reply
        0
        • S shwt.saxena

          yes, I want to set radius top:5, bottom :5

          but left and right should be zero

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          @shwt.saxena That's not possible with the Rectangle component provided by QtQuick. But you can easily implement your own rectangle component that supports this feature.

          1 Reply Last reply
          0
          • S shwt.saxena

            yes, I want to set radius top:5, bottom :5

            but left and right should be zero

            ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            @shwt.saxena Have a look at the documentation. It demonstrates how to create your own Qt Quick type by inheriting QQuickPaintedItem : http://doc.qt.io/qt-5/qtqml-tutorials-extending-qml-example.html#chapter-1-creating-a-new-type

            1 Reply Last reply
            0
            • S Offline
              S Offline
              shwt.saxena
              wrote on last edited by
              #6

              thanks I will try

              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