PDA

View Full Version : cannot change main window title



marco.stanzani
3rd January 2013, 10:53
a very basic and simple question which is puzzling me

i want to change the title of the main window in my qt application (the GUI has been designed by Qt Design so I have the ui. and setupui() stuff)



MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
QString windowTitle("some good stuf here");
QMessageBox::information(this, progName, windowTitle );

//....
this->setWindowTitle(windowTitle); // ???

ledGreen.load(":/bitmap/LED-Green-20.bmp");
ledRed.load(":/bitmap/LED-Red-20.bmp");
ledDark.load(":/bitmap/LED-Dark-20.bmp");
ui.setupUi(this);

//....
}


can't understand what is wrong here ...

thanks much

Santosh Reddy
3rd January 2013, 11:10
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
QString windowTitle("some good stuf here");
QMessageBox::information(this, progName, windowTitle );

//....
//this->setWindowTitle(windowTitle); // ??? //<<<<<<<<<<<<<<<<<<<<<< Move it, after setupUi();

ledGreen.load(":/bitmap/LED-Green-20.bmp");
ledRed.load(":/bitmap/LED-Red-20.bmp");
ledDark.load(":/bitmap/LED-Dark-20.bmp");
ui.setupUi(this);

this->setWindowTitle(windowTitle); //<<<<<<<<<<<<<<<<<<<<<<Here

//....
}