summaryrefslogtreecommitdiffstats
path: root/examples/mainwindows/application
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-07-14 09:09:06 (GMT)
committerNorwegian Rock Cat <qt-info@nokia.com>2009-07-14 09:18:23 (GMT)
commite3c1fdc994a3743f5c69d944003b1c67698ba6d8 (patch)
tree0cfd07703dd7e676e514a274a02272c4f87d44ce /examples/mainwindows/application
parent43d2ed37baf0f5d05ffe06a91ea4782b9694a1d3 (diff)
downloadQt-e3c1fdc994a3743f5c69d944003b1c67698ba6d8.zip
Qt-e3c1fdc994a3743f5c69d944003b1c67698ba6d8.tar.gz
Qt-e3c1fdc994a3743f5c69d944003b1c67698ba6d8.tar.bz2
Make the mainwindow examples use setWindowFilePath
Should have done this a while ago. Use setWindowFilePath to get proxy icons on mac and simplify window title handling on the other platforms. The only downside is that we do have to specify the application name to get the exact same behavior. But on the other hand, QSettings handlig is a bit better.
Diffstat (limited to 'examples/mainwindows/application')
-rw-r--r--examples/mainwindows/application/main.cpp2
-rw-r--r--examples/mainwindows/application/mainwindow.cpp7
2 files changed, 4 insertions, 5 deletions
diff --git a/examples/mainwindows/application/main.cpp b/examples/mainwindows/application/main.cpp
index f83e709..2fe6d5f 100644
--- a/examples/mainwindows/application/main.cpp
+++ b/examples/mainwindows/application/main.cpp
@@ -49,6 +49,8 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(application);
QApplication app(argc, argv);
+ app.setOrganizationName("Trolltech");
+ app.setApplicationName("Application Example");
MainWindow mainWin;
mainWin.show();
return app.exec();
diff --git a/examples/mainwindows/application/mainwindow.cpp b/examples/mainwindows/application/mainwindow.cpp
index a1eb9b6..16b18b4 100644
--- a/examples/mainwindows/application/mainwindow.cpp
+++ b/examples/mainwindows/application/mainwindow.cpp
@@ -369,13 +369,10 @@ void MainWindow::setCurrentFile(const QString &fileName)
textEdit->document()->setModified(false);
setWindowModified(false);
- QString shownName;
+ QString shownName = curFile;
if (curFile.isEmpty())
shownName = "untitled.txt";
- else
- shownName = strippedName(curFile);
-
- setWindowTitle(tr("%1[*] - %2").arg(shownName).arg(tr("Application")));
+ setWindowFilePath(shownName);
}
//! [47]