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. [Qt Quick Python] Resources is not a type while loading qml file from resources python file
Forum Updated to NodeBB v4.3 + New Features

[Qt Quick Python] Resources is not a type while loading qml file from resources python file

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 155 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.
  • J Offline
    J Offline
    jiri_otoupal
    wrote on last edited by
    #1

    Hello i had converted .qrc file into .py and imported it into launched file.
    When im loading icons it works but it does not work if i want to load .qml file to engine and always end up with "Resources is not a type" warning

    Here are my files:

    main.qrc:

    <RCC>
    <qresource>
        <file>sprits/utpim_bg1-1-1024x576.png</file>
        <file>sprits/icon.ico</file>
        <file>main.qml</file>
    </qresource>
    </RCC>
    

    main.py:

    import sys
    import res # Converted Resource file with Pyside2-rcc
    from PySide2.QtCore import QUrl
    from PySide2.QtGui import QIcon
    from PySide2.QtGui import QGuiApplication
    from PySide2.QtQml import QQmlApplicationEngine
    
    
    
    
    if __name__ == "__main__":
        app = QGuiApplication(sys.argv)
        app.setWindowIcon(QIcon(":/sprits/icon.ico"))
        engine = QQmlApplicationEngine()
        engine.load(QUrl("qrc:/main.qml"))
    
        if not engine.rootObjects():
            sys.exit(-1)
        sys.exit(app.exec_())
    

    The directory looks like:
    /ui
    sprits
    main.qrc
    main.qml
    main.py
    res.py
    /ui/sprits
    icon.ico
    ....

    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