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. Error: Unqualified access [unqualified]
Forum Updated to NodeBB v4.3 + New Features

Error: Unqualified access [unqualified]

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 3 Posters 76 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.
  • DeSGuND Offline
    DeSGuND Offline
    DeSGuN
    wrote last edited by
    #1

    Can anyone tell me what the problem is? Python methods he sees, tried to paste mainwindows.backend

    // main.qml
    ApplicationWindow {
        id: mainwindows
        visible: true
        flags: Qt.FramelessWindowHint
        width: Screen.width
        height: Screen.height
        title: "HelloApp"
        
        property var conts: backend // there is a problem here Unqualified access [unqualified]
    
    # python
    if __name__ == "__main__":
        app = QApplication(sys.argv)
        engine = QQmlApplicationEngine()
        
        controller  = MainWindow()
        engine.rootContext().setContextProperty("backend", controller)
        print("Controller registered:", bool(controller)) 
        engine.load("main.qml")
        sys.exit(app.exec())
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi,

      Shouldn't that be const ? You wrote conts.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      DeSGuND 1 Reply Last reply
      0
      • GrecKoG Offline
        GrecKoG Offline
        GrecKo
        Qt Champions 2018
        wrote last edited by
        #3

        Using setContextProperty is not recommended anymore. Use a QML singleton or setInitialProperties on the engine.

        DeSGuND 1 Reply Last reply
        1
        • SGaistS SGaist

          Hi,

          Shouldn't that be const ? You wrote conts.

          DeSGuND Offline
          DeSGuND Offline
          DeSGuN
          wrote last edited by
          #4

          @SGaist I didn't quite understand in python there are several methods example: backend.data() then the backend gives an error Unqualified access [unqualified]

          1 Reply Last reply
          0
          • GrecKoG GrecKo

            Using setContextProperty is not recommended anymore. Use a QML singleton or setInitialProperties on the engine.

            DeSGuND Offline
            DeSGuND Offline
            DeSGuN
            wrote last edited by
            #5

            @GrecKo Thank you, I set setInitialProperties and the errors disappeared

            1 Reply Last reply
            0
            • DeSGuND DeSGuN has marked this topic as solved

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved