charlesD
7th November 2006, 19:55
Can someone tell me how to properly handle the situation described below. I apologize for the description length, but it's a very specific situation:
I have an application which allows opening a project file and multiple associated child windows. When the App is running without an open project, the application name is placed into the title bar (in the app constructor) using:
QWidget::setWindowTitle(QApplication::applicationN ame());
When I open a project, I place the project name with the application name in the title bar:
QWidget::setWindowTitle(tr("%1 - %2").arg(QApplication::applicationName())
.arg(this->mpProject->userFriendlyCurrentFile()))
After opening the project, I open one child window to start with, (the user can open additional child windows at a later time if desired). Each child window has its own title set:
ChildWindow::setWindowTitle("View%1").arg(counter++);
Once the initial child window is created, I call showMaximized on the child window, which works fine the first time, i.e. title bar shows: "AppName - ProjectNameA [View1]". If I close my project - which resets the title to the app name only, and then reopen a different project, the title bar is initially set to the correct "Appname - ProjectNameB". However, when I create a child window for the new project and showMaximized is called on the new child window, the first opened project name is redisplayed: "AppName - ProjectNameA [View1]". It seems the original project name is still stored somewhere in memory.
Is there a better way to handle titling windows that will avoid this issue?
I am using Qt version 4.1.4 in Windows XP - Visual Studio .Net 2003
Thanks for any help....
I have an application which allows opening a project file and multiple associated child windows. When the App is running without an open project, the application name is placed into the title bar (in the app constructor) using:
QWidget::setWindowTitle(QApplication::applicationN ame());
When I open a project, I place the project name with the application name in the title bar:
QWidget::setWindowTitle(tr("%1 - %2").arg(QApplication::applicationName())
.arg(this->mpProject->userFriendlyCurrentFile()))
After opening the project, I open one child window to start with, (the user can open additional child windows at a later time if desired). Each child window has its own title set:
ChildWindow::setWindowTitle("View%1").arg(counter++);
Once the initial child window is created, I call showMaximized on the child window, which works fine the first time, i.e. title bar shows: "AppName - ProjectNameA [View1]". If I close my project - which resets the title to the app name only, and then reopen a different project, the title bar is initially set to the correct "Appname - ProjectNameB". However, when I create a child window for the new project and showMaximized is called on the new child window, the first opened project name is redisplayed: "AppName - ProjectNameA [View1]". It seems the original project name is still stored somewhere in memory.
Is there a better way to handle titling windows that will avoid this issue?
I am using Qt version 4.1.4 in Windows XP - Visual Studio .Net 2003
Thanks for any help....