summaryrefslogtreecommitdiffstats
path: root/examples/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'examples/corelib')
-rw-r--r--examples/corelib/mimetypes/mimetypebrowser/main.cpp4
-rw-r--r--examples/corelib/serialization/convert/cborconverter.cpp2
-rw-r--r--examples/corelib/serialization/convert/textconverter.cpp6
-rw-r--r--examples/corelib/threads/doc/src/mandelbrot.qdoc4
-rw-r--r--examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp2
-rw-r--r--examples/corelib/tools/customtype/message.cpp15
-rw-r--r--examples/corelib/tools/customtype/message.h7
-rw-r--r--examples/corelib/tools/customtypesending/message.cpp13
-rw-r--r--examples/corelib/tools/customtypesending/message.h7
-rw-r--r--examples/corelib/tools/doc/src/customtype.qdoc12
10 files changed, 19 insertions, 53 deletions
diff --git a/examples/corelib/mimetypes/mimetypebrowser/main.cpp b/examples/corelib/mimetypes/mimetypebrowser/main.cpp
index cf87004a01..679d97dc7b 100644
--- a/examples/corelib/mimetypes/mimetypebrowser/main.cpp
+++ b/examples/corelib/mimetypes/mimetypebrowser/main.cpp
@@ -51,7 +51,7 @@
#include "mainwindow.h"
#include <QApplication>
-#include <QDesktopWidget>
+#include <QScreen>
#include <QCommandLineParser>
#include <QCommandLineOption>
@@ -68,7 +68,7 @@ int main(int argc, char *argv[])
parser.process(app);
MainWindow mainWindow;
- const QRect availableGeometry = QApplication::desktop()->availableGeometry(&mainWindow);
+ const QRect availableGeometry = mainWindow.screen()->availableGeometry();
mainWindow.resize(availableGeometry.width() / 3, availableGeometry.height() / 2);
mainWindow.show();
diff --git a/examples/corelib/serialization/convert/cborconverter.cpp b/examples/corelib/serialization/convert/cborconverter.cpp
index ad69983eb1..f907bb0af6 100644
--- a/examples/corelib/serialization/convert/cborconverter.cpp
+++ b/examples/corelib/serialization/convert/cborconverter.cpp
@@ -226,7 +226,7 @@ void CborDiagnosticDumper::saveFile(QIODevice *f, const QVariant &contents, cons
QTextStream out(f);
out << convertFromVariant(contents, Double).toDiagnosticNotation(opts)
- << endl;
+ << Qt::endl;
}
CborConverter::CborConverter()
diff --git a/examples/corelib/serialization/convert/textconverter.cpp b/examples/corelib/serialization/convert/textconverter.cpp
index e80e69a0b5..7aed08f96c 100644
--- a/examples/corelib/serialization/convert/textconverter.cpp
+++ b/examples/corelib/serialization/convert/textconverter.cpp
@@ -66,7 +66,7 @@ static void dumpVariant(QTextStream &out, const QVariant &v)
case QVariant::String: {
const QStringList list = v.toStringList();
for (const QString &s : list)
- out << s << endl;
+ out << s << Qt::endl;
break;
}
@@ -80,11 +80,11 @@ static void dumpVariant(QTextStream &out, const QVariant &v)
}
case QMetaType::Nullptr:
- out << "(null)" << endl;
+ out << "(null)" << Qt::endl;
break;
default:
- out << v.toString() << endl;
+ out << v.toString() << Qt::endl;
break;
}
}
diff --git a/examples/corelib/threads/doc/src/mandelbrot.qdoc b/examples/corelib/threads/doc/src/mandelbrot.qdoc
index 274874632e..9e3fdc1dfe 100644
--- a/examples/corelib/threads/doc/src/mandelbrot.qdoc
+++ b/examples/corelib/threads/doc/src/mandelbrot.qdoc
@@ -304,8 +304,8 @@
\snippet threads/mandelbrot/mandelbrotwidget.cpp 12
The wheel event handler is reimplemented to make the mouse wheel
- control the zoom level. QWheelEvent::delta() returns the angle of
- the wheel mouse movement, in eights of a degree. For most mice,
+ control the zoom level. QWheelEvent::angleDelta() returns the angle
+ of the wheel mouse movement, in eighths of a degree. For most mice,
one wheel step corresponds to 15 degrees. We find out how many
mouse steps we have and determine the resulting zoom factor.
For example, if we have two wheel steps in the positive direction
diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp
index 71d0abb09f..822791533b 100644
--- a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp
+++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp
@@ -176,7 +176,7 @@ void MandelbrotWidget::keyPressEvent(QKeyEvent *event)
//! [12]
void MandelbrotWidget::wheelEvent(QWheelEvent *event)
{
- int numDegrees = event->delta() / 8;
+ int numDegrees = event->angleDelta().y() / 8;
double numSteps = numDegrees / 15.0f;
zoom(pow(ZoomInFactor, numSteps));
}
diff --git a/examples/corelib/tools/customtype/message.cpp b/examples/corelib/tools/customtype/message.cpp
index cc96aee978..e83697cb74 100644
--- a/examples/corelib/tools/customtype/message.cpp
+++ b/examples/corelib/tools/customtype/message.cpp
@@ -52,21 +52,6 @@
#include <QDebug>
-//! [Message class implementation]
-Message::Message()
-{
-}
-
-Message::Message(const Message &other)
- : m_body(other.m_body), m_headers(other.m_headers)
-{
-}
-
-Message::~Message()
-{
-}
-//! [Message class implementation]
-
Message::Message(const QString &body, const QStringList &headers)
: m_body(body), m_headers(headers)
{
diff --git a/examples/corelib/tools/customtype/message.h b/examples/corelib/tools/customtype/message.h
index c1b8243237..bc30c45425 100644
--- a/examples/corelib/tools/customtype/message.h
+++ b/examples/corelib/tools/customtype/message.h
@@ -58,9 +58,10 @@
class Message
{
public:
- Message();
- Message(const Message &other);
- ~Message();
+ Message() = default;
+ ~Message() = default;
+ Message(const Message &) = default;
+ Message &operator=(const Message &) = default;
Message(const QString &body, const QStringList &headers);
diff --git a/examples/corelib/tools/customtypesending/message.cpp b/examples/corelib/tools/customtypesending/message.cpp
index 9386b93898..76f90e5144 100644
--- a/examples/corelib/tools/customtypesending/message.cpp
+++ b/examples/corelib/tools/customtypesending/message.cpp
@@ -50,19 +50,6 @@
#include "message.h"
-Message::Message()
-{
-}
-
-Message::Message(const Message &other)
- : m_body(other.m_body), m_headers(other.m_headers)
-{
-}
-
-Message::~Message()
-{
-}
-
Message::Message(const QString &body, const QStringList &headers)
: m_body(body), m_headers(headers)
{
diff --git a/examples/corelib/tools/customtypesending/message.h b/examples/corelib/tools/customtypesending/message.h
index a93f111e45..38b5c8205f 100644
--- a/examples/corelib/tools/customtypesending/message.h
+++ b/examples/corelib/tools/customtypesending/message.h
@@ -58,9 +58,10 @@
class Message
{
public:
- Message();
- Message(const Message &other);
- ~Message();
+ Message() = default;
+ ~Message() = default;
+ Message(const Message &) = default;
+ Message &operator=(const Message &) = default;
Message(const QString &body, const QStringList &headers);
diff --git a/examples/corelib/tools/doc/src/customtype.qdoc b/examples/corelib/tools/doc/src/customtype.qdoc
index 91b814808a..fb63bc539c 100644
--- a/examples/corelib/tools/doc/src/customtype.qdoc
+++ b/examples/corelib/tools/doc/src/customtype.qdoc
@@ -81,11 +81,6 @@
\section1 The Message Class Implementation
- The implementation of the default constructor, copy constructor and destructor
- are straightforward for the \c Message class:
-
- \snippet tools/customtype/message.cpp Message class implementation
-
The streaming operator is implemented in the following way:
\snippet tools/customtype/message.cpp custom type streaming operator
@@ -117,8 +112,8 @@
\snippet tools/customtype/main.cpp storing a custom value
- Alternatively, the QVariant::fromValue() and qVariantSetValue() functions
- can be used if you are using a compiler without support for member template
+ Alternatively, the QVariant::fromValue() function can be used if
+ you are using a compiler without support for member template
functions.
The value can be retrieved using the QVariant::value() member template
@@ -126,9 +121,6 @@
\snippet tools/customtype/main.cpp retrieving a custom value
- Alternatively, the qVariantValue() template function can be used if
- you are using a compiler without support for member template functions.
-
\section1 Further Reading
The custom \c Message type can also be used with direct signal-slot