Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. warning with qml

warning with qml

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 2 Posters 1.6k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I write a connect between a circular gauge created with qml and a slider, and the signal is sent by the slider..it works but I have these warnings:

    qrc:/Slider.qml:86:5: QML Connections: Cannot assign to non-existent property "onSliderMoved"
    qrc:/Slider.qml:78:5: QML Connections: Cannot assign to non-existent property "onTextChanged"
    qrc:/Slider.qml:34:7: Unable to assign QQuickAnchorLine to QQuickItem*
    qrc:/Slider.qml:79: ReferenceError: yourObject is not defined
    qrc:/Slider.qml:87: ReferenceError: yourObject1 is not defined
    qrc:/Slider.qml:34:7: Unable to assign QQuickAnchorLine to QQuickItem*
    qrc:/Slider.qml:79: ReferenceError: yourObject is not defined
    qrc:/Slider.qml:34:7: Unable to assign QQuickAnchorLine to QQuickItem*

    ODБOïO 1 Reply Last reply
    0
    • ? A Former User

      I write a connect between a circular gauge created with qml and a slider, and the signal is sent by the slider..it works but I have these warnings:

      qrc:/Slider.qml:86:5: QML Connections: Cannot assign to non-existent property "onSliderMoved"
      qrc:/Slider.qml:78:5: QML Connections: Cannot assign to non-existent property "onTextChanged"
      qrc:/Slider.qml:34:7: Unable to assign QQuickAnchorLine to QQuickItem*
      qrc:/Slider.qml:79: ReferenceError: yourObject is not defined
      qrc:/Slider.qml:87: ReferenceError: yourObject1 is not defined
      qrc:/Slider.qml:34:7: Unable to assign QQuickAnchorLine to QQuickItem*
      qrc:/Slider.qml:79: ReferenceError: yourObject is not defined
      qrc:/Slider.qml:34:7: Unable to assign QQuickAnchorLine to QQuickItem*

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

      hi
      @vale88

      can you show us the content of Slider.qml, is "Slider.qml" a file created by you ? It should not, When you create your own Components don't use existing QML Type names.

      ? 1 Reply Last reply
      2
      • ODБOïO ODБOï

        hi
        @vale88

        can you show us the content of Slider.qml, is "Slider.qml" a file created by you ? It should not, When you create your own Components don't use existing QML Type names.

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

        @LeLev

        import QtQuick 2.6
        import QtQuick.Controls 2.1
        import QtQuick.Extras 1.4
        import QtQuick.Controls.Styles 1.4
        
        Rectangle{
            id: rectangle
        
            width:200
        
            height: 130
        
        
        
        
            color: "#f0f0f0" //setto il colore dello sfondo
            transformOrigin: Item.Left
        
        
            CircularGauge{
        
                id: circularGauge
                x: 0
                y: 29
                width: 200
                height: 150
                anchors.verticalCenterOffset: 48
                anchors.rightMargin: 0
                anchors.topMargin: 31
                anchors.verticalCenter: parent.verticalCenter
                anchors.top: parent.top
                anchors.right: parent.right
        
              anchors.centerIn: parent.bottom
        
                     minimumValue : -30
                     maximumValue : 30
                     style: CircularGaugeStyle
                     {
                         minimumValueAngle : -90
                         maximumValueAngle  : 90
        
        
        
                         foreground: Item
                        {
        
                         }
        
                         tickmark:Rectangle
                         {
                            // visible: styleData.value
                             implicitWidth: outerRadius * 0.02
                           antialiasing:true
                             implicitHeight: outerRadius * 0.05
        
                             color: "Black"
                         }
                         minorTickmark: Rectangle
                         {
                                 //visible: styleData.value
                                 implicitWidth: outerRadius * 0.01
                                 antialiasing: true
                                 implicitHeight: outerRadius * 0.03
                                 color: "Black"
                         }
        
        
        
                         tickmarkLabel:Text
                         {
                             color:"Black"
        
                             text : styleData.value
                         }
                     }
                 }
            Connections {
              target: yourObject
             onTextChanged:
                if (yourObject.text == "")
                    circularGauge.value=-30
                 else {circularGauge.value = yourObject.text}
        
            }
            Connections {
              target: yourObject1
              onSliderMoved: circularGauge.value = (position/10)- 30
            }
        
        
        }
        
        
        
        
        
        
        
        
        
        ODБOïO 1 Reply Last reply
        0
        • ? A Former User

          @LeLev

          import QtQuick 2.6
          import QtQuick.Controls 2.1
          import QtQuick.Extras 1.4
          import QtQuick.Controls.Styles 1.4
          
          Rectangle{
              id: rectangle
          
              width:200
          
              height: 130
          
          
          
          
              color: "#f0f0f0" //setto il colore dello sfondo
              transformOrigin: Item.Left
          
          
              CircularGauge{
          
                  id: circularGauge
                  x: 0
                  y: 29
                  width: 200
                  height: 150
                  anchors.verticalCenterOffset: 48
                  anchors.rightMargin: 0
                  anchors.topMargin: 31
                  anchors.verticalCenter: parent.verticalCenter
                  anchors.top: parent.top
                  anchors.right: parent.right
          
                anchors.centerIn: parent.bottom
          
                       minimumValue : -30
                       maximumValue : 30
                       style: CircularGaugeStyle
                       {
                           minimumValueAngle : -90
                           maximumValueAngle  : 90
          
          
          
                           foreground: Item
                          {
          
                           }
          
                           tickmark:Rectangle
                           {
                              // visible: styleData.value
                               implicitWidth: outerRadius * 0.02
                             antialiasing:true
                               implicitHeight: outerRadius * 0.05
          
                               color: "Black"
                           }
                           minorTickmark: Rectangle
                           {
                                   //visible: styleData.value
                                   implicitWidth: outerRadius * 0.01
                                   antialiasing: true
                                   implicitHeight: outerRadius * 0.03
                                   color: "Black"
                           }
          
          
          
                           tickmarkLabel:Text
                           {
                               color:"Black"
          
                               text : styleData.value
                           }
                       }
                   }
              Connections {
                target: yourObject
               onTextChanged:
                  if (yourObject.text == "")
                      circularGauge.value=-30
                   else {circularGauge.value = yourObject.text}
          
              }
              Connections {
                target: yourObject1
                onSliderMoved: circularGauge.value = (position/10)- 30
              }
          
          
          }
          
          
          
          
          
          
          
          
          
          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by ODБOï
          #4

          qrc:/Slider.qml:34:7: Unable to assign QQuickAnchorLine to QQuickItem* is because of :

          anchors.centerIn: parent.bottom  
          

          qrc:/Slider.qml:87: ReferenceError: yourObject1 is not defined because there is no object width

          id : yourObject1 
          

          in your qml file.
          Where are declared yourObject1 and yourObject ?

          ? 1 Reply Last reply
          5
          • ODБOïO ODБOï

            qrc:/Slider.qml:34:7: Unable to assign QQuickAnchorLine to QQuickItem* is because of :

            anchors.centerIn: parent.bottom  
            

            qrc:/Slider.qml:87: ReferenceError: yourObject1 is not defined because there is no object width

            id : yourObject1 
            

            in your qml file.
            Where are declared yourObject1 and yourObject ?

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

            @LeLev I wrote in mainwindow.cpp:

             //carico il file qml
                ui->Slider_Calib->setSource(QUrl("qrc:///Slider.qml"));
            
                //connect circularGauge e slider
                ui->Slider_Calib->engine()->rootContext()->setContextProperty("yourObject1",ui->horizSlider_Calib);
            
                //connect circularGauge e text
            
             ui->Slider_Calib->engine()->rootContext()->setContextProperty("yourObject",ui->Value_TavRotante_Calib);
            
            ODБOïO 1 Reply Last reply
            0
            • ? A Former User

              @LeLev I wrote in mainwindow.cpp:

               //carico il file qml
                  ui->Slider_Calib->setSource(QUrl("qrc:///Slider.qml"));
              
                  //connect circularGauge e slider
                  ui->Slider_Calib->engine()->rootContext()->setContextProperty("yourObject1",ui->horizSlider_Calib);
              
                  //connect circularGauge e text
              
               ui->Slider_Calib->engine()->rootContext()->setContextProperty("yourObject",ui->Value_TavRotante_Calib);
              
              ODБOïO Offline
              ODБOïO Offline
              ODБOï
              wrote on last edited by
              #6

              hi
              @vale88 said in warning with qml:

              I wrote in mainwindow.cpp:

              where exactly in mainwindow.h ? can you please show the full method ?

              Im non at all experienced with widgets but if your code is working that mean this is only object creation timing issue,
              try to call setSource() after setContextProperty()

              
              
                  //connect circularGauge e slider
                  ui->Slider_Calib->engine()->rootContext()->setContextProperty("yourObject1",ui->horizSlider_Calib);
              
                  //connect circularGauge e text
              
               ui->Slider_Calib->engine()->rootContext()->setContextProperty("yourObject",ui->Value_TavRotante_Calib);
              //carico il file qml
                  ui->Slider_Calib->setSource(QUrl("qrc:///Slider.qml"));
              
              ? 1 Reply Last reply
              1
              • ODБOïO ODБOï

                hi
                @vale88 said in warning with qml:

                I wrote in mainwindow.cpp:

                where exactly in mainwindow.h ? can you please show the full method ?

                Im non at all experienced with widgets but if your code is working that mean this is only object creation timing issue,
                try to call setSource() after setContextProperty()

                
                
                    //connect circularGauge e slider
                    ui->Slider_Calib->engine()->rootContext()->setContextProperty("yourObject1",ui->horizSlider_Calib);
                
                    //connect circularGauge e text
                
                 ui->Slider_Calib->engine()->rootContext()->setContextProperty("yourObject",ui->Value_TavRotante_Calib);
                //carico il file qml
                    ui->Slider_Calib->setSource(QUrl("qrc:///Slider.qml"));
                
                ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                @LeLev thanks, I tried and it works...only a warning remains:

                qrc:/Slider.qml:34:7: Unable to assign QQuickAnchorLine to QQuickItem*

                ODБOïO 1 Reply Last reply
                0
                • ? A Former User

                  @LeLev thanks, I tried and it works...only a warning remains:

                  qrc:/Slider.qml:34:7: Unable to assign QQuickAnchorLine to QQuickItem*

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

                  @vale88 good
                  as i said earlier the last error is because you do this

                  anchors.centerIn: parent.bottom  
                  

                  changeit to anchors.centerIn: parent .bottom if you just want to center it

                  ? 1 Reply Last reply
                  0
                  • ODБOïO ODБOï

                    @vale88 good
                    as i said earlier the last error is because you do this

                    anchors.centerIn: parent.bottom  
                    

                    changeit to anchors.centerIn: parent .bottom if you just want to center it

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

                    @LeLev thanks it works

                    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