Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Move from QML Only Application to Qt Quick Application with C++
Qt 6.12 LTS is out! See what's new in the release blog

Move from QML Only Application to Qt Quick Application with C++

Scheduled Pinned Locked Moved QML and Qt Quick
27 Posts 7 Posters 29.0k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #3

    @Running build steps for project Main...
    Configuration unchanged, skipping qmake step.
    Starting: "/usr/bin/make" -w
    make: Entering directory /Users/kp/Desktop/Precision Work/Harvest DU Repository/Main-build-desktop' g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_DECLARATIVE_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I../Main -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtDeclarative.framework/Versions/4/Headers -I/usr/include/QtDeclarative -I/usr/include -I../Main/qmlapplicationviewer -I. -I../Main -I. -F/Library/Frameworks -o main.o ../Main/main.cpp g++ -headerpad_max_install_names -o Main.app/Contents/MacOS/Main main.o qmlapplicationviewer.o moc_qmlapplicationviewer.o -F/Library/Frameworks -L/Library/Frameworks -framework QtDeclarative -L/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib -F/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib -framework QtScript -framework QtSvg -framework QtSql -framework QtXmlPatterns -framework QtOpenGL -framework QtNetwork -framework QtGui -framework QtCore ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -L not found ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -F not found Copying application data... cp: Repository/Main/../QML: No such file or directory make: *** [copydeploymentfolders] Error 1 make: Leaving directory /Users/kp/Desktop/Precision Work/Harvest DU Repository/Main-build-desktop'
    The process "/usr/bin/make" exited with code 2.
    Error while building project Main (target: Desktop)
    When executing build step 'Make'@

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #4

      Seems to be some issue with the path

      bq. cp: Repository/Main/../QML: No such file or directory

      Its not able to find the above location, please verify this in your code.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #5

        The folder exists... and all that is in my cpp file is this:

        @#include <QtGui/QApplication>
        #include "qmlapplicationviewer.h"

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

        QmlApplicationViewer viewer;
        viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
        viewer.setMainQmlFile&#40;QLatin1String("QML/QMLFinal.qml"&#41;);
        viewer.showExpanded();
        
        return app.exec();
        

        }
        @

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #6

          Check if the folder exists at this path

          @/Users/kp/Desktop/Precision Work/Harvest DU Repository/Main-build-desktop@

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #7

            It does not. Do I need to copy it in there manually?

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #8

              copying it manually will fix it. But you will have to add it in your .pro file or better still put QML into your resource file.

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #9

                how do I add it to my pro file or resource file? Will doing so negate the need to move it in manually?

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #10

                  [quote author="kyleplattner" date="1293047005"]how do I add it to my pro file or resource file? Will doing so negate the need to move it in manually?[/quote]

                  You can add them as OTHER_FILES to .pro

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #11

                    [quote author="kyleplattner" date="1293047005"]how do I add it to my pro file or resource file? Will doing so negate the need to move it in manually?[/quote]

                    The best option is to use "resource":http://doc.qt.nokia.com/4.0/resources.html. You can use Qt Creator to add a new resource. Just check the docs for more info.

                    1 Reply Last reply
                    0
                    • ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #12

                      Seems like this is a bug that needs fixing.

                      1 Reply Last reply
                      0
                      • ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #13

                        Still having problems with this:

                        ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -L not found
                        ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -F not found

                        Any ideas there?

                        1 Reply Last reply
                        0
                        • ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by
                          #14

                          [quote author="QtK" date="1293047938"]
                          [quote author="kyleplattner" date="1293047413"]Seems like this is a bug that needs fixing. [/quote]

                          No its not a bug. But yes it can be enhanced, so that Qt Creator does it automatically[/quote]

                          1 Reply Last reply
                          0
                          • ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #15

                            [quote author="kyleplattner" date="1293047844"]Still having problems with this:

                            ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -L not found
                            ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -F not found

                            Any ideas there?[/quote]

                            Its a warning right. Your app must be compiled properly now.

                            1 Reply Last reply
                            0
                            • ? Offline
                              ? Offline
                              A Former User
                              wrote on last edited by
                              #16

                              Added the .qrc and still having this error stop my build:

                              @Running build steps for project Main...
                              Configuration unchanged, skipping qmake step.
                              Starting: "/usr/bin/make" -w
                              make: Entering directory /Users/kp/Desktop/Precision Work/Harvest DU Repository/Main-build-desktop' /Developer/Tools/Qt/rcc -name Main ../Main/Main.qrc -o qrc_Main.cpp g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_DECLARATIVE_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I../Main -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/Library/Frameworks/QtDeclarative.framework/Versions/4/Headers -I/usr/include/QtDeclarative -I/usr/include -I../Main/qmlapplicationviewer -I. -I../Main -I. -F/Library/Frameworks -o qrc_Main.o qrc_Main.cpp g++ -headerpad_max_install_names -o Main.app/Contents/MacOS/Main main.o qmlapplicationviewer.o moc_qmlapplicationviewer.o qrc_Main.o -F/Library/Frameworks -L/Library/Frameworks -framework QtDeclarative -L/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib -F/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib -framework QtScript -framework QtSvg -framework QtSql -framework QtXmlPatterns -framework QtOpenGL -framework QtNetwork -framework QtGui -framework QtCore ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -L not found ld: warning: directory '/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib' following -F not found Copying application data... cp: Repository/Main/../QML: No such file or directory make: *** [copydeploymentfolders] Error 1 make: Leaving directory /Users/kp/Desktop/Precision Work/Harvest DU Repository/Main-build-desktop'
                              The process "/usr/bin/make" exited with code 2.
                              Error while building project Main (target: Desktop)
                              When executing build step 'Make'@

                              1 Reply Last reply
                              0
                              • ? Offline
                                ? Offline
                                A Former User
                                wrote on last edited by
                                #17

                                The error is same as you received above right. Please try it first and then make an attempt to post or ask - this way you will learn better.

                                Also you might have added it in your .qrc, but are you loading qml file from that path.

                                1 Reply Last reply
                                0
                                • ? Offline
                                  ? Offline
                                  A Former User
                                  wrote on last edited by
                                  #18

                                  When I try running the compiled application I get:

                                  <Unknown File>: File error for URL file:///Users/kp/Desktop/Precision Work/Harvest DU Repository/Main-build-desktop/Main.app/Contents/Resources/QML/QMLFinal.qml

                                  1 Reply Last reply
                                  0
                                  • ? Offline
                                    ? Offline
                                    A Former User
                                    wrote on last edited by
                                    #19

                                    Would someone be willing to make a Wiki on the process of going from a QML only application to a Qt Quick C++ Application. It seems like a process many people go through so it would be helpful. I have found the process really difficult and I still have not got it done yet. Thanks.

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      mbrasser
                                      wrote on last edited by
                                      #20

                                      What version of Creator are you using? This might be something that has been recently improved -- I'm compiling Creator from source, and the conversion from QML-only to QML + C++ project seems to "just work", at least for a small test case (and in general, QML support in Creator has been progressing at a very rapid pace in recent months). I've found the Creator team very responsive to feedback -- if you have suggestions for improving the process I'd highly recommend adding a report on bugreports.qt.nokia.com.

                                      Regards,
                                      Michael

                                      1 Reply Last reply
                                      0
                                      • ? Offline
                                        ? Offline
                                        A Former User
                                        wrote on last edited by
                                        #21

                                        Qt Creator 2.0.94 (2.1.0-rc1)
                                        Based on Qt 4.7.1 (64 bit)

                                        Built on Nov 25 2010 at 01:05:40

                                        From revision f9ba753654

                                        1 Reply Last reply
                                        0
                                        • ? Offline
                                          ? Offline
                                          A Former User
                                          wrote on last edited by
                                          #22

                                          Try to build it in a directory without spaces in it's path. At least under windows the "Qt Quick Application" template won't work in a directory with spaces in it's path. The windows symptoms were a failure in the copydeploymentfolders step and this looks similar.

                                          There was a bug reported with a patch to fix this but it was closed as a "won't fix" from memory since qmake apparently doesn't handle spaces well either.

                                          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
                                          • Unsolved