How to run te application with QtQuick.Controls?



  • When I import QtQuick.Controls 1.0 there is an error while debugging:

    bq. Error: No widget style available.
    Qt Quick Controlscurrently depend on the widget module to function.
    Use QApplication when creating standalone executables.

    Should I add an import or maybe an include somewhere?



  • You are probably running your app with a QGuiApplication as the application instance. Just change that to QApplication and it should work fine.



  • Thank you for a hint. I've change QGuiApplication for QApplication and also include <QtWidgets/QApplication> instead of <QtGui/QGuiApplication> but there are some linking problems and no main.obj file.
    I've created Qt Quick 2 Application (build-in elements). I'm also using Qt 5.1 alpha, but I had a problem during compiling it (http://qt-project.org/forums/viewthread/26325/#122803) maybe that's the ponit.



  • Did you also add "QT += widgets" in your .pro file? There is an ApplicationTemplate example in the examples folder that should work out of the box.



  • I run the ApplicationTemplate. There are some warnings and the
    bq.
    import QtQuick.Layouts 1.0

    is underlined (errors during typeinfo files reading), but it works. My test app also works but I had to remove qmlapplicaionviewer folder and copy the main.cpp and .pro file from the example.

    When I switch into the design mode QtCreator just dies. But at least in Edit mode it's working. So thank you, thank you, thank you! :)

    Edit: maybe it doesn't work well.. QtCreator slowed down and often dosn't answer. The MenuBar is underlined (Could not resolve the prototype 'MenuBarPrivate' of 'MenuBar' (M301) ), but it builds the application.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.