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. Qt Quick 5.7 ERROR "No style available without QApplication "
Forum Updated to NodeBB v4.3 + New Features

Qt Quick 5.7 ERROR "No style available without QApplication "

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 4 Posters 7.2k Views 2 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
    #1

    Hi! Error (windows and ubuntu with last qt 5.7). I created qt quick 2 controls app, add chart 2d bar and try run project, but I've got an error. Look at picture

    It is a bug or I do something wrong?

    jpnurmiJ 1 Reply Last reply
    0
    • ? A Former User

      Hi! Error (windows and ubuntu with last qt 5.7). I created qt quick 2 controls app, add chart 2d bar and try run project, but I've got an error. Look at picture

      It is a bug or I do something wrong?

      jpnurmiJ Offline
      jpnurmiJ Offline
      jpnurmi
      wrote on last edited by jpnurmi
      #2

      @boniface Does it help if you add

      QT += widgets
      

      to your .pro file, and replace QGuiApplication with QApplication in main.cpp?

      ? 1 Reply Last reply
      1
      • jpnurmiJ jpnurmi

        @boniface Does it help if you add

        QT += widgets
        

        to your .pro file, and replace QGuiApplication with QApplication in main.cpp?

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        @jpnurmi Yes, I did, but i have got this error "fatal error C1083: Cannot open include file: 'QApplication': No such file or directory". This error i've got at windows 10, tonight try ubuntu.

        main.cpp

        #include <QApplication>
        #include <QQmlApplicationEngine>

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

        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
        
        return app.exec();
        

        }

        pro file

        TEMPLATE = app
        QT += widgets qml quick charts
        CONFIG += c++11
        SOURCES += main.cpp
        RESOURCES += qml.qrc
        include(deployment.pri)

        jpnurmiJ 1 Reply Last reply
        0
        • ? A Former User

          @jpnurmi Yes, I did, but i have got this error "fatal error C1083: Cannot open include file: 'QApplication': No such file or directory". This error i've got at windows 10, tonight try ubuntu.

          main.cpp

          #include <QApplication>
          #include <QQmlApplicationEngine>

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

          QQmlApplicationEngine engine;
          engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
          
          return app.exec();
          

          }

          pro file

          TEMPLATE = app
          QT += widgets qml quick charts
          CONFIG += c++11
          SOURCES += main.cpp
          RESOURCES += qml.qrc
          include(deployment.pri)

          jpnurmiJ Offline
          jpnurmiJ Offline
          jpnurmi
          wrote on last edited by
          #4

          @boniface Try re-running qmake. For some reason on Windows it doesn't always happen automatically.

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rivonsen
            wrote on last edited by kshegunov
            #5

            This is my .pro file;

            TEMPLATE = app
            
            QT += widgets qml quick charts
            CONFIG += c++11
            
            SOURCES += main.cpp
            
            RESOURCES += qml.qrc
            
            # Additional import path used to resolve QML modules in Qt Creator's code model
            QML_IMPORT_PATH =
            
            # Default rules for deployment.
            include(deployment.pri)
            

            This is my main.cpp;

            #include <QApplication>
            #include <QQmlApplicationEngine>
            
            int main(int argc, char *argv[])
            {
                QApplication app(argc, argv);
            
                QQmlApplicationEngine engine;
                engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
            
                return app.exec();
            }
            

            This is my .qml file

            import QtQuick 2.0
            import QtCharts 2.0
            
            ChartView {
                width: 400
                height: 300
                theme: ChartView.ChartThemeBrownSand
                antialiasing: true
            
                PieSeries {
                    id: pieSeries
                    PieSlice { label: "eaten"; value: 94.9 }
                    PieSlice { label: "not yet eaten"; value: 5.1 }
                }
            }
            

            and i get the same error , I don't know how to solve it

            kshegunovK 1 Reply Last reply
            0
            • R Rivonsen

              This is my .pro file;

              TEMPLATE = app
              
              QT += widgets qml quick charts
              CONFIG += c++11
              
              SOURCES += main.cpp
              
              RESOURCES += qml.qrc
              
              # Additional import path used to resolve QML modules in Qt Creator's code model
              QML_IMPORT_PATH =
              
              # Default rules for deployment.
              include(deployment.pri)
              

              This is my main.cpp;

              #include <QApplication>
              #include <QQmlApplicationEngine>
              
              int main(int argc, char *argv[])
              {
                  QApplication app(argc, argv);
              
                  QQmlApplicationEngine engine;
                  engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
              
                  return app.exec();
              }
              

              This is my .qml file

              import QtQuick 2.0
              import QtCharts 2.0
              
              ChartView {
                  width: 400
                  height: 300
                  theme: ChartView.ChartThemeBrownSand
                  antialiasing: true
              
                  PieSeries {
                      id: pieSeries
                      PieSlice { label: "eaten"; value: 94.9 }
                      PieSlice { label: "not yet eaten"; value: 5.1 }
                  }
              }
              

              and i get the same error , I don't know how to solve it

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #6

              @Rivonsen said in Qt Quick 5.7 ERROR "No style available without QApplication ":

              QApplication

              Have you tried using QGuiApplication, which you should use when not dealing with widgets?

              int main(int argc, char *argv[])
              {
                  QGuiApplication app(argc, argv);
              
                  QQmlApplicationEngine engine;
                  engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
              
                  return QGuiApplication::exec();
              }
              

              With project file:

              TEMPLATE = app
              
              QT += core gui qml quick charts
              CONFIG += c++11
              
              SOURCES += main.cpp
              RESOURCES += qml.qrc
              

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              1

              • Login

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