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. Can only execute application from editor
Forum Updated to NodeBB v4.3 + New Features

Can only execute application from editor

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 2.9k 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.
  • H Offline
    H Offline
    Hedge
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Hedge
        wrote on last edited by
        #3

        OK, let me-- some information!

        That's how my project-folder looks:

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

        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;
        viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
        
        QmlCppMediator m_qmlCppMediator;
        QDeclarativeContext *context = viewer.rootContext();
        context->setContextProperty("cppInterface", &m_qmlCppMediator);
        
        viewer.setMainQmlFile&#40;QLatin1String("qml/MyProject/main.qml"&#41;&#41;;
        viewer.showExpanded();
        
        
        return app.exec&#40;&#41;;
        

        }
        @

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sigrid
          wrote on last edited by
          #4

          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?
          i.e
          @
          QDeclarativeView view;
          view.setSource(QUrl::fromLocalFile("yourPath/qml/MyProject/main.qml"));
          @

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

          1 Reply Last reply
          0
          • H Offline
            H Offline
            Hedge
            wrote on last edited by
            #5

            I will test it this evening.

            1 Reply Last reply
            0
            • H Offline
              H Offline
              Hedge
              wrote on last edited by
              #6

              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.

              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