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. Graphic bug

Graphic bug

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 526 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.
  • ODБOïO Offline
    ODБOïO Offline
    ODБOï
    wrote on last edited by ODБOï
    #1

    hi,
    i just had a strange issue.
    i want to make a CircularGauge - like component using Repeater

    import QtQuick 2.12
    import QtQuick.Controls 2.12
    
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
        id: w
    
    
        property double centerX :150
        property double centerY : 150
        property int rad : 60
    
    
        Slider{
            id: sl
            from: 1
            to : 360
            value: 150
            stepSize: 1
        }
    
    
        Repeater{
                id:rp
                anchors.centerIn: parent
                model:sl.value
    
                Rectangle{
                    height: 10
                    width: 10
                    radius: 5
                    color: "blue"
    
                    x : centerX + (centerX + (rad * Math.sin(index * 2 * (Math.PI / 360))) )
                    y : centerY + (centerY + (rad * Math.cos(index * 2 * (Math.PI / 360))) )
                }
        }
    }
    
    

    01ad58af-2e63-4f01-ab77-a5a8e184817a-image.png

    then if i move the sliders handle ..

    3e4ecb53-b6c0-4ba4-8213-91a2fcbadeea-image.png

    is there something stupid in my code ? Im sure not, because if i remove the the binding of the repeater

    model : sl.value

    and change de model manually it works properly

    1 Reply Last reply
    0
    • IntruderExcluderI Offline
      IntruderExcluderI Offline
      IntruderExcluder
      wrote on last edited by
      #4

      Then custom QQuickPaintedItem? Not sure if having 360 dymically created rectangles is a good idea.

      ODБOïO 1 Reply Last reply
      1
      • IntruderExcluderI Offline
        IntruderExcluderI Offline
        IntruderExcluder
        wrote on last edited by
        #2

        Your code is working fine for me with Qt 5.14 and linux mint. Also wouldn't it be better to use Shape and PathArc?

        ODБOïO 1 Reply Last reply
        1
        • IntruderExcluderI IntruderExcluder

          Your code is working fine for me with Qt 5.14 and linux mint. Also wouldn't it be better to use Shape and PathArc?

          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by
          #3

          hi
          @IntruderExcluder said in Graphic bug:

          Your code is working fine for me with Qt 5.14

          Thank you for confirming. My Qt version is 5.13.0 and platform is windows10.

          I will need to control every point individually, im not sure i can using Shape and PathArc

          1 Reply Last reply
          0
          • IntruderExcluderI Offline
            IntruderExcluderI Offline
            IntruderExcluder
            wrote on last edited by
            #4

            Then custom QQuickPaintedItem? Not sure if having 360 dymically created rectangles is a good idea.

            ODБOïO 1 Reply Last reply
            1
            • IntruderExcluderI IntruderExcluder

              Then custom QQuickPaintedItem? Not sure if having 360 dymically created rectangles is a good idea.

              ODБOïO Offline
              ODБOïO Offline
              ODБOï
              wrote on last edited by ODБOï
              #5

              @IntruderExcluder said in Graphic bug:

              Not sure if having 360 dymically created rectangles is a good idea.

              That is may be the issue. Because the same code with less rectangles works correctly.
              It looks like the limit is 30... if i bind sliders value to repeaters model

              import QtQuick 2.12
              import QtQuick.Controls 2.12
              
              ApplicationWindow {
                  visible: true
                  width: 640
                  height: 480
                  title: qsTr("Hello World")
                  id: w
              
                  property double centerX :150
                  property double centerY : 150
                  property int rad : 60
              
                  Slider{
                      id: sl
                      from: 1
                      to :30
                      stepSize: 1
                  }
              
                  Repeater{
                          id:rp
                          anchors.centerIn: parent
                          model:sl.value
              
                          Rectangle{
                              height: 10
                              width: 10
                              radius: 5
                              color: "blue"
                              x : centerX + (centerX + (rad * Math.sin(index * 2 * (Math.PI / 30))) )
                              y : centerY + (centerY + (rad * Math.cos(index * 2 * (Math.PI / 30))) )
                          }
                  }
              }
              

              But if use hardcoded value, i can even put 2000 as model and there is no bug
              This tired me, this is first time i observe such stupid behavior in QtQuick

              @IntruderExcluder thx for your inputs, i will try with QQuickPaintedItem

              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