Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85845

dragMouse not defined

    XMLWordPrintable

Details

    Description

      I received code from a forum user.
      I have attached a snapshot of the code. (Wrong: it failed again about a missing tag)
      In the application output (and when I run the app in the command line outside of Qt)
      i receive this message: qrc:/main.qml:31: ReferenceError: dragMouse is not defined

      As you can see the dragMouse is defined. The application works even with the
      error.
      Should it fail or should it work? Just wondering which is true.

      Here is the QML file:

      import QtQuick 2.12
      import QtQuick.Window 2.12
      import QtQuick.Controls 2.15
      
      Window
      {
         visible: true
         width: 640
         height: 480
         title: qsTr("Hello World")
      
         Flickable
         {
            anchors.fill: parent
      
            contentWidth: gameBoard.width;
            contentHeight: gameBoard.height
            clip: true
            ScrollBar.horizontal: ScrollBar { active: true}
            ScrollBar.vertical: ScrollBar {  active: true}
      
            Rectangle
            {
               id: gameBoard
               height: 2000
               width: 2000
               color: "grey"
               Repeater
               {
                  model: 10
                  Drag.active: dragMouse.drag.active
                  Rectangle
                  {
                     height: 80;
                     width: 80
                     x : width * index
                     y : height * index
                     color: Qt.rgba(Math.random(),Math.random(),Math.random(),1)
                     MouseArea
                     {
                        id: dragMouse
                        anchors.fill: parent
                        drag.target: parent
                     }
                  }
               }
            }
         }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ablasche Alex Blasche
            lawrence.emke Lawrence Emke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes