[solved] Why is Every dialog title appended with "- application name" ?



  • Hi,
    I have been programming for about year in QT but what I am still not getting why every dialog in my application has the name of the application appended to it. So my dialog title is "Settings" but when I show this dialog it shows "Settings - MyApp".

    Is it a setting?

    thanks!



  • Hi and welcome to devnet,

    this is not true.
    Have you special settings on your machine?


  • Lifetime Qt Champion

    Hi,

    What version of Qt on what OS ?



  • Hi, Thanks for helping me. Iam running on Windows7Pro - QT 5.2.1.


  • Moderators

    @Richard I think it is because of windowTitle and applicationDisplayName
    See http://doc.qt.io/qt-5/qwidget.html#windowTitle-prop (last paragraph) and http://doc.qt.io/qt-5/qguiapplication.html#applicationDisplayName-prop



  • @p3c0
    Thanks a lot , you pointed me to the right direction I called:

    QApplication::setApplicationDisplayName(ApplicationName);
    But I figured this was for the QMainWindow only but this is for all the windows.
    When I do not call this anymore the appending of app name is not happening anymore.

    The Help says:
    This property holds the user-visible name of this application.
    This name is shown to the user, for instance in window titles. It can be translated, if necessary.
    If not set, the application display name defaults to the application name.
    This property was introduced in Qt 5.0.

    IMO pretty vague that this leads to such a major GUI change!!!

    This lead me to the next small issue: I am using setWindowFilePath() on opening a file in my application, this made main window title equal to "file name - app name". When not setting the application display name anymore the main window title becomes "file name", undesirable.

    I can work around it by not calling setWindowFilePath() anymore and instead call setWindowTitle(doc name - appname) but this defeats the purpose of having a function such as setWindowFilePath.

    What I would like to have (and this seems sensible on Windows):
    -No addition of app name in dialogs
    -Addition of app name in QMainWindow and use setWindowFilePath.

    Can someone point me to this solution? thanks.

    P.S. I am using QT5.3.2 not 52.1.



  • Some more info from https://msdn.microsoft.com/en-us/library/windows/desktop/dn742478(v=vs.85).aspx

    Title bar text
    Choose the title bar text based on the type of window:
    Top-level, document-centric program windows: Use a "document name — program name" format. Document names are displayed first to give a document-centric feel.
    Top-level program windows that are not document-centric: Display the program name only.
    Dialog boxes: Display the command, feature, or program from which the dialog box came. Don't use the title to explain the dialog box's purpose—that's the purpose of the main instructions. For more guidelines, see Dialog Boxes.
    Wizards: Display the wizard name. Note that the word "wizard" should not be included in wizard names. For more guidelines, see Wizards.

    So now it all comes down to definition.. I guess the default QT behaviour is ok. But would be nice to overrule per dialog!!


  • Moderators

    @Richard setApplicationDisplayName will set the name application wide and thus it will be visible on all windows. No point it having a different application names for all the windows originating from the application.
    You can use setWindowTitle to set title per dialog.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.