Results 1 to 3 of 3

Thread: windowTitle in an MDI application

  1. #1
    Join Date
    Jun 2006
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default windowTitle in an MDI application

    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....

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: windowTitle in an MDI application

    Could you post a minimal compilable example reproducing the problem? Have you tried upgrading to 4.2.1?

  3. #3
    Join Date
    Jun 2006
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: windowTitle in an MDI application

    Wysota,

    Thanks for your response. I actually ended up submitting the problem to TrollTech and they found this was a bug in QWorkspace. I attached the patch I was sent, which I haven't gotten a chance to rebuild the Qt libraries yet to verify it works, but I'm assuming it does.


    Hopefully this will help anyone else who runs into the same problem....
    Attached Files Attached Files

Similar Threads

  1. Replies: 3
    Last Post: 8th December 2006, 18:51
  2. Application default font
    By larry104 in forum Qt Programming
    Replies: 2
    Last Post: 16th September 2006, 01:24
  3. Gnome makes application crash
    By regix in forum Qt Programming
    Replies: 35
    Last Post: 18th August 2006, 19:44
  4. Replies: 5
    Last Post: 24th April 2006, 15:42
  5. Replies: 3
    Last Post: 31st March 2006, 18:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.