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

Inconsistence in setWindowTitle + setWindowFilePath

    XMLWordPrintable

Details

    • Bug
    • Status: Reported
    • P3: Somewhat important
    • Resolution: Unresolved
    • 5.6.0
    • None
    • None
    • Debian GNU/Linux sid amd64

    Description

      Consider this code:

      int main(int argc, char **argv) {
          QApplication app(argc, argv);
          QWidget widget;
      
          widget.show();
          widget.setWindowFilePath(QStringLiteral("/my/file"));
          widget.setWindowTitle(QString());
          widget.setWindowFilePath(QStringLiteral("/my/file"));
      
          return app.exec();
      }
      

      When executed, the window title is the app name (i.e. “test”).

      However if the first setWindowFilePath call is commented out, it shows “file”. Also if the file names are different, it also shows the file name.

      This is a bit inconsistent.

      The documentation says: “If the window title is set at any point, then the window title takes precedence and will be shown instead of the file path string”. However, setting window title to a null string is unsetting it (or otherwise what else would be a way to unset it)?

      Removing these lines from QWidget::setWindowFilePath implementation should fix it:

          if (filePath == windowFilePath())
              return;
      

      I am not sure whether this should be done or the current behavior is expected.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            mandriver Dmitry Shachnev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes