Results 1 to 6 of 6

Thread: Combining QML to Qt Application

  1. #1
    Join Date
    May 2017
    Posts
    15
    Qt products
    Qt5
    Platforms
    Windows

    Default Combining QML to Qt Application

    Hello!!

    I am running a Qt Application in Visual Studio and I would like to combine my QML code into the Qt Application.

    I have added qml file in the resources folder of the Qt application and tried to combine it with the following code:


    QQuickView *view = new QQuickView();
    view->setSource(QUrl("main.qml"));

    When I use this code I get 24 unexpected external symbol errors. I would really appreciate the help!

    Thank you!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Combining QML to Qt Application

    What are the errors? What do you have assigned to QT variable in your pro file?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2017
    Posts
    15
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Combining QML to Qt Application

    Severity Code Description Project File Line Suppression State
    Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl QQuickView::QQuickView(class QWindow *)" (__imp_??0QQuickView@@QEAA@PEAVQWindow@@@Z) referenced in function "public: __cdecl QtGuiApplication1::QtGuiApplication1(class QWidget *)" (??0QtGuiApplication1@@QEAA@PEAVQWidget@@@Z) QtGuiApplication1 C:\Users\Desktop\QtGuiApplication1\QtGuiApplicatio n1\QtGuiApplication1.obj 1
    Error LNK2019 unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QQuickView::~QQuickView(void)" (__imp_??1QQuickView@@UEAA@XZ) referenced in function "public: virtual void * __cdecl QQuickView::`scalar deleting destructor'(unsigned int)" (??_GQQuickView@@UEAAPEAXI@Z) QtGuiApplication1 C:\Users\Desktop\QtGuiApplication1\QtGuiApplicatio n1\QtGuiApplication1.obj 1
    Error LNK2019 unresolved external symbol "__declspec(dllimport) public: void __cdecl QQuickView::setSource(class QUrl const &)" (__imp_?setSource@QQuickView@@QEAAXAEBVQUrl@@@Z) referenced in function "public: __cdecl QtGuiApplication1::QtGuiApplication1(class QWidget *)" (??0QtGuiApplication1@@QEAA@PEAVQWidget@@@Z) QtGuiApplication1 C:\Users\Desktop\QtGuiApplication1\QtGuiApplicatio n1\QtGuiApplication1.obj 1
    Error LNK2001 unresolved external symbol "public: virtual class QAccessibleInterface * __cdecl QQuickWindow::accessibleRoot(void)const " (?accessibleRoot@QQuickWindow@@UEBAPEAVQAccessible Interface@@XZ) QtGuiApplication1 C:\Users\Desktop\QtGuiApplication1\QtGuiApplicatio n1\QtGuiApplication1.obj 1

    I am using Visual Studio with Qt and I think I need not add anything to .pro file.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Combining QML to Qt Application

    And what exactly are you trying to do?

    and I think I need not add anything to .pro file.
    Great. What do you need from us then?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    May 2017
    Posts
    15
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Combining QML to Qt Application

    I would like to use the Image in QML as a toolbox in the Qt project. I am using Qt with visual studio and I will be glad if someone could help me with the code.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Combining QML to Qt Application

    Linking problems would indicate the code itself is okay. However since you are trying to combine the widget and QtQuick worlds, you surely need to derive your application from QApplication and not QGuiApplication. And for that you need to link against the widgets module.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Combining OpenCascade into a Qt4 QtCreator application
    By tandrews in forum Qt Programming
    Replies: 1
    Last Post: 10th October 2014, 17:28
  2. Combining two projects Together ???
    By sai_3289 in forum Qt Programming
    Replies: 3
    Last Post: 28th November 2012, 13:17
  3. Combining events in QT
    By kinglui987 in forum Qt Programming
    Replies: 5
    Last Post: 7th November 2012, 15:18
  4. Widgets combining CSS and SVG
    By yop in forum Qt Programming
    Replies: 3
    Last Post: 15th October 2008, 11:02
  5. Combining different widgets
    By ShaChris23 in forum Newbie
    Replies: 3
    Last Post: 1st May 2007, 03:23

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.