Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [Solved] QML-Type "is not a type" when starting application - Main QML-File does not see other QML-File(s)
QtWS25 Last Chance

[Solved] QML-Type "is not a type" when starting application - Main QML-File does not see other QML-File(s)

Scheduled Pinned Locked Moved Installation and Deployment
4 Posts 2 Posters 8.1k 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.
  • M Offline
    M Offline
    Metallicum
    wrote on last edited by
    #1

    After solving the big problem with getting QT Mobility compiled and running (http://qt-project.org/forums/viewthread/29008/) I am facing a new problem:

    I am using Eclipse with PyDev and QT 4.7.4 with QT Mobility 1.2.

    My App which I want to get run has the following structure:

    TwitterCrawler.py
    with the following main code:
    @if name == "main":
    frontend = os.path.join(os.path.realpath(os.path.dirname(file)), "frontend")
    app = QApplication(sys.argv)
    qmlRegisterType(Controller, "TwitterCrawler", 1, 0, "Controller")

    view = QDeclarativeView()
    view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
    root = view.rootContext()
    
    view.setSource(os.path.join(frontend, "frontend.qml")) 
    view.show()
    
    app.exec_()
    sys.exit()        @
    

    frontend/frontend.qml
    frontend/PageStack.js
    frontend/PageStack.qml

    frontend.qml contains the following code:
    @import QtQuick 1.1
    import TwitterCrawler 1.0
    import QtMobility.location 1.2
    import "tweets.js" as Tweets

    PageStack{ // line 26
    id: rootPage
    width: 900
    ...@

    This ends up with:
    @D:\Daten\Eclipse\TwitterCrawler\frontend\frontend.qml:26:1: PageStack is not a type @

    The frontend folder also contains a frontend.qmlproject with the following code:
    @import QmlProject 1.1

    Project {
    mainFile: "frontend.qml"

    /* Include .qml, .js, and image files from current directory and subdirectories */
    QmlFiles {
        directory: "."
    }
    JavaScriptFiles {
        directory: "."
    }
    ImageFiles {
        directory: "."
    }
    /* List of plugin directories passed to QML runtime */
    // importPaths: [ "../exampleplugin" ]
    

    }@

    As this is a program which was not created by me and already worked at the developer who gave it to me, I am now not sure what I might have done wrong or what the developer did in another way...

    1 Reply Last reply
    0
    • P Offline
      P Offline
      portoist
      wrote on last edited by
      #2

      I don't have experience with Qt in Python, or QtMobility, but first thing I would try is importing you PageStack.qml manualy in frontend.qml
      @
      ...
      import "PageStack.qml" as PageStack

      PageStack
      @
      And in main method I would try relative path (maybe in Python it is has to be absolute, but I have never tried Qt in Python):
      @
      view.setSource("frontend/frontend.qml"))
      @

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Metallicum
        wrote on last edited by
        #3

        [quote author="portoist" date="1372840729"]
        And in main method I would try relative path (maybe in Python it is has to be absolute, but I have never tried Qt in Python):
        @view.setSource("frontend/frontend.qml"))@
        [/quote]

        As you mentioned and I found out yesterday night, that's the solution ;)

        1 Reply Last reply
        0
        • P Offline
          P Offline
          portoist
          wrote on last edited by
          #4

          Thats great!:) You can mark this as solved by editing your topic and adding [Solved] to the title.

          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