i am new in qt . i have written a console application . now i want to show a message box or pop up message in run time . how to do this?
i am new in qt . i have written a console application . now i want to show a message box or pop up message in run time . how to do this?
messagebox is in QtGui, u need to link against them.
My suggession is u can simply print the message.
hope it helps
Bala
can u give me some idea how to link console application with QtGui .. thanks
See in the .pro file and if you have something like QT -= gui delete it (the gui module should be included by default, if not explicitly removed)
Also you also need a QApplication, because QCoreApplication is not enough.
ok you are saying i need QApplication,so only including the "QApplication.h" will be enough?
No, you need to instantiate QApplication instead of QCoreApplication as your application currently does.
Your application will not be a console application anymore. It will be a GUI application that happens to be interacting primarily through its standard input and output streams.
ok but my application is console application. i have added one Qtdesigner form.. now i am facing problem to how to call that form from my application.. i dont have any other options.
It's odd situation of using console based app with ui. Why do you need such behavior?
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Why do you keep calling "console application" an application that displays message boxes and forms designed in QtDesigner? It is a GUI application, and you must instantiate QApplication. This does not prevent you from reading from the standard input and writing to the standard output like console applications do.
All you have to do is instantiate the widgets, show them when you feel like it, and make sure an event loop runs for the user to interact with them. You can use std::cin and std::cout as much as you want.
Bookmarks