Please nominate your Qt Champions for 2021!

[Solved] Qt Popup and C++/QML Application

  • Hello,

    i'm unsure of where to post this but hey, having a try here.

    I'm currently developing a GUI in cpp/QML.

    I got a HMI Manager which is a QObject for the managing of the signals and the communication with the rest of the app and qml files for the Graphical part and managing actions from the user. The cpp creates the QQuickView and loads the qml at init and connect signals and all this.

    At that point, no problem.

    I just want to display a pop-up to make some kind of authentification (secured mode to control a camera rotation, etc) and I'm wondering where to create the pop-up.

    As a dynamically created QML object or in the Manager with sort of QMessageBox ( solution i tried and it asks me that i can't make QWidgets without QApplication, I got a QGuiApplication thought.) ?

    What's the best practice and what's possible to do ?

  • Well... QMessageBox is part of QtWidgets module and documentation states that for QWidget based Qt applications you should use QApplication because it provides "some" functionality needed for creating QWidget instances. Therefore you need QApplication for QMessageBox. You should use QApplication for all your GUI based applications as you will be probably be needing to add QWidgets or other derived classes.

  • You're right, i'm a bit tired. Misread the docs before posting.

    Thanks !

Log in to reply