summaryrefslogtreecommitdiffstats
path: root/examples/mainwindows/sdi
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/sdi
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/sdi')
-rw-r--r--examples/mainwindows/sdi/main.cpp2
-rw-r--r--examples/mainwindows/sdi/mainwindow.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/examples/mainwindows/sdi/main.cpp b/examples/mainwindows/sdi/main.cpp
index a7e20d8..055d761 100644
--- a/examples/mainwindows/sdi/main.cpp
+++ b/examples/mainwindows/sdi/main.cpp
@@ -47,6 +47,8 @@ int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(sdi);
QApplication app(argc, argv);
+ app.setApplicationName("SDI Example");
+ app.setOrganizationName("Trolltech");
MainWindow *mainWin = new MainWindow;
mainWin->show();
return app.exec();
diff --git a/examples/mainwindows/sdi/mainwindow.cpp b/examples/mainwindows/sdi/mainwindow.cpp
index 8710105..1e7f2c0 100644
--- a/examples/mainwindows/sdi/mainwindow.cpp
+++ b/examples/mainwindows/sdi/mainwindow.cpp
@@ -266,7 +266,7 @@ void MainWindow::createStatusBar()
void MainWindow::readSettings()
{
- QSettings settings("Trolltech", "SDI Example");
+ QSettings settings;
QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
QSize size = settings.value("size", QSize(400, 400)).toSize();
move(pos);
@@ -275,7 +275,7 @@ void MainWindow::readSettings()
void MainWindow::writeSettings()
{
- QSettings settings("Trolltech", "SDI Example");
+ QSettings settings;
settings.setValue("pos", pos());
settings.setValue("size", size());
}
@@ -352,9 +352,7 @@ void MainWindow::setCurrentFile(const QString &fileName)
textEdit->document()->setModified(false);
setWindowModified(false);
-
- setWindowTitle(tr("%1[*] - %2").arg(strippedName(curFile))
- .arg(tr("SDI")));
+ setWindowFilePath(curFile);
}
QString MainWindow::strippedName(const QString &fullFileName)