Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-53394

QML Window title not initially shown correctly

    XMLWordPrintable

Details

    • b8a0c6e7c52ebf56d0895f798946d1f1dbb00c35 (qtbase/5.7, 22.5.2016, 5.7.0)

    Description

      On Windows 10, the window below will have a title of "My Custom Title!", whereas it should be "My Custom Title! - ApplicationDisplayName".

      main.qml
      import QtQuick 2.6
      import QtQuick.Controls 2.0
      import QtQuick.Window 2.1 // works with 2.0
      
      Window {
          objectName: "window"
          width: 1200
          height: 600
          title: "My Custom Title!"
      //    title: "My Custom Title - " + (project.loaded ? ("Untitled" + (project.unsavedChanges ? "*" : "")) : "None")
          visible: true
      
          readonly property int controlSpacing: 10
      
          QtObject {
              id: project
              objectName: "project"
      
              property bool loaded: false
              property url url: ""
              property bool unsavedChanges: false
          }
      
          Button {
              text: "Load project"
              anchors.centerIn: parent
              onClicked: {
                  project.loaded = true;
                  project.unsavedChanges = true;
              }
          }
      }
      
      main.cpp
      #include <QGuiApplication>
      #include <QtQml>
      
      int main(int argc, char *argv[])
      {
          QGuiApplication *app = new QGuiApplication(argc, argv);
          app->setOrganizationName("OrganizationName");
          app->setApplicationName("ApplicationName");
          app->setOrganizationDomain("OrganizationDomain");
          app->setApplicationDisplayName("ApplicationDisplayName");
          app->setApplicationVersion("0.0");
      
          QQmlApplicationEngine engine;
          engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
          Q_ASSERT(!engine.rootObjects().isEmpty());
      
          return app->exec();
      }
      

      Causing the title expression to reevaluate (by e.g. uncommenting the line above) will result in it being displayed correctly. Window exhibits the correct behaviour.

      Attachments

        1. qtbug53394.zip
          2 kB
          Friedemann Kleint
        For Gerrit Dashboard: QTBUG-53394
        # Subject Branch Project Status CR V

        Activity

          People

            kleint Friedemann Kleint
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes