Unsolved QWIDGET: CANNOT CREATE A QWIDGET WITHOUT QAPPLICATION - Message Box
-
Hi,
I used the Qmessage Box in the project created Qt Quick C++ template.
When I try to show an message box, I encounter the following error:QWIDGET: CANNOT CREATE A QWIDGET WITHOUT QAPPLICATION
Code:
void QtCPPSearchVOne::funsearchMap()
{
QString obj;
obj = QString::QString("Event Fired");QMessageBox msgbox;
msgbox.setText(obj );
msgbox.exec();
}Thanks in advance.
Mathan
-
Hi,
Go to your
main.cpp
You'll see there that aQGuiApplication
is created. Replace it by QApplication.As to why: there's no need for widget support when writing a Qt Quick application unless you make use of classes like QMessageBox.
-
@SGaist said in QWIDGET: CANNOT CREATE A QWIDGET WITHOUT QAPPLICATION - Message Box:
writing
Thank you so much! I had a problem with opencv::imshow. And this solution works well.