Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the Title of the window in Qt?

Tags:

c++

window

qt

title

How to change the title of the window in Qt? (Both for QDialog and QMainWindow.)

like image 956
tna0y Avatar asked May 15 '12 09:05

tna0y


People also ask

How do I remove the title bar in Qt?

To remove the frame of any window using Qt you need to use the following piece of code: setWindowFlags(Qt::Window | Qt::FramelessWindowHint); Note that this will also cause the title bar of the window to be removed which means there will be no “close”, “minimize” and “maximize” buttons.


2 Answers

void    QWidget::setWindowTitle ( const QString & )

EDIT: If you are using QtDesigner, on the property tab, there is an editable property called windowTitle which can be found under the QWidget section. The property tab can usually be found on the lower right part of the designer window.

like image 181
UmNyobe Avatar answered Oct 16 '22 18:10

UmNyobe


For new Qt users this is a little more confusing than it seems if you are using QT Designer and .ui files.

Initially I tried to use ui->setWindowTitle, but that doesn't exist. ui is not a QDialog or a QMainWindow.

The owner of the ui is the QDialog or QMainWindow, the .ui just describes how to lay it out. In that case, you would use:

this->setWindowTitle("New Title");

I hope this helps someone else.

like image 54
user1935257 Avatar answered Oct 16 '22 18:10

user1935257