summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/dbus/complexpingpong/complexping.cpp17
-rw-r--r--examples/dbus/complexpingpong/complexpong.cpp15
-rw-r--r--examples/dbus/listnames/listnames.cpp11
-rw-r--r--examples/dbus/pingpong/ping.cpp10
-rw-r--r--examples/dbus/pingpong/pong.cpp15
-rw-r--r--examples/dbus/remotecontrolledcar/controller/controller.pro3
-rw-r--r--examples/dbus/remotecontrolledcar/controller/main.cpp2
-rw-r--r--examples/embedded/flickable/flickable.cpp2
-rw-r--r--examples/examples.pro4
-rw-r--r--examples/network/CMakeLists.txt2
-rw-r--r--examples/network/secureudpclient/association.cpp5
-rw-r--r--examples/network/torrent/.prev_CMakeLists.txt73
-rw-r--r--examples/network/torrent/CMakeLists.txt3
-rw-r--r--examples/network/torrent/addtorrentform.ui (renamed from examples/network/torrent/forms/addtorrentform.ui)0
-rw-r--r--examples/network/torrent/mainwindow.cpp2
-rw-r--r--examples/network/torrent/torrent.pro2
-rw-r--r--examples/network/torrent/torrentclient.cpp4
-rw-r--r--examples/qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc16
-rw-r--r--examples/qtconcurrent/imagescaling/imagescaling.cpp14
-rw-r--r--examples/qtestlib/tutorial1/testqstring.cpp2
-rw-r--r--examples/qtestlib/tutorial2/testqstring.cpp2
-rw-r--r--examples/qtestlib/tutorial3/testgui.cpp2
-rw-r--r--examples/qtestlib/tutorial4/testgui.cpp2
-rw-r--r--examples/widgets/doc/dropsite.qdoc5
-rw-r--r--examples/widgets/doc/src/application.qdoc6
-rw-r--r--examples/widgets/doc/src/diagramscene.qdoc2
-rw-r--r--examples/widgets/doc/src/tablet.qdoc6
-rw-r--r--examples/widgets/itemviews/dirview/main.cpp2
-rw-r--r--examples/widgets/tools/undoframework/images/cross.pngbin114 -> 356 bytes
-rw-r--r--examples/widgets/widgets/imageviewer/imageviewer.cpp14
-rw-r--r--examples/widgets/widgets/imageviewer/main.cpp2
31 files changed, 101 insertions, 144 deletions
diff --git a/examples/dbus/complexpingpong/complexping.cpp b/examples/dbus/complexpingpong/complexping.cpp
index cf2535930d..8878083ee9 100644
--- a/examples/dbus/complexpingpong/complexping.cpp
+++ b/examples/dbus/complexpingpong/complexping.cpp
@@ -48,17 +48,18 @@
**
****************************************************************************/
-#include <stdio.h>
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QFile>
-#include <QtCore/QDebug>
-#include <QtCore/QProcess>
-#include <QtDBus/QtDBus>
-
#include "ping-common.h"
#include "complexping.h"
+#include <QCoreApplication>
+#include <QDBusReply>
+#include <QDBusServiceWatcher>
+#include <QFile>
+#include <QDebug>
+#include <QProcess>
+
+#include <stdio.h>
+
void Ping::start(const QString &name)
{
if (name != SERVICE_NAME)
diff --git a/examples/dbus/complexpingpong/complexpong.cpp b/examples/dbus/complexpingpong/complexpong.cpp
index c9cc78b376..6b3430bc94 100644
--- a/examples/dbus/complexpingpong/complexpong.cpp
+++ b/examples/dbus/complexpingpong/complexpong.cpp
@@ -48,16 +48,17 @@
**
****************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QTimer>
-#include <QtDBus/QtDBus>
-
#include "ping-common.h"
#include "complexpong.h"
+#include <QCoreApplication>
+#include <QDBusConnection>
+#include <QDBusError>
+#include <QTimer>
+
+#include <stdio.h>
+#include <stdlib.h>
+
// the property
QString Pong::value() const
{
diff --git a/examples/dbus/listnames/listnames.cpp b/examples/dbus/listnames/listnames.cpp
index 50203da73d..fcd0e060a4 100644
--- a/examples/dbus/listnames/listnames.cpp
+++ b/examples/dbus/listnames/listnames.cpp
@@ -48,10 +48,13 @@
**
****************************************************************************/
-#include <QtCore/QCoreApplication>
-#include <QtCore/QDebug>
-#include <QtCore/QStringList>
-#include <QtDBus/QtDBus>
+#include <QCoreApplication>
+#include <QDBusConnection>
+#include <QDBusConnectionInterface>
+#include <QDBusInterface>
+#include <QDBusReply>
+#include <QDebug>
+#include <QStringList>
void method1()
{
diff --git a/examples/dbus/pingpong/ping.cpp b/examples/dbus/pingpong/ping.cpp
index e013a82eb2..64c1fe6bbf 100644
--- a/examples/dbus/pingpong/ping.cpp
+++ b/examples/dbus/pingpong/ping.cpp
@@ -48,12 +48,14 @@
**
****************************************************************************/
-#include <stdio.h>
+#include "ping-common.h"
-#include <QtCore/QCoreApplication>
-#include <QtDBus/QtDBus>
+#include <QCoreApplication>
+#include <QDBusConnection>
+#include <QDBusInterface>
+#include <QDBusReply>
-#include "ping-common.h"
+#include <stdio.h>
int main(int argc, char **argv)
{
diff --git a/examples/dbus/pingpong/pong.cpp b/examples/dbus/pingpong/pong.cpp
index e1e362f218..37f6261142 100644
--- a/examples/dbus/pingpong/pong.cpp
+++ b/examples/dbus/pingpong/pong.cpp
@@ -48,16 +48,17 @@
**
****************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <QtCore/QCoreApplication>
-#include <QtCore/QTimer>
-#include <QtDBus/QtDBus>
-
#include "ping-common.h"
#include "pong.h"
+#include <QCoreApplication>
+#include <QDBusConnection>
+#include <QDBusError>
+#include <QTimer>
+
+#include <stdio.h>
+#include <stdlib.h>
+
QString Pong::ping(const QString &arg)
{
QMetaObject::invokeMethod(QCoreApplication::instance(), "quit");
diff --git a/examples/dbus/remotecontrolledcar/controller/controller.pro b/examples/dbus/remotecontrolledcar/controller/controller.pro
index cc3b92f1a4..07767141f4 100644
--- a/examples/dbus/remotecontrolledcar/controller/controller.pro
+++ b/examples/dbus/remotecontrolledcar/controller/controller.pro
@@ -5,6 +5,9 @@ FORMS += controller.ui
HEADERS += controller.h
SOURCES += main.cpp controller.cpp
+# Work-around CI issue. Not needed in user code.
+CONFIG += no_batch
+
# install
target.path = $$[QT_INSTALL_EXAMPLES]/dbus/remotecontrolledcar/controller
INSTALLS += target
diff --git a/examples/dbus/remotecontrolledcar/controller/main.cpp b/examples/dbus/remotecontrolledcar/controller/main.cpp
index 88edd13c1b..4aeff8635e 100644
--- a/examples/dbus/remotecontrolledcar/controller/main.cpp
+++ b/examples/dbus/remotecontrolledcar/controller/main.cpp
@@ -49,7 +49,7 @@
****************************************************************************/
#include <QtWidgets>
-#include <QtDBus>
+
#include "controller.h"
diff --git a/examples/embedded/flickable/flickable.cpp b/examples/embedded/flickable/flickable.cpp
index 15c1873e53..8cf7a28cde 100644
--- a/examples/embedded/flickable/flickable.cpp
+++ b/examples/embedded/flickable/flickable.cpp
@@ -196,7 +196,7 @@ void Flickable::handleMouseRelease(QMouseEvent *event)
QMouseEvent *event1 = new QMouseEvent(QEvent::MouseButtonPress,
d->pressPos, Qt::LeftButton,
Qt::LeftButton, Qt::NoModifier);
- QMouseEvent *event2 = new QMouseEvent(*event);
+ QMouseEvent *event2 = event->clone();
d->ignoreList << event1;
d->ignoreList << event2;
QApplication::postEvent(d->target, event1);
diff --git a/examples/examples.pro b/examples/examples.pro
index 077e5828a9..fe6c6dc7d4 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -6,7 +6,9 @@ SUBDIRS = \
embedded \
qpa
-qtHaveModule(dbus): SUBDIRS += dbus
+!contains(TEMPLATE, "vc.*") { # QTBUG-91033
+ qtHaveModule(dbus): SUBDIRS += dbus
+}
qtHaveModule(network): SUBDIRS += network
qtHaveModule(testlib): SUBDIRS += qtestlib
qtHaveModule(concurrent): SUBDIRS += qtconcurrent
diff --git a/examples/network/CMakeLists.txt b/examples/network/CMakeLists.txt
index b6ae618d1d..c28c951b69 100644
--- a/examples/network/CMakeLists.txt
+++ b/examples/network/CMakeLists.txt
@@ -16,7 +16,7 @@ if(TARGET Qt::Widgets)
add_subdirectory(loopback)
add_subdirectory(threadedfortuneserver)
add_subdirectory(googlesuggest)
- # add_subdirectory(torrent) FIXME: This does not find its ui file:-/ # special case
+ add_subdirectory(torrent)
add_subdirectory(multicastreceiver)
add_subdirectory(multicastsender)
add_subdirectory(fortuneclient)
diff --git a/examples/network/secureudpclient/association.cpp b/examples/network/secureudpclient/association.cpp
index c950260078..59df94d5b9 100644
--- a/examples/network/secureudpclient/association.cpp
+++ b/examples/network/secureudpclient/association.cpp
@@ -112,6 +112,11 @@ void DtlsAssociation::udpSocketConnected()
void DtlsAssociation::readyRead()
{
+ if (socket.pendingDatagramSize() <= 0) {
+ emit warningMessage(tr("%1: spurious read notification?").arg(name));
+ return;
+ }
+
//! [6]
QByteArray dgram(socket.pendingDatagramSize(), Qt::Uninitialized);
const qint64 bytesRead = socket.readDatagram(dgram.data(), dgram.size());
diff --git a/examples/network/torrent/.prev_CMakeLists.txt b/examples/network/torrent/.prev_CMakeLists.txt
deleted file mode 100644
index bc3bf6a465..0000000000
--- a/examples/network/torrent/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,73 +0,0 @@
-# Generated from torrent.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(torrent LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/torrent")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(torrent
- addtorrentdialog.cpp addtorrentdialog.h
- bencodeparser.cpp bencodeparser.h
- connectionmanager.cpp connectionmanager.h
- filemanager.cpp filemanager.h
- forms/addtorrentform.ui
- main.cpp
- mainwindow.cpp mainwindow.h
- metainfo.cpp metainfo.h
- peerwireclient.cpp peerwireclient.h
- ratecontroller.cpp ratecontroller.h
- torrentclient.cpp torrentclient.h
- torrentserver.cpp torrentserver.h
- trackerclient.cpp trackerclient.h
-)
-set_target_properties(torrent PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(torrent PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
-)
-
-
-# Resources:
-set(icons_resource_files
- "icons/1downarrow.png"
- "icons/1uparrow.png"
- "icons/bottom.png"
- "icons/exit.png"
- "icons/peertopeer.png"
- "icons/player_pause.png"
- "icons/player_play.png"
- "icons/player_stop.png"
-)
-
-qt6_add_resources(torrent "icons"
- PREFIX
- "/"
- FILES
- ${icons_resource_files}
-)
-
-install(TARGETS torrent
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/network/torrent/CMakeLists.txt b/examples/network/torrent/CMakeLists.txt
index 7eea3d02bc..0d1f6735e3 100644
--- a/examples/network/torrent/CMakeLists.txt
+++ b/examples/network/torrent/CMakeLists.txt
@@ -22,10 +22,10 @@ find_package(Qt6 COMPONENTS Widgets)
qt_add_executable(torrent
addtorrentdialog.cpp addtorrentdialog.h
+ addtorrentform.ui
bencodeparser.cpp bencodeparser.h
connectionmanager.cpp connectionmanager.h
filemanager.cpp filemanager.h
- forms/addtorrentform.ui
main.cpp
mainwindow.cpp mainwindow.h
metainfo.cpp metainfo.h
@@ -39,7 +39,6 @@ set_target_properties(torrent PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_include_directories(torrent PUBLIC forms) # special case
target_link_libraries(torrent PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/torrent/forms/addtorrentform.ui b/examples/network/torrent/addtorrentform.ui
index 950bb67119..950bb67119 100644
--- a/examples/network/torrent/forms/addtorrentform.ui
+++ b/examples/network/torrent/addtorrentform.ui
diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp
index 129ded3fa4..10a54e7962 100644
--- a/examples/network/torrent/mainwindow.cpp
+++ b/examples/network/torrent/mainwindow.cpp
@@ -93,7 +93,7 @@ public:
progressBarOption.state = QStyle::State_Enabled;
progressBarOption.direction = QApplication::layoutDirection();
progressBarOption.rect = option.rect;
- progressBarOption.fontMetrics = QApplication::fontMetrics();
+ progressBarOption.fontMetrics = QFontMetrics(QApplication::font());
progressBarOption.minimum = 0;
progressBarOption.maximum = 100;
progressBarOption.textAlignment = Qt::AlignCenter;
diff --git a/examples/network/torrent/torrent.pro b/examples/network/torrent/torrent.pro
index c640c3b5d0..929c5cb784 100644
--- a/examples/network/torrent/torrent.pro
+++ b/examples/network/torrent/torrent.pro
@@ -27,7 +27,7 @@ SOURCES += main.cpp \
trackerclient.cpp
# Forms and resources
-FORMS += forms/addtorrentform.ui
+FORMS += addtorrentform.ui
RESOURCES += icons.qrc
# install
diff --git a/examples/network/torrent/torrentclient.cpp b/examples/network/torrent/torrentclient.cpp
index 6ae5339d28..a63e927e09 100644
--- a/examples/network/torrent/torrentclient.cpp
+++ b/examples/network/torrent/torrentclient.cpp
@@ -1501,9 +1501,7 @@ void TorrentClient::addToPeerList(const QList<TorrentPeer> &peerList)
};
// Remove inactive peers from the peer list until we're below
// the max connections count.
- d->peers.erase(std::remove_if(d->peers.begin(), d->peers.end(),
- firstNInactivePeers),
- d->peers.end());
+ d->peers.removeIf(firstNInactivePeers);
// If we still have too many peers, remove the oldest ones.
d->peers.erase(d->peers.begin(), d->peers.begin() + tooMany);
}
diff --git a/examples/qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc b/examples/qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc
index a919b7e2ed..8814c826ed 100644
--- a/examples/qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc
+++ b/examples/qtconcurrent/imagescaling/doc/src/qtconcurrent-imagescaling.qdoc
@@ -128,23 +128,29 @@
Since the scaling may be computationally heavy, and we don't want to block the main
thread, we pass the \c QtFuture::Launch::Async option, to launch the scaling step in
- a new thread.
+ a new thread. The \c scaled() method returns a list of the scaled images to the next
+ step, which takes care of showing images in the layout.
- The \c scaled() method returns a list of the scaled images to the next step, which
- takes care of showing images in the layout:
+ Note that \c updateStatus() is called through QMetaObject::invokeMethod(),
+ because it updates the UI and needs to be invoked from the main thread.
\dots
\snippet imagescaling/imagescaling.cpp 5
\dots
- Note that showImages() needs to be invoked from the main thread, so we call it through
- QMetaObject::invokeMethod().
+ For the same reason \c showImages() also needs to be invoked from the main thread, so
+ we pass \c this as a context to \c .then(). By default, \c .then() is launched in the
+ parent's thread, but if a context object is specified, it is launched in the context
+ object's thread.
Then we add cancellation and failure handlers:
\dots
\snippet imagescaling/imagescaling.cpp 6
+ We don't need to specify the context anymore, because \c .onCanceled() and the next
+ handlers will be launched in their parent's context.
+
The handler attached via the \c .onCanceled() method will be called if the user has
pressed the \e "Cancel" button:
diff --git a/examples/qtconcurrent/imagescaling/imagescaling.cpp b/examples/qtconcurrent/imagescaling/imagescaling.cpp
index 59664f8a58..66bb0686c3 100644
--- a/examples/qtconcurrent/imagescaling/imagescaling.cpp
+++ b/examples/qtconcurrent/imagescaling/imagescaling.cpp
@@ -118,24 +118,24 @@ void Images::process()
downloadFuture.then([this](auto) { cancelButton->setEnabled(false); })
.then(QtFuture::Launch::Async,
[this] {
- updateStatus(tr("Scaling..."));
+ QMetaObject::invokeMethod(this,
+ [this] { updateStatus(tr("Scaling...")); });
return scaled();
})
//! [4]
//! [5]
- .then([this](const QList<QImage> &scaled) {
- QMetaObject::invokeMethod(this, [this, scaled] { showImages(scaled); });
+ .then(this, [this](const QList<QImage> &scaled) {
+ showImages(scaled);
updateStatus(tr("Finished"));
})
//! [5]
//! [6]
.onCanceled([this] { updateStatus(tr("Download has been canceled.")); })
.onFailed([this](QNetworkReply::NetworkError error) {
- const auto msg = QString("Download finished with error: %1").arg(error);
- updateStatus(tr(msg.toStdString().c_str()));
+ updateStatus(tr("Download finished with error: %1").arg(error));
// Abort all pending requests
- QMetaObject::invokeMethod(this, &Images::abortDownload);
+ abortDownload();
})
.onFailed([this](const std::exception& ex) {
updateStatus(tr(ex.what()));
@@ -256,7 +256,7 @@ void Images::initLayout(qsizetype count)
void Images::updateStatus(const QString &msg)
{
- QMetaObject::invokeMethod(this, [this, msg] { statusBar->showMessage(msg); });
+ statusBar->showMessage(msg);
}
void Images::abortDownload()
diff --git a/examples/qtestlib/tutorial1/testqstring.cpp b/examples/qtestlib/tutorial1/testqstring.cpp
index a8bf6cfcdf..419d278e2e 100644
--- a/examples/qtestlib/tutorial1/testqstring.cpp
+++ b/examples/qtestlib/tutorial1/testqstring.cpp
@@ -49,7 +49,7 @@
****************************************************************************/
//! [0]
-#include <QtTest/QtTest>
+#include <QTest>
class TestQString: public QObject
{
diff --git a/examples/qtestlib/tutorial2/testqstring.cpp b/examples/qtestlib/tutorial2/testqstring.cpp
index 6fd1254fad..1161cd8a2b 100644
--- a/examples/qtestlib/tutorial2/testqstring.cpp
+++ b/examples/qtestlib/tutorial2/testqstring.cpp
@@ -48,7 +48,7 @@
**
****************************************************************************/
-#include <QtTest/QtTest>
+#include <QTest>
//! [0]
class TestQString: public QObject
diff --git a/examples/qtestlib/tutorial3/testgui.cpp b/examples/qtestlib/tutorial3/testgui.cpp
index 43faad77ab..44ae554862 100644
--- a/examples/qtestlib/tutorial3/testgui.cpp
+++ b/examples/qtestlib/tutorial3/testgui.cpp
@@ -50,7 +50,7 @@
//! [0]
#include <QtWidgets>
-#include <QtTest/QtTest>
+#include <QTest>
class TestGui: public QObject
{
diff --git a/examples/qtestlib/tutorial4/testgui.cpp b/examples/qtestlib/tutorial4/testgui.cpp
index 9b6f34d4fe..dedba45d0a 100644
--- a/examples/qtestlib/tutorial4/testgui.cpp
+++ b/examples/qtestlib/tutorial4/testgui.cpp
@@ -49,7 +49,7 @@
****************************************************************************/
#include <QtWidgets>
-#include <QtTest/QtTest>
+#include <QTest>
//! [0]
class TestGui: public QObject
diff --git a/examples/widgets/doc/dropsite.qdoc b/examples/widgets/doc/dropsite.qdoc
index d8d09612f6..720d001525 100644
--- a/examples/widgets/doc/dropsite.qdoc
+++ b/examples/widgets/doc/dropsite.qdoc
@@ -103,7 +103,7 @@
\snippet draganddrop/dropsite/droparea.cpp dropEvent() function part1
The \c mimeData object can contain one of the following objects: an image,
- HTML text, plain text, or a list of URLs.
+ HTML text, Markdown text, plain text, or a list of URLs.
\snippet draganddrop/dropsite/droparea.cpp dropEvent() function part2
@@ -113,6 +113,9 @@
\li If \c mimeData contains HTML, we display it with
\l{QLabel::setText()}{setText()} and set \c{DropArea}'s text format
as Qt::RichText.
+ \li If \c mimeData contains Markdown, we display it with
+ \l{QLabel::setText()}{setText()} and set \c{DropArea}'s text format
+ as Qt::MarkdownText.
\li If \c mimeData contains plain text, we display it with
\l{QLabel::setText()}{setText()} and set \c{DropArea}'s text format
as Qt::PlainText. In the event that \c mimeData contains URLs, we
diff --git a/examples/widgets/doc/src/application.qdoc b/examples/widgets/doc/src/application.qdoc
index ef8bc2ef64..334c8cb9f0 100644
--- a/examples/widgets/doc/src/application.qdoc
+++ b/examples/widgets/doc/src/application.qdoc
@@ -27,11 +27,11 @@
/*!
\example mainwindows/application
- \title Application Example
+ \title Qt Widgets - Application Example
\ingroup examples-mainwindow
- \brief The Application example shows how to implement a standard GUI
- application with menus, toolbars, and a status bar. The example
+ \brief The Application example shows how to implement a standard
+ widget application with menus, toolbars, and a status bar. The example
itself is a simple text editor program built around QPlainTextEdit.
\image application.png Screenshot of the Application example
diff --git a/examples/widgets/doc/src/diagramscene.qdoc b/examples/widgets/doc/src/diagramscene.qdoc
index 1a94d53162..6a38ebd2c5 100644
--- a/examples/widgets/doc/src/diagramscene.qdoc
+++ b/examples/widgets/doc/src/diagramscene.qdoc
@@ -145,7 +145,7 @@
We show an example of the creation of an action. The
functionality the actions trigger is discussed in the slots we
- connect the actions to. You can see the \l{Application
+ connect the actions to. You can see the \l{Qt Widgets - Application
Example}{application example} if you need a high-level
introduction to actions.
diff --git a/examples/widgets/doc/src/tablet.qdoc b/examples/widgets/doc/src/tablet.qdoc
index 2b11020c07..a10846fed4 100644
--- a/examples/widgets/doc/src/tablet.qdoc
+++ b/examples/widgets/doc/src/tablet.qdoc
@@ -112,8 +112,8 @@
in a submenu of the \b Tablet menu, for selecting which property of each
QTabletEvent will be used to vary the translucency (alpha channel) of the
line being drawn or color being airbrushed.
- (See the \l{Application Example}{application example} if you want a
- high-level introduction to QActions.)
+ (See the \l{Qt Widgets - Application Example}{application example} if you want
+ a high-level introduction to QActions.)
\snippet widgets/tablet/mainwindow.cpp 9
@@ -251,7 +251,7 @@
rendering to, we can create a pixmap with the appropriate resolution.
The size of the pixmap with which we fill the window depends on the screen
resolution, as the example does not support zoom; and it may be that one
- screen is \l {High DPI Displays}{high DPI} while another is not. We need to
+ screen is \l {High DPI}{high DPI} while another is not. We need to
draw the background too, as the default is gray.
After that, we simply draw the pixmap to the top left of the widget.
diff --git a/examples/widgets/itemviews/dirview/main.cpp b/examples/widgets/itemviews/dirview/main.cpp
index 20e5d45c95..a7d174a4f4 100644
--- a/examples/widgets/itemviews/dirview/main.cpp
+++ b/examples/widgets/itemviews/dirview/main.cpp
@@ -76,6 +76,8 @@ int main(int argc, char *argv[])
? QString() : parser.positionalArguments().first();
QFileSystemModel model;
+ QFileIconProvider iconProvider;
+ model.setIconProvider(&iconProvider);
model.setRootPath("");
if (parser.isSet(dontUseCustomDirectoryIconsOption))
model.setOption(QFileSystemModel::DontUseCustomDirectoryIcons);
diff --git a/examples/widgets/tools/undoframework/images/cross.png b/examples/widgets/tools/undoframework/images/cross.png
index 09e5e8c2ad..3570a242ae 100644
--- a/examples/widgets/tools/undoframework/images/cross.png
+++ b/examples/widgets/tools/undoframework/images/cross.png
Binary files differ
diff --git a/examples/widgets/widgets/imageviewer/imageviewer.cpp b/examples/widgets/widgets/imageviewer/imageviewer.cpp
index 7de0c7c45b..0e333b693f 100644
--- a/examples/widgets/widgets/imageviewer/imageviewer.cpp
+++ b/examples/widgets/widgets/imageviewer/imageviewer.cpp
@@ -115,8 +115,11 @@ bool ImageViewer::loadFile(const QString &fileName)
setWindowFilePath(fileName);
- const QString message = tr("Opened \"%1\", %2x%3, Depth: %4")
- .arg(QDir::toNativeSeparators(fileName)).arg(image.width()).arg(image.height()).arg(image.depth());
+ const QString description = image.colorSpace().isValid()
+ ? image.colorSpace().description() : tr("unknown");
+ const QString message = tr("Opened \"%1\", %2x%3, Depth: %4 (%5)")
+ .arg(QDir::toNativeSeparators(fileName)).arg(image.width()).arg(image.height())
+ .arg(image.depth()).arg(description);
statusBar()->showMessage(message);
return true;
}
@@ -176,6 +179,7 @@ static void initializeImageFileDialog(QFileDialog &dialog, QFileDialog::AcceptMo
mimeTypeFilters.sort();
dialog.setMimeTypeFilters(mimeTypeFilters);
dialog.selectMimeTypeFilter("image/jpeg");
+ dialog.setAcceptMode(acceptMode);
if (acceptMode == QFileDialog::AcceptSave)
dialog.setDefaultSuffix("jpg");
}
@@ -185,7 +189,7 @@ void ImageViewer::open()
QFileDialog dialog(this, tr("Open File"));
initializeImageFileDialog(dialog, QFileDialog::AcceptOpen);
- while (dialog.exec() == QDialog::Accepted && !loadFile(dialog.selectedFiles().first())) {}
+ while (dialog.exec() == QDialog::Accepted && !loadFile(dialog.selectedFiles().constFirst())) {}
}
//! [1]
@@ -194,7 +198,7 @@ void ImageViewer::saveAs()
QFileDialog dialog(this, tr("Save File As"));
initializeImageFileDialog(dialog, QFileDialog::AcceptSave);
- while (dialog.exec() == QDialog::Accepted && !saveFile(dialog.selectedFiles().first())) {}
+ while (dialog.exec() == QDialog::Accepted && !saveFile(dialog.selectedFiles().constFirst())) {}
}
//! [5]
@@ -365,7 +369,7 @@ void ImageViewer::createActions()
QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
helpMenu->addAction(tr("&About"), this, &ImageViewer::about);
- helpMenu->addAction(tr("About &Qt"), &QApplication::aboutQt);
+ helpMenu->addAction(tr("About &Qt"), this, &QApplication::aboutQt);
}
//! [18]
diff --git a/examples/widgets/widgets/imageviewer/main.cpp b/examples/widgets/widgets/imageviewer/main.cpp
index 035c769693..fbfaecde45 100644
--- a/examples/widgets/widgets/imageviewer/main.cpp
+++ b/examples/widgets/widgets/imageviewer/main.cpp
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
commandLineParser.process(QCoreApplication::arguments());
ImageViewer imageViewer;
if (!commandLineParser.positionalArguments().isEmpty()
- && !imageViewer.loadFile(commandLineParser.positionalArguments().front())) {
+ && !imageViewer.loadFile(commandLineParser.positionalArguments().constFirst())) {
return -1;
}
imageViewer.show();