summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-27 15:57:23 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-27 15:58:43 (GMT)
commitf93097671f512f38790ba2d56bd5b1e037810266 (patch)
treea4dd9aa09a8ca658bb9a46da26472ee0c5f317da /examples
parent19d0a365dd99dc1a108e58949f7d0f49bac72623 (diff)
parent583b1529894aca5e9ffa353f0547dfb4b8b0ab21 (diff)
downloadQt-f93097671f512f38790ba2d56bd5b1e037810266.zip
Qt-f93097671f512f38790ba2d56bd5b1e037810266.tar.gz
Qt-f93097671f512f38790ba2d56bd5b1e037810266.tar.bz2
Merge commit oslo-staging-2/4.6 into upstream/4.6
Diffstat (limited to 'examples')
-rw-r--r--examples/widgets/scribble/scribblearea.cpp5
-rw-r--r--examples/widgets/softkeys/softkeys.cpp16
-rw-r--r--examples/widgets/softkeys/softkeys.h2
-rw-r--r--examples/xml/saxbookmarks/mainwindow.cpp7
4 files changed, 17 insertions, 13 deletions
diff --git a/examples/widgets/scribble/scribblearea.cpp b/examples/widgets/scribble/scribblearea.cpp
index 6c9d8aa..2bc2a69 100644
--- a/examples/widgets/scribble/scribblearea.cpp
+++ b/examples/widgets/scribble/scribblearea.cpp
@@ -139,11 +139,12 @@ void ScribbleArea::mouseReleaseEvent(QMouseEvent *event)
}
//! [12] //! [13]
-void ScribbleArea::paintEvent(QPaintEvent * /* event */)
+void ScribbleArea::paintEvent(QPaintEvent *event)
//! [13] //! [14]
{
QPainter painter(this);
- painter.drawImage(QPoint(0, 0), image);
+ QRect dirtyRect = event->rect();
+ painter.drawImage(dirtyRect, image, dirtyRect);
}
//! [14]
diff --git a/examples/widgets/softkeys/softkeys.cpp b/examples/widgets/softkeys/softkeys.cpp
index 69b4941..d1586a5 100644
--- a/examples/widgets/softkeys/softkeys.cpp
+++ b/examples/widgets/softkeys/softkeys.cpp
@@ -66,11 +66,11 @@ MainWindow::MainWindow(QWidget *parent)
infoLabel = new QLabel(tr(""), this);
infoLabel->setContextMenuPolicy(Qt::NoContextMenu);
- toggleButton = new QPushButton(tr("Custom softkeys"), this);
+ toggleButton = new QPushButton(tr("Custom"), this);
toggleButton->setContextMenuPolicy(Qt::NoContextMenu);
toggleButton->setCheckable(true);
- pushButton = new QPushButton(tr("Open File Dialog"), this);
+ pushButton = new QPushButton(tr("File Dialog"), this);
pushButton->setContextMenuPolicy(Qt::NoContextMenu);
QComboBox* comboBox = new QComboBox(this);
@@ -81,12 +81,12 @@ MainWindow::MainWindow(QWidget *parent)
<< QApplication::translate("MainWindow", "Selection3", 0, QApplication::UnicodeUTF8)
);
- layout = new QVBoxLayout;
- layout->addWidget(textEditor);
- layout->addWidget(infoLabel);
- layout->addWidget(toggleButton);
- layout->addWidget(pushButton);
- layout->addWidget(comboBox);
+ layout = new QGridLayout;
+ layout->addWidget(textEditor, 0, 0, 1, 2);
+ layout->addWidget(infoLabel, 1, 0, 1, 2);
+ layout->addWidget(toggleButton, 2, 0);
+ layout->addWidget(pushButton, 2, 1);
+ layout->addWidget(comboBox, 3, 0, 1, 2);
central->setLayout(layout);
fileMenu = menuBar()->addMenu(tr("&File"));
diff --git a/examples/widgets/softkeys/softkeys.h b/examples/widgets/softkeys/softkeys.h
index 178ae64..1372fa4 100644
--- a/examples/widgets/softkeys/softkeys.h
+++ b/examples/widgets/softkeys/softkeys.h
@@ -61,7 +61,7 @@ public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private:
- QVBoxLayout *layout;
+ QGridLayout *layout;
QWidget *central;
QTextEdit* textEditor;
QLabel *infoLabel;
diff --git a/examples/xml/saxbookmarks/mainwindow.cpp b/examples/xml/saxbookmarks/mainwindow.cpp
index 49cb468..ff3cf11 100644
--- a/examples/xml/saxbookmarks/mainwindow.cpp
+++ b/examples/xml/saxbookmarks/mainwindow.cpp
@@ -67,8 +67,11 @@ MainWindow::MainWindow()
void MainWindow::open()
{
#if defined(Q_OS_SYMBIAN)
- // Always look for bookmarks on the same drive where the application is installed to.
- QString bookmarksFolder = QCoreApplication::applicationFilePath().left(1);
+ // Look for bookmarks on the same drive where the application is installed to,
+ // if drive is not read only. QDesktopServices::DataLocation does this check,
+ // and returns writable drive.
+ QString bookmarksFolder =
+ QDesktopServices::storageLocation(QDesktopServices::DataLocation).left(1);
bookmarksFolder.append(":/Data/qt/saxbookmarks");
QDir::setCurrent(bookmarksFolder);
#endif