I want to change the default QMessageBox
title to something else, so that I don't have to call setWindowTitle
for every individual message box.
How is the default window title chosen?
I want to change the default QMessageBox
title to something else, so that I don't have to call setWindowTitle
for every individual message box.
How is the default window title chosen?
Best way to do this is to subclass QMessageBox
, e.g.:
class MyMessageBox : public QMessageBox
{
MyMessageBox() //<-- default constructor
{
setWindowTitle("Default title goes here"); //QMessageBox function
}
};
Use MyMessageBox
everywhere in the code.
You could instead add a TARGET in the .pro file. e.g. add this line to the .pro file:
TARGET = MyApp
Thus "MyApp" will be applied both as the executable file name and also as default value for windowTitle of all QMessageBoxes in the entire project.
You don't need to call setWindowTitle
method while you can title when you instance the QMessageBox object.
On Windows developing with VC2008 it takes the name from the project. Change the name of the project and it will change the title.