summaryrefslogtreecommitdiffstats
path: root/examples/mainwindows
diff options
context:
space:
mode:
Diffstat (limited to 'examples/mainwindows')
-rw-r--r--examples/mainwindows/application/application.pro2
-rw-r--r--examples/mainwindows/application/main.cpp2
-rw-r--r--examples/mainwindows/application/mainwindow.cpp17
-rw-r--r--examples/mainwindows/dockwidgets/dockwidgets.pro2
-rw-r--r--examples/mainwindows/dockwidgets/mainwindow.cpp2
-rw-r--r--examples/mainwindows/mainwindows.pro6
-rw-r--r--examples/mainwindows/mdi/mainwindow.cpp3
-rw-r--r--examples/mainwindows/mdi/mdi.pro2
-rw-r--r--examples/mainwindows/menus/mainwindow.cpp8
-rw-r--r--examples/mainwindows/menus/menus.pro5
-rw-r--r--examples/mainwindows/recentfiles/main.cpp2
-rw-r--r--examples/mainwindows/recentfiles/mainwindow.cpp14
-rw-r--r--examples/mainwindows/recentfiles/recentfiles.pro2
-rw-r--r--examples/mainwindows/sdi/main.cpp2
-rw-r--r--examples/mainwindows/sdi/mainwindow.cpp10
-rw-r--r--examples/mainwindows/sdi/sdi.pro2
16 files changed, 53 insertions, 28 deletions
diff --git a/examples/mainwindows/application/application.pro b/examples/mainwindows/application/application.pro
index ad1168a..0851f72 100644
--- a/examples/mainwindows/application/application.pro
+++ b/examples/mainwindows/application/application.pro
@@ -10,3 +10,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/mainwindows/application
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS application.pro images
sources.path = $$[QT_INSTALL_EXAMPLES]/mainwindows/application
INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/mainwindows/application/main.cpp b/examples/mainwindows/application/main.cpp
index bb913cd..ead5ff9 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 a4623b5..687a3e0 100644
--- a/examples/mainwindows/application/mainwindow.cpp
+++ b/examples/mainwindows/application/mainwindow.cpp
@@ -174,7 +174,7 @@ void MainWindow::createActions()
//! [20]
exitAct = new QAction(tr("E&xit"), this);
- exitAct->setShortcut(tr("Ctrl+Q"));
+ exitAct->setShortcuts(QKeySequence::Quit);
//! [20]
exitAct->setStatusTip(tr("Exit the application"));
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
@@ -328,9 +328,13 @@ void MainWindow::loadFile(const QString &fileName)
}
QTextStream in(&file);
+#ifndef QT_NO_CURSOR
QApplication::setOverrideCursor(Qt::WaitCursor);
+#endif
textEdit->setPlainText(in.readAll());
+#ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor();
+#endif
setCurrentFile(fileName);
statusBar()->showMessage(tr("File loaded"), 2000);
@@ -351,9 +355,13 @@ bool MainWindow::saveFile(const QString &fileName)
}
QTextStream out(&file);
+#ifndef QT_NO_CURSOR
QApplication::setOverrideCursor(Qt::WaitCursor);
+#endif
out << textEdit->toPlainText();
+#ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor();
+#endif
setCurrentFile(fileName);
statusBar()->showMessage(tr("File saved"), 2000);
@@ -369,13 +377,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]
diff --git a/examples/mainwindows/dockwidgets/dockwidgets.pro b/examples/mainwindows/dockwidgets/dockwidgets.pro
index afc8aaa..a196587 100644
--- a/examples/mainwindows/dockwidgets/dockwidgets.pro
+++ b/examples/mainwindows/dockwidgets/dockwidgets.pro
@@ -8,3 +8,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/mainwindows/dockwidgets
sources.files = $$SOURCES $$HEADERS $$RESOURCES dockwidgets.pro images
sources.path = $$[QT_INSTALL_EXAMPLES]/mainwindows/dockwidgets
INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/mainwindows/dockwidgets/mainwindow.cpp b/examples/mainwindows/dockwidgets/mainwindow.cpp
index ed6dc4b..0d4da15 100644
--- a/examples/mainwindows/dockwidgets/mainwindow.cpp
+++ b/examples/mainwindows/dockwidgets/mainwindow.cpp
@@ -242,7 +242,7 @@ void MainWindow::createActions()
connect(undoAct, SIGNAL(triggered()), this, SLOT(undo()));
quitAct = new QAction(tr("&Quit"), this);
- quitAct->setShortcut(tr("Ctrl+Q"));
+ quitAct->setShortcuts(QKeySequence::Quit);
quitAct->setStatusTip(tr("Quit the application"));
connect(quitAct, SIGNAL(triggered()), this, SLOT(close()));
diff --git a/examples/mainwindows/mainwindows.pro b/examples/mainwindows/mainwindows.pro
index 90ff3a5..661b741 100644
--- a/examples/mainwindows/mainwindows.pro
+++ b/examples/mainwindows/mainwindows.pro
@@ -6,8 +6,14 @@ SUBDIRS = application \
recentfiles \
sdi
+symbian: SUBDIRS = \
+ menus
+
+
# install
target.path = $$[QT_INSTALL_EXAMPLES]/mainwindows
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS mainwindows.pro README
sources.path = $$[QT_INSTALL_EXAMPLES]/mainwindows
INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/mainwindows/mdi/mainwindow.cpp b/examples/mainwindows/mdi/mainwindow.cpp
index 4c6a3e0..1b01977 100644
--- a/examples/mainwindows/mdi/mainwindow.cpp
+++ b/examples/mainwindows/mdi/mainwindow.cpp
@@ -235,7 +235,7 @@ void MainWindow::createActions()
//! [0]
exitAct = new QAction(tr("E&xit"), this);
- exitAct->setShortcut(tr("Ctrl+Q"));
+ exitAct->setShortcuts(QKeySequence::Quit);
exitAct->setStatusTip(tr("Exit the application"));
connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
//! [0]
@@ -259,7 +259,6 @@ void MainWindow::createActions()
connect(pasteAct, SIGNAL(triggered()), this, SLOT(paste()));
closeAct = new QAction(tr("Cl&ose"), this);
- closeAct->setShortcut(tr("Ctrl+F4"));
closeAct->setStatusTip(tr("Close the active window"));
connect(closeAct, SIGNAL(triggered()),
mdiArea, SLOT(closeActiveSubWindow()));
diff --git a/examples/mainwindows/mdi/mdi.pro b/examples/mainwindows/mdi/mdi.pro
index 4601f1c..8d859b0 100644
--- a/examples/mainwindows/mdi/mdi.pro
+++ b/examples/mainwindows/mdi/mdi.pro
@@ -10,3 +10,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/mainwindows/mdi
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS mdi.pro images
sources.path = $$[QT_INSTALL_EXAMPLES]/mainwindows/mdi
INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/mainwindows/menus/mainwindow.cpp b/examples/mainwindows/menus/mainwindow.cpp
index 66246c9..eb4d758 100644
--- a/examples/mainwindows/menus/mainwindow.cpp
+++ b/examples/mainwindows/menus/mainwindow.cpp
@@ -219,7 +219,7 @@ void MainWindow::createActions()
connect(printAct, SIGNAL(triggered()), this, SLOT(print()));
exitAct = new QAction(tr("E&xit"), this);
- exitAct->setShortcut(tr("Ctrl+Q"));
+ exitAct->setShortcuts(QKeySequence::Quit);
exitAct->setStatusTip(tr("Exit the application"));
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
@@ -240,7 +240,7 @@ void MainWindow::createActions()
connect(cutAct, SIGNAL(triggered()), this, SLOT(cut()));
copyAct = new QAction(tr("&Copy"), this);
- copyAct->setShortcut(tr("Ctrl+C"));
+ copyAct->setShortcuts(QKeySequence::Copy);
copyAct->setStatusTip(tr("Copy the current selection's contents to the "
"clipboard"));
connect(copyAct, SIGNAL(triggered()), this, SLOT(copy()));
@@ -253,7 +253,7 @@ void MainWindow::createActions()
boldAct = new QAction(tr("&Bold"), this);
boldAct->setCheckable(true);
- boldAct->setShortcut(tr("Ctrl+B"));
+ boldAct->setShortcut(QKeySequence::Bold);
boldAct->setStatusTip(tr("Make the text bold"));
connect(boldAct, SIGNAL(triggered()), this, SLOT(bold()));
@@ -263,7 +263,7 @@ void MainWindow::createActions()
italicAct = new QAction(tr("&Italic"), this);
italicAct->setCheckable(true);
- italicAct->setShortcut(tr("Ctrl+I"));
+ italicAct->setShortcut(QKeySequence::Italic);
italicAct->setStatusTip(tr("Make the text italic"));
connect(italicAct, SIGNAL(triggered()), this, SLOT(italic()));
diff --git a/examples/mainwindows/menus/menus.pro b/examples/mainwindows/menus/menus.pro
index 7b0a2ec..5ac5b34 100644
--- a/examples/mainwindows/menus/menus.pro
+++ b/examples/mainwindows/menus/menus.pro
@@ -7,3 +7,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/mainwindows/menus
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS menus.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/mainwindows/menus
INSTALLS += target sources
+
+symbian {
+ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+ TARGET.UID3 = 0xA000CF66
+}
diff --git a/examples/mainwindows/recentfiles/main.cpp b/examples/mainwindows/recentfiles/main.cpp
index 00a5608..5caf734 100644
--- a/examples/mainwindows/recentfiles/main.cpp
+++ b/examples/mainwindows/recentfiles/main.cpp
@@ -46,6 +46,8 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
+ app.setOrganizationName("Trolltech");
+ app.setApplicationName("Recent Files Example");
MainWindow *mainWin = new MainWindow;
mainWin->show();
return app.exec();
diff --git a/examples/mainwindows/recentfiles/mainwindow.cpp b/examples/mainwindows/recentfiles/mainwindow.cpp
index 527ab31..d5c2a8c 100644
--- a/examples/mainwindows/recentfiles/mainwindow.cpp
+++ b/examples/mainwindows/recentfiles/mainwindow.cpp
@@ -54,7 +54,7 @@ MainWindow::MainWindow()
createMenus();
(void)statusBar();
- setWindowTitle(tr("Recent Files"));
+ setWindowFilePath(QString());
resize(400, 300);
}
@@ -132,7 +132,7 @@ void MainWindow::createActions()
}
exitAct = new QAction(tr("E&xit"), this);
- exitAct->setShortcut(tr("Ctrl+Q"));
+ exitAct->setShortcuts(QKeySequence::Quit);
exitAct->setStatusTip(tr("Exit the application"));
connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
@@ -209,13 +209,9 @@ void MainWindow::saveFile(const QString &fileName)
void MainWindow::setCurrentFile(const QString &fileName)
{
curFile = fileName;
- if (curFile.isEmpty())
- setWindowTitle(tr("Recent Files"));
- else
- setWindowTitle(tr("%1 - %2").arg(strippedName(curFile))
- .arg(tr("Recent Files")));
+ setWindowFilePath(curFile);
- QSettings settings("Trolltech", "Recent Files Example");
+ QSettings settings;
QStringList files = settings.value("recentFileList").toStringList();
files.removeAll(fileName);
files.prepend(fileName);
@@ -233,7 +229,7 @@ void MainWindow::setCurrentFile(const QString &fileName)
void MainWindow::updateRecentFileActions()
{
- QSettings settings("Trolltech", "Recent Files Example");
+ QSettings settings;
QStringList files = settings.value("recentFileList").toStringList();
int numRecentFiles = qMin(files.size(), (int)MaxRecentFiles);
diff --git a/examples/mainwindows/recentfiles/recentfiles.pro b/examples/mainwindows/recentfiles/recentfiles.pro
index 7c62cdf..9724b77 100644
--- a/examples/mainwindows/recentfiles/recentfiles.pro
+++ b/examples/mainwindows/recentfiles/recentfiles.pro
@@ -7,3 +7,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/mainwindows/recentfiles
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS recentfiles.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/mainwindows/recentfiles
INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/mainwindows/sdi/main.cpp b/examples/mainwindows/sdi/main.cpp
index c73718a..23164c9 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 284048b..0587170 100644
--- a/examples/mainwindows/sdi/mainwindow.cpp
+++ b/examples/mainwindows/sdi/mainwindow.cpp
@@ -180,7 +180,7 @@ void MainWindow::createActions()
connect(closeAct, SIGNAL(triggered()), this, SLOT(close()));
exitAct = new QAction(tr("E&xit"), this);
- exitAct->setShortcut(tr("Ctrl+Q"));
+ exitAct->setShortcuts(QKeySequence::Quit);
exitAct->setStatusTip(tr("Exit the application"));
connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
@@ -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)
diff --git a/examples/mainwindows/sdi/sdi.pro b/examples/mainwindows/sdi/sdi.pro
index 3283334..5707c41 100644
--- a/examples/mainwindows/sdi/sdi.pro
+++ b/examples/mainwindows/sdi/sdi.pro
@@ -8,3 +8,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/mainwindows/sdi
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS sdi.pro images
sources.path = $$[QT_INSTALL_EXAMPLES]/mainwindows/sdi
INSTALLS += target sources
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)