使用Qt5,您可以设置应用程序显示名称 http://doc.qt.io/qt-5/qguiapplication.html#applicationDisplayName-prop,它与主标题栏文本分开。
为了显示修改状态 http://doc.qt.io/qt-5/qwidget.html#windowModified-prop在标题栏中,您可以这样做:
QtWidget.qApp.setApplicationDisplayName('Test')
...
window.setWindowFilePath('/path/to/file.txt')
window.setWindowModified(True)
and the title-bar would look like this: file.txt* - Test
或者,您可以在设置标题栏文本时使用特殊的占位符来更多地控制标题栏文本。窗口标题 http://doc.qt.io/qt-5/qwidget.html#windowTitle-prop:
window.setWindowTitle('/path/to/file.txt[*]')
window.setWindowModified(True)
and the title-bar would look like this: /path/to/file.txt* - Test
EDIT:
如果你使用的是Qt4,则不会有applicationDisplayName
,所以你可以尝试这个:
QtGui.qApp.setApplicationName('Test')
...
window.setWindowTitle(
'/path/to/file.txt[*] - %s' % QtGui.qApp.applicationName())
window.setWindowModified(True)
and the title-bar should look like this: /path/to/file.txt* - Test