Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

VS 2010 + Qt Quick App.



  • I'm sure this has been asked before but since I can't find it I get to ask it again!

    What is the recommended method for creating Qt Quick applications in Visual Studio?

    If I include the QDeclarative module in the project and write the code in an identical way as it is written in Qt Creator I am able to get a window to pop up.

    However, when I try to set a QUrl to read a QML file it either can't find it or has a file case mismatch. I have tried embedding into .qrc files as well.

    Here's the workaround so far: I create a Qt Quick application in Creator and then convert the project to a Visual Studio solution using the Qt Add-In.

    Anyone know of a reason why this would be the case?



  • I'm using VS2008 but have the same.
    With a project structure like this:

    @ProjectFolder

    • main.cpp
    • qml
      • main.qml@

    I have to specify the path to main.qml as:
    viewer.setMainQmlFile(QLatin1String("qml/main.qml")); //in VS2008
    and
    viewer.setMainQmlFile(QLatin1String("qml/qml/main.qml")); //in QtCreator

    I think it's because of "Shadow build" and parameters in .pro file:
    folder_01.source = qml
    folder_01.target = qml

    you can change folder_01.target = .
    then "qml/main.qml" will work for both.



  • Use

    @qmake -tp vc@ on your .pro file.

    This will make proper .sln file to be loaded in Visual Studio.


Log in to reply