What determines the default title for a QMessageBox?

Pieter picture Pieter · Apr 18, 2011 · Viewed 8.6k times · Source

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?

Answer

PnotNP picture PnotNP · May 12, 2017

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.