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. How to convert QGuiApplication to QApplication ?

How to convert QGuiApplication to QApplication ?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qt6qtchartqguiapplicationqapplication
5 Posts 3 Posters 772 Views
  • 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.
  • A Offline
    A Offline
    Aminsl
    wrote on 30 Jul 2023, 17:37 last edited by Aminsl
    #1

    I'm trying to use PolarChartView in Qt6 and writing the code in qt creator 10 but when I run my code , the application crashes and the console log says it just crashed. I figured out that I have to change QGuiApplication to QApplication and I made these configurations to my main.cpp file but I got these errors :
    :-1: error: D:/CppProjects/RadarChart/main.cpp:17: undefined reference to `__imp__ZN12QApplicationD1Ev'
    :-1: error: D:/CppProjects/build-radarchart-Desktop_Qt_6_5_1_MinGW_64_bit-Debug/Debug_Desktop__9a53abaa43e654f2/radarchart.8c396ce1/3a52ce780950d4d9/main.cpp.o:D:/CppProjects/RadarChart/main.cpp:7: undefined reference to `__imp__ZN12QApplicationC1ERiPPci'

    And this is my main.cpp file :

    #include <QtWidgets/QApplication>
    #include <QQmlApplicationEngine>
    
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        QQmlApplicationEngine engine;
        const QUrl url(u"qrc:/RadarChart/Main.qml"_qs);
        QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
            &app, []() { QCoreApplication::exit(-1); },
            Qt::QueuedConnection);
        engine.load(url);
    
        return app.exec();
    }
    
    1 Reply Last reply
    0
    • A Aminsl
      31 Jul 2023, 10:24

      @SGaist I'm using Qbs so I don't have .pro file

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 31 Jul 2023, 11:48 last edited by
      #4

      @Aminsl So, do you have

      Depends { name: "Qt.widgets" }
      

      ?
      https://doc.qt.io/qbs/qt-modules.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply 1 Aug 2023, 13:00
      4
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 30 Jul 2023, 18:23 last edited by
        #2

        Hi,

        Did you add QT += widgets to your .pro file ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        A 1 Reply Last reply 31 Jul 2023, 10:24
        1
        • S SGaist
          30 Jul 2023, 18:23

          Hi,

          Did you add QT += widgets to your .pro file ?

          A Offline
          A Offline
          Aminsl
          wrote on 31 Jul 2023, 10:24 last edited by
          #3

          @SGaist I'm using Qbs so I don't have .pro file

          J 1 Reply Last reply 31 Jul 2023, 11:48
          0
          • A Aminsl
            31 Jul 2023, 10:24

            @SGaist I'm using Qbs so I don't have .pro file

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 31 Jul 2023, 11:48 last edited by
            #4

            @Aminsl So, do you have

            Depends { name: "Qt.widgets" }
            

            ?
            https://doc.qt.io/qbs/qt-modules.html

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            A 1 Reply Last reply 1 Aug 2023, 13:00
            4
            • J jsulm
              31 Jul 2023, 11:48

              @Aminsl So, do you have

              Depends { name: "Qt.widgets" }
              

              ?
              https://doc.qt.io/qbs/qt-modules.html

              A Offline
              A Offline
              Aminsl
              wrote on 1 Aug 2023, 13:00 last edited by
              #5

              @jsulm Thanks , yes I missed this. now It's working ! Thank you

              1 Reply Last reply
              1
              • A Aminsl has marked this topic as solved on 1 Aug 2023, 13:00

              1/5

              30 Jul 2023, 17:37

              • Login

              • Login or register to search.
              1 out of 5
              • First post
                1/5
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved