Qt World Summit: Register Today!

Can only execute application from editor

  • All I get upon executing my application is a blank screen as if it couldn't find the main qml file. That isn't the case though because upon investigating with ProcMon I put it in the correct location.

    All FILE NOT FOUNDs ProcMon now returns are:

    @D:\MyProject\release\TraktorScrobbler.exe.Local NAME NOT FOUND
    D:\MyProject\release\WINMM.DLL NAME NOT FOUND
    D:\MyProject\release\WINSPOOL.DRV NAME NOT FOUND
    D:\MyProject\release\dwmapi.dll NAME NOT FOUND
    D:\MyProject\release\CRYPTBASE.dll NAME NOT FOUND
    D:\MyProject\release\CRYPTSP.dll NAME NOT FOUND
    D:\MyProject\release\RpcRtRemote.dll NAME NOT FOUND

    I also have been following the other threads covering this problem, like this one http://developer.qt.nokia.com/forums/viewthread/5310/ but it didn't quite fix my problem.

    What else could I have overseen?

  • I don't think anybody can help you with such vague description of problem. Maybe you can post here some realted code snippets?

  • OK, let me-- some information!

    That's how my project-folder looks:

    | +--MyAppFolderName
    | +--main.qml
    | +--images
    | +[All images]
    +--desktop components
    | +--components
    | +--plugin
    | +--libstyleplugin.a
    | +--styleplugin.dll

    I am using the QML Desktop Components mentioned here http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/

    My main.cpp-file looks like this:

    @#include <QtGui/QApplication>
    #include "qmlapplicationviewer.h"
    #include <QtDebug>
    #include "qmlcppmediator.hpp"
    #include <QDeclarativeView>
    #include <QDeclarativeContext>

    int main(int argc, char *argv[])
    QApplication app(argc, argv);

    QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() + "/plugins");
    QmlApplicationViewer viewer;
    QmlCppMediator m_qmlCppMediator;
    QDeclarativeContext *context = viewer.rootContext();
    context->setContextProperty("cppInterface", &m_qmlCppMediator);
    return app.exec&#40;&#41;;


  • Does it help specifying an absolute path instead of a relative path in viewer.setMainQmlFile()?

    If not, does it show up if you use a QDeclarativeView instead of QmlApplicationViewer?
    QDeclarativeView view;

    If so, this indicates there is a problem in the QmlApplicationViewer class.

  • I will test it this evening.

  • It was indeed the path.
    I changed the line to:

    @viewer.setMainQmlFile(QString(QCoreApplication::applicationDirPath() + "/qml/TraktorScrobbler/main.qml"));@

    It now works. Now I've to work on a way to embedd all the qml-crap in the exe-file.

Log in to reply