diff options
1490 files changed, 22633 insertions, 14704 deletions
diff --git a/.qmake.conf b/.qmake.conf index 5153f8139f..f3a052109f 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -4,4 +4,4 @@ CONFIG += warning_clean QT_SOURCE_TREE = $$PWD QT_BUILD_TREE = $$shadowed($$PWD) -MODULE_VERSION = 5.10.0 +MODULE_VERSION = 5.11.0 diff --git a/config_help.txt b/config_help.txt index f06584a480..3d2ab79fa0 100644 --- a/config_help.txt +++ b/config_help.txt @@ -201,7 +201,6 @@ Component selection: -dbus-runtime ........ Build Qt D-Bus and dynamically load libdbus-1 [no] -accessibility ....... Enable accessibility support [yes] Note: Disabling accessibility is not recommended. - -qml-debug ........... Enable QML debugging support [yes] Qt comes with bundled copies of some 3rd party libraries. These are used by default if auto-detection of the respective system library fails. @@ -732,10 +732,6 @@ setBootstrapVariable() EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS) \$(QMAKE_CXXFLAGS_CXX11) \$(QMAKE_CXXFLAGS_SPLIT_SECTIONS)" EXTRA_LFLAGS="\$(QMAKE_LFLAGS) \$(QMAKE_LFLAGS_GCSECTIONS)" - if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then - EXTRA_LFLAGS="$EXTRA_LFLAGS -lm" - fi - [ "$CFG_SILENT" = "yes" ] && CC_TRANSFORM='s,^,\@,' || CC_TRANSFORM= setBootstrapVariable QMAKE_CC CC "$CC_TRANSFORM" setBootstrapVariable QMAKE_CXX CXX "$CC_TRANSFORM" diff --git a/configure.json b/configure.json index 26e1572f32..07549e0b7e 100644 --- a/configure.json +++ b/configure.json @@ -102,7 +102,6 @@ "platform": "string", "plugin-manifests": "boolean", "profile": "boolean", - "qml-debug": "boolean", "qreal": "string", "qtlibinfix": { "type": "string", "name": "qt_libinfix" }, "qtnamespace": { "type": "string", "name": "qt_namespace" }, @@ -1235,13 +1234,6 @@ "condition": "libs.libudev", "output": [ "privateFeature" ] }, - "qml-debug": { - "label": "QML debugging", - "output": [ - "privateFeature", - { "type": "publicQtConfig", "negative": true } - ] - }, "compile_examples": { "label": "Compile examples", "output": [ "privateConfig" ] @@ -1454,7 +1446,6 @@ Configure with '-qreal float' to create a build that is binary-compatible with 5 "section": "Support enabled for", "entries": [ "pkg-config", - "qml-debug", "libudev", "system-zlib" ] diff --git a/examples/network/multistreamclient/chatconsumer.h b/examples/network/multistreamclient/chatconsumer.h index 9e12f99359..e10c0d7850 100644 --- a/examples/network/multistreamclient/chatconsumer.h +++ b/examples/network/multistreamclient/chatconsumer.h @@ -64,8 +64,8 @@ class ChatConsumer : public Consumer public: explicit ChatConsumer(QObject *parent = nullptr); - QWidget *widget() Q_DECL_OVERRIDE; - void readDatagram(const QByteArray &ba) Q_DECL_OVERRIDE; + QWidget *widget() override; + void readDatagram(const QByteArray &ba) override; private slots: void returnPressed(); diff --git a/examples/network/multistreamclient/movieconsumer.h b/examples/network/multistreamclient/movieconsumer.h index 74321a8505..3f78bf2060 100644 --- a/examples/network/multistreamclient/movieconsumer.h +++ b/examples/network/multistreamclient/movieconsumer.h @@ -63,9 +63,9 @@ class MovieConsumer : public Consumer public: explicit MovieConsumer(QObject *parent = nullptr); - QWidget *widget() Q_DECL_OVERRIDE; - void readDatagram(const QByteArray &ba) Q_DECL_OVERRIDE; - void serverDisconnected() Q_DECL_OVERRIDE; + QWidget *widget() override; + void readDatagram(const QByteArray &ba) override; + void serverDisconnected() override; private: QLabel *label; diff --git a/examples/network/multistreamclient/timeconsumer.h b/examples/network/multistreamclient/timeconsumer.h index 3faa4a6b1a..84a7796699 100644 --- a/examples/network/multistreamclient/timeconsumer.h +++ b/examples/network/multistreamclient/timeconsumer.h @@ -64,9 +64,9 @@ class TimeConsumer : public Consumer public: explicit TimeConsumer(QObject *parent = nullptr); - QWidget *widget() Q_DECL_OVERRIDE; - void readDatagram(const QByteArray &ba) Q_DECL_OVERRIDE; - void serverDisconnected() Q_DECL_OVERRIDE; + QWidget *widget() override; + void readDatagram(const QByteArray &ba) override; + void serverDisconnected() override; private slots: void timerTick(); diff --git a/examples/network/multistreamserver/chatprovider.h b/examples/network/multistreamserver/chatprovider.h index b6ff61a917..c52fa89240 100644 --- a/examples/network/multistreamserver/chatprovider.h +++ b/examples/network/multistreamserver/chatprovider.h @@ -59,9 +59,9 @@ class ChatProvider : public Provider public: explicit ChatProvider(QObject *parent = nullptr); - void readDatagram(QSctpSocket &from, const QByteArray &ba) Q_DECL_OVERRIDE; - void newConnection(QSctpSocket &client) Q_DECL_OVERRIDE; - void clientDisconnected(QSctpSocket &client) Q_DECL_OVERRIDE; + void readDatagram(QSctpSocket &from, const QByteArray &ba) override; + void newConnection(QSctpSocket &client) override; + void clientDisconnected(QSctpSocket &client) override; }; #endif diff --git a/examples/network/multistreamserver/server.h b/examples/network/multistreamserver/server.h index d9a38e61a4..2380d6ffd6 100644 --- a/examples/network/multistreamserver/server.h +++ b/examples/network/multistreamserver/server.h @@ -72,7 +72,7 @@ public: virtual ~Server(); public slots: - int exec() Q_DECL_OVERRIDE; + int exec() override; private slots: void newConnection(); diff --git a/examples/network/multistreamserver/timeprovider.h b/examples/network/multistreamserver/timeprovider.h index f99cdbc717..a4d08fd67c 100644 --- a/examples/network/multistreamserver/timeprovider.h +++ b/examples/network/multistreamserver/timeprovider.h @@ -59,7 +59,7 @@ class TimeProvider : public Provider public: explicit TimeProvider(QObject *parent = nullptr); - void readDatagram(QSctpSocket &from, const QByteArray &ba) Q_DECL_OVERRIDE; + void readDatagram(QSctpSocket &from, const QByteArray &ba) override; }; #endif diff --git a/examples/opengl/computegles31/glwindow.h b/examples/opengl/computegles31/glwindow.h index 877f7b732e..f243858a45 100644 --- a/examples/opengl/computegles31/glwindow.h +++ b/examples/opengl/computegles31/glwindow.h @@ -86,7 +86,7 @@ public: void setBlurRadius(float blurRadius); protected: - void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *e) override; void setAnimating(bool animate); private: diff --git a/examples/opengl/qopenglwindow/background_renderer.cpp b/examples/opengl/qopenglwindow/background_renderer.cpp index d57198444e..cba4ae1f2f 100644 --- a/examples/opengl/qopenglwindow/background_renderer.cpp +++ b/examples/opengl/qopenglwindow/background_renderer.cpp @@ -146,7 +146,7 @@ void FragmentToy::draw(const QSize &windowSize) m_fragment_shader.reset(new QOpenGLShader(QOpenGLShader::Fragment)); if (!m_fragment_shader->compileSourceCode(data)) { qWarning() << "Failed to compile fragment shader:" << m_fragment_shader->log(); - m_fragment_shader.reset(Q_NULLPTR); + m_fragment_shader.reset(nullptr); } } else { qWarning() << "Unknown error, no fragment shader"; @@ -198,14 +198,14 @@ void FragmentToy::fileChanged(const QString &path) m_recompile_shaders = true; if (m_program) { m_program->removeShader(m_fragment_shader.data()); - m_fragment_shader.reset(Q_NULLPTR); + m_fragment_shader.reset(nullptr); } } } else { m_recompile_shaders = true; if (m_program) { m_program->removeShader(m_fragment_shader.data()); - m_fragment_shader.reset(Q_NULLPTR); + m_fragment_shader.reset(nullptr); } } } diff --git a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp index c47b80275f..720f9a2085 100644 --- a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp +++ b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp @@ -468,7 +468,7 @@ static ColorSwatch *findByName(const QMainWindow *mainWindow, const QString &nam if (name == dock->objectName()) return dock; } - return Q_NULLPTR; + return nullptr; } void ColorSwatch::splitInto(QAction *action) diff --git a/examples/widgets/mainwindows/mainwindow/colorswatch.h b/examples/widgets/mainwindows/mainwindow/colorswatch.h index ec9d9e7372..7f73e46f31 100644 --- a/examples/widgets/mainwindows/mainwindow/colorswatch.h +++ b/examples/widgets/mainwindows/mainwindow/colorswatch.h @@ -62,7 +62,7 @@ class ColorSwatch : public QDockWidget Q_OBJECT public: - explicit ColorSwatch(const QString &colorName, QMainWindow *parent = Q_NULLPTR, Qt::WindowFlags flags = 0); + explicit ColorSwatch(const QString &colorName, QMainWindow *parent = nullptr, Qt::WindowFlags flags = 0); void setCustomSizeHint(const QSize &size); QMenu *colorSwatchMenu() const { return menu; } @@ -128,7 +128,7 @@ class BlueTitleBar : public QWidget { Q_OBJECT public: - explicit BlueTitleBar(QWidget *parent = Q_NULLPTR); + explicit BlueTitleBar(QWidget *parent = nullptr); QSize sizeHint() const override { return minimumSizeHint(); } QSize minimumSizeHint() const override; diff --git a/examples/widgets/mainwindows/mainwindow/mainwindow.cpp b/examples/widgets/mainwindows/mainwindow/mainwindow.cpp index afceddfca1..b2c5ccc473 100644 --- a/examples/widgets/mainwindows/mainwindow/mainwindow.cpp +++ b/examples/widgets/mainwindows/mainwindow/mainwindow.cpp @@ -382,7 +382,7 @@ void MainWindow::switchLayoutDirection() class CreateDockWidgetDialog : public QDialog { public: - explicit CreateDockWidgetDialog(QWidget *parent = Q_NULLPTR); + explicit CreateDockWidgetDialog(QWidget *parent = nullptr); QString enteredObjectName() const { return m_objectName->text(); } Qt::DockWidgetArea location() const; diff --git a/examples/widgets/mainwindows/mainwindow/mainwindow.h b/examples/widgets/mainwindows/mainwindow/mainwindow.h index af4f1f5745..9b1af6df80 100644 --- a/examples/widgets/mainwindows/mainwindow/mainwindow.h +++ b/examples/widgets/mainwindows/mainwindow/mainwindow.h @@ -64,7 +64,7 @@ public: typedef QMap<QString, QSize> CustomSizeHintMap; explicit MainWindow(const CustomSizeHintMap &customSizeHints, - QWidget *parent = Q_NULLPTR, + QWidget *parent = nullptr, Qt::WindowFlags flags = 0); public slots: diff --git a/examples/widgets/mainwindows/mainwindow/toolbar.cpp b/examples/widgets/mainwindows/mainwindow/toolbar.cpp index 814cfc7f4d..baea124ae4 100644 --- a/examples/widgets/mainwindows/mainwindow/toolbar.cpp +++ b/examples/widgets/mainwindows/mainwindow/toolbar.cpp @@ -83,8 +83,8 @@ static QPixmap genIcon(const QSize &iconSize, int number, const QColor &color) ToolBar::ToolBar(const QString &title, QWidget *parent) : QToolBar(parent) - , spinbox(Q_NULLPTR) - , spinboxAction(Q_NULLPTR) + , spinbox(nullptr) + , spinboxAction(nullptr) { setWindowTitle(title); setObjectName(title); diff --git a/examples/widgets/mainwindows/sdi/main.cpp b/examples/widgets/mainwindows/sdi/main.cpp index bed990d34d..6e29fafd6f 100644 --- a/examples/widgets/mainwindows/sdi/main.cpp +++ b/examples/widgets/mainwindows/sdi/main.cpp @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) parser.addPositionalArgument("file", "The file(s) to open."); parser.process(app); - MainWindow *mainWin = Q_NULLPTR; + MainWindow *mainWin = nullptr; foreach (const QString &file, parser.positionalArguments()) { MainWindow *newWin = new MainWindow(file); newWin->tile(mainWin); diff --git a/examples/widgets/tools/codecs/previewform.h b/examples/widgets/tools/codecs/previewform.h index 1846b976de..6335b6539f 100644 --- a/examples/widgets/tools/codecs/previewform.h +++ b/examples/widgets/tools/codecs/previewform.h @@ -69,7 +69,7 @@ class PreviewForm : public QDialog Q_OBJECT public: - explicit PreviewForm(QWidget *parent = Q_NULLPTR); + explicit PreviewForm(QWidget *parent = nullptr); void setCodecList(const QList<QTextCodec *> &list); void setEncodedData(const QByteArray &data); diff --git a/examples/widgets/tools/settingseditor/mainwindow.cpp b/examples/widgets/tools/settingseditor/mainwindow.cpp index ab9837c513..a7a1e9b415 100644 --- a/examples/widgets/tools/settingseditor/mainwindow.cpp +++ b/examples/widgets/tools/settingseditor/mainwindow.cpp @@ -56,7 +56,7 @@ MainWindow::MainWindow() : settingsTree(new SettingsTree) - , locationDialog(Q_NULLPTR) + , locationDialog(nullptr) { setCentralWidget(settingsTree); diff --git a/examples/widgets/widgets/charactermap/mainwindow.cpp b/examples/widgets/widgets/charactermap/mainwindow.cpp index 5f17128a2f..d3ac55483c 100644 --- a/examples/widgets/widgets/charactermap/mainwindow.cpp +++ b/examples/widgets/widgets/charactermap/mainwindow.cpp @@ -244,7 +244,7 @@ void MainWindow::updateClipboard() class FontInfoDialog : public QDialog { public: - explicit FontInfoDialog(QWidget *parent = Q_NULLPTR); + explicit FontInfoDialog(QWidget *parent = nullptr); private: QString text() const; diff --git a/examples/widgets/widgets/icons/iconpreviewarea.cpp b/examples/widgets/widgets/icons/iconpreviewarea.cpp index 35379610c5..9cb54c47f6 100644 --- a/examples/widgets/widgets/icons/iconpreviewarea.cpp +++ b/examples/widgets/widgets/icons/iconpreviewarea.cpp @@ -190,7 +190,7 @@ QLabel *IconPreviewArea::createPixmapLabel() //! [5] void IconPreviewArea::updatePixmapLabels() { - QWindow *window = Q_NULLPTR; + QWindow *window = nullptr; if (const QWidget *nativeParent = nativeParentWidget()) window = nativeParent->windowHandle(); for (int column = 0; column < NumModes; ++column) { diff --git a/examples/widgets/widgets/icons/iconpreviewarea.h b/examples/widgets/widgets/icons/iconpreviewarea.h index 3ebb9ed3ce..6ea35a5230 100644 --- a/examples/widgets/widgets/icons/iconpreviewarea.h +++ b/examples/widgets/widgets/icons/iconpreviewarea.h @@ -66,7 +66,7 @@ class IconPreviewArea : public QWidget Q_OBJECT public: - explicit IconPreviewArea(QWidget *parent = Q_NULLPTR); + explicit IconPreviewArea(QWidget *parent = nullptr); void setIcon(const QIcon &icon); void setSize(const QSize &size); diff --git a/examples/widgets/widgets/icons/iconsizespinbox.h b/examples/widgets/widgets/icons/iconsizespinbox.h index 96a56e75c9..87415ac5d6 100644 --- a/examples/widgets/widgets/icons/iconsizespinbox.h +++ b/examples/widgets/widgets/icons/iconsizespinbox.h @@ -59,7 +59,7 @@ class IconSizeSpinBox : public QSpinBox Q_OBJECT public: - explicit IconSizeSpinBox(QWidget *parent = Q_NULLPTR); + explicit IconSizeSpinBox(QWidget *parent = nullptr); int valueFromText(const QString &text) const override; QString textFromValue(int value) const override; diff --git a/examples/widgets/widgets/icons/imagedelegate.h b/examples/widgets/widgets/icons/imagedelegate.h index 928085d85b..3b76b78339 100644 --- a/examples/widgets/widgets/icons/imagedelegate.h +++ b/examples/widgets/widgets/icons/imagedelegate.h @@ -59,7 +59,7 @@ class ImageDelegate : public QItemDelegate Q_OBJECT public: - explicit ImageDelegate(QObject *parent = Q_NULLPTR); + explicit ImageDelegate(QObject *parent = nullptr); //! [0] //! [1] diff --git a/examples/widgets/widgets/tablet/mainwindow.cpp b/examples/widgets/widgets/tablet/mainwindow.cpp index 0d63ac316b..c02e02f0a4 100644 --- a/examples/widgets/widgets/tablet/mainwindow.cpp +++ b/examples/widgets/widgets/tablet/mainwindow.cpp @@ -55,7 +55,7 @@ //! [0] MainWindow::MainWindow(TabletCanvas *canvas) - : m_canvas(canvas), m_colorDialog(Q_NULLPTR) + : m_canvas(canvas), m_colorDialog(nullptr) { createMenus(); setWindowTitle(tr("Tablet Example")); diff --git a/examples/widgets/widgets/tablet/tabletcanvas.cpp b/examples/widgets/widgets/tablet/tabletcanvas.cpp index 4b11568dfe..73678ab754 100644 --- a/examples/widgets/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/widgets/tablet/tabletcanvas.cpp @@ -55,7 +55,7 @@ //! [0] TabletCanvas::TabletCanvas() - : QWidget(Q_NULLPTR) + : QWidget(nullptr) , m_alphaChannelValuator(TangentialPressureValuator) , m_colorSaturationValuator(NoValuator) , m_lineWidthValuator(PressureValuator) @@ -119,12 +119,12 @@ void TabletCanvas::tabletEvent(QTabletEvent *event) case QEvent::TabletRelease: if (m_deviceDown && event->buttons() == Qt::NoButton) m_deviceDown = false; + update(); break; default: break; } event->accept(); - update(); } //! [3] @@ -154,6 +154,7 @@ void TabletCanvas::paintEvent(QPaintEvent *) //! [5] void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event) { + static qreal maxPenRadius = pressureToWidth(1.0); painter.setRenderHint(QPainter::Antialiasing); switch (event->device()) { @@ -169,6 +170,7 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event) painter.setBrush(grad); qreal radius = grad.radius(); painter.drawEllipse(event->posF(), radius, radius); + update(QRect(event->pos() - QPoint(radius, radius), QSize(radius * 2, radius * 2))); } break; case QTabletEvent::RotationStylus: @@ -188,6 +190,7 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event) poly << event->posF() - brushAdjust; poly << event->posF() + brushAdjust; painter.drawConvexPolygon(poly); + update(poly.boundingRect().toRect()); } break; //! [6] @@ -217,6 +220,8 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event) case QTabletEvent::Stylus: painter.setPen(m_pen); painter.drawLine(lastPoint.pos, event->posF()); + update(QRect(lastPoint.pos.toPoint(), event->pos()).normalized() + .adjusted(-maxPenRadius, -maxPenRadius, maxPenRadius, maxPenRadius)); break; } } diff --git a/examples/widgets/widgets/tablet/tabletcanvas.h b/examples/widgets/widgets/tablet/tabletcanvas.h index a1b31c65bf..671d5376f8 100644 --- a/examples/widgets/widgets/tablet/tabletcanvas.h +++ b/examples/widgets/widgets/tablet/tabletcanvas.h @@ -103,7 +103,7 @@ private: void initPixmap(); void paintPixmap(QPainter &painter, QTabletEvent *event); Qt::BrushStyle brushPattern(qreal value); - qreal pressureToWidth(qreal pressure); + static qreal pressureToWidth(qreal pressure); void updateBrush(const QTabletEvent *event); void updateCursor(const QTabletEvent *event); diff --git a/examples/xml/dombookmarks/xbeltree.h b/examples/xml/dombookmarks/xbeltree.h index f6c7ef8bfe..c58e1148ff 100644 --- a/examples/xml/dombookmarks/xbeltree.h +++ b/examples/xml/dombookmarks/xbeltree.h @@ -67,7 +67,7 @@ public: protected: #if !defined(QT_NO_CONTEXTMENU) && !defined(QT_NO_CLIPBOARD) - void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE; + void contextMenuEvent(QContextMenuEvent *event) override; #endif private slots: diff --git a/mkspecs/android-clang/qplatformdefs.h b/mkspecs/android-clang/qplatformdefs.h index 017233658e..b9d987e608 100644 --- a/mkspecs/android-clang/qplatformdefs.h +++ b/mkspecs/android-clang/qplatformdefs.h @@ -71,10 +71,6 @@ #include <sys/stat.h> #include <sys/wait.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif - #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif diff --git a/mkspecs/android-g++/qplatformdefs.h b/mkspecs/android-g++/qplatformdefs.h index 068f437c11..a0e80629a4 100644 --- a/mkspecs/android-g++/qplatformdefs.h +++ b/mkspecs/android-g++/qplatformdefs.h @@ -71,10 +71,6 @@ #include <sys/stat.h> #include <sys/wait.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif - #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif diff --git a/mkspecs/common/aix/qplatformdefs.h b/mkspecs/common/aix/qplatformdefs.h index 7bb8dfedd2..3606a2f1cb 100644 --- a/mkspecs/common/aix/qplatformdefs.h +++ b/mkspecs/common/aix/qplatformdefs.h @@ -75,9 +75,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif // Only AIX 4.3 and better support 64-bit diff --git a/mkspecs/common/android/qplatformdefs.h b/mkspecs/common/android/qplatformdefs.h index 048eb47c6c..23180c5d3c 100644 --- a/mkspecs/common/android/qplatformdefs.h +++ b/mkspecs/common/android/qplatformdefs.h @@ -70,10 +70,6 @@ #include <sys/stat.h> #include <sys/wait.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif - #ifndef _GNU_SOURCE # define _GNU_SOURCE #endif diff --git a/mkspecs/common/bsd/qplatformdefs.h b/mkspecs/common/bsd/qplatformdefs.h index 6c3a00b194..8e976d3290 100644 --- a/mkspecs/common/bsd/qplatformdefs.h +++ b/mkspecs/common/bsd/qplatformdefs.h @@ -70,9 +70,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #include "../posix/qplatformdefs.h" diff --git a/mkspecs/common/integrity/qplatformdefs.h b/mkspecs/common/integrity/qplatformdefs.h index 7039318f25..f0b4dea8e1 100644 --- a/mkspecs/common/integrity/qplatformdefs.h +++ b/mkspecs/common/integrity/qplatformdefs.h @@ -68,9 +68,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif // for htonl #include <arpa/inet.h> diff --git a/mkspecs/common/mac/qplatformdefs.h b/mkspecs/common/mac/qplatformdefs.h index 5cacd5a749..1927587097 100644 --- a/mkspecs/common/mac/qplatformdefs.h +++ b/mkspecs/common/mac/qplatformdefs.h @@ -70,9 +70,6 @@ #include <sys/wait.h> #define __APPLE_USE_RFC_3542 #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #include "../posix/qplatformdefs.h" diff --git a/mkspecs/common/qnx/qplatformdefs.h b/mkspecs/common/qnx/qplatformdefs.h index 72fc92738c..b30cd96002 100644 --- a/mkspecs/common/qnx/qplatformdefs.h +++ b/mkspecs/common/qnx/qplatformdefs.h @@ -73,9 +73,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif // for htonl #include <arpa/inet.h> diff --git a/mkspecs/darwin-g++/qplatformdefs.h b/mkspecs/darwin-g++/qplatformdefs.h index 46a9383238..faed56310d 100644 --- a/mkspecs/darwin-g++/qplatformdefs.h +++ b/mkspecs/darwin-g++/qplatformdefs.h @@ -68,9 +68,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #include "../common/posix/qplatformdefs.h" diff --git a/mkspecs/features/data/android/dx.bat b/mkspecs/features/data/android/dx.bat deleted file mode 100644 index 9816f9607d..0000000000 --- a/mkspecs/features/data/android/dx.bat +++ /dev/null @@ -1,108 +0,0 @@ -@echo off -REM Copyright (C) 2007 The Android Open Source Project -REM -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. - -REM If/when Google merge: -REM https://android-review.googlesource.com/#/c/52680/ -REM this file will become redundant. - -REM don't modify the caller's environment -setlocal - -REM Locate dx.jar in the directory where dx.bat was found and start it. - -REM Set up prog to be the path of this script, including following symlinks, -REM and set up progdir to be the fully-qualified pathname of its directory. -set prog=%~f0 - -if [%1]==[] goto badArgs -set "dx_jar_path=%1" -shift /1 - -if [%1]==[] goto badArgs - -REM Use dpZ here to make it more like the Google version. -for %%F in ("%dx_jar_path%") do set dpZ=%%~dpF - -rem Check we have a valid Java.exe in the path. -set java_exe= -if exist "%dpZ%..\tools\lib\find_java.bat" call "%dpZ%..\tools\lib\find_java.bat" -if exist "%dpZ%..\..\tools\lib\find_java.bat" call "%dpZ%..\..\tools\lib\find_java.bat" - -if not defined java_exe goto :EOF - -set jarfile=dx.jar -set "frameworkdir=%dpZ%" -rem frameworkdir must not end with a dir sep. -set "frameworkdir=%frameworkdir:~0,-1%" - -if exist "%frameworkdir%\%jarfile%" goto JarFileOk - set "frameworkdir=%dpZ%lib" - -if exist "%frameworkdir%\%jarfile%" goto JarFileOk - set "frameworkdir=%dpZ%..\framework" - -:JarFileOk - -set "jarpath=%frameworkdir%\%jarfile%" - -set javaOpts= -set args= - -REM By default, give dx a max heap size of 1 gig and a stack size of 1meg. -rem This can be overridden by using "-JXmx..." and "-JXss..." options below. -set defaultXmx=-Xmx1024M -set defaultXss=-Xss1m - -REM Capture all arguments that are not -J options. -REM Note that when reading the input arguments with %1, the cmd.exe -REM automagically converts --name=value arguments into 2 arguments "--name" -REM followed by "value". Dx has been changed to know how to deal with that. -set params= - -:firstArg -if [%1]==[] goto endArgs -set a=%~1 - - if [%defaultXmx%]==[] goto notXmx - if %a:~0,5% NEQ -JXmx goto notXmx - set defaultXmx= - :notXmx - - if [%defaultXss%]==[] goto notXss - if %a:~0,5% NEQ -JXss goto notXss - set defaultXss= - :notXss - - if %a:~0,2% NEQ -J goto notJ - set javaOpts=%javaOpts% -%a:~2% - shift /1 - goto firstArg - - :notJ - set params=%params% %1 - shift /1 - goto firstArg - -:endArgs - -set javaOpts=%javaOpts% %defaultXmx% %defaultXss% -call "%java_exe%" %javaOpts% -Djava.ext.dirs="%frameworkdir%" -jar "%jarpath%" %params% - -goto :EOF - -:badArgs -echo Usage: dx (for Qt) ^<android_sdk_dx_jar_path^> ^<dx_arguments^> -echo Example: dx (for Qt) C:\android-sdk\build-tools\17.0.0\dx.jar --dex --output=target.jar .classes - diff --git a/mkspecs/features/java.prf b/mkspecs/features/java.prf index 852954e5ca..f1f5e4c10c 100644 --- a/mkspecs/features/java.prf +++ b/mkspecs/features/java.prf @@ -7,10 +7,8 @@ android { CONFIG += android_app } -isEmpty(CLASS_DIR) { - bundled_jar_file: CLASS_DIR = .classes.bundled - else: CLASS_DIR = .classes -} +isEmpty(CLASS_DIR): \ + CLASS_DIR = .classes CONFIG -= qt @@ -39,26 +37,7 @@ QMAKE_LIBS = QMAKE_LIBS_OPENGL_ES2 = QMAKE_LIBDIR = QMAKE_EXTENSION_SHLIB = jar - -# Override linker with dex (for distributable Android archives) or jar (for other java builds) -android:!bundled_jar_file { - contains(QMAKE_HOST.os, Windows) { - # The location where dx.bat expects itself to be found is used as the landmark instead - # of the base sdk folder. - # Doing it this way makes this logic more similar to the other platforms and - # also means that our dx.bat is more like Google's dx.bat - DEX_BAT = $$ANDROID_SDK_ROOT/platform-tools/dx.bat - !exists($$DEX_BAT): DEX_BAT = $$ANDROID_SDK_ROOT/build-tools/$$ANDROID_SDK_BUILD_TOOLS_REVISION/dx.bat - DEX_CMD = $$PWD/data/android/dx $$DEX_BAT - } else { - DEX_CMD = $$ANDROID_SDK_ROOT/platform-tools/dx - !exists($$DEX_CMD): DEX_CMD = $$ANDROID_SDK_ROOT/build-tools/$$ANDROID_SDK_BUILD_TOOLS_REVISION/dx - !exists($$DEX_CMD): error("The path $$DEX_CMD does not exist. Please set the environment variable ANDROID_BUILD_TOOLS_REVISION to the revision of the build tools installed in your Android SDK.") - } - QMAKE_LINK_SHLIB_CMD = $$DEX_CMD --dex --output $(TARGET) $$CLASS_DIR -} else { - QMAKE_LINK_SHLIB_CMD = jar cf $(TARGET) -C $$CLASS_DIR . -} +QMAKE_LINK_SHLIB_CMD = jar cf $(TARGET) -C $$CLASS_DIR . # Force link step to always happen, since we are always updating the # .class files diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf index 62e1b69fde..9676244cc2 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf @@ -95,6 +95,8 @@ TARGET = $$qt5LibraryTarget($$TARGET) CONFIG += create_cmake +DEFINES *= QT_DEPRECATED_WARNINGS + load(qt_targets) load(qt_common) diff --git a/mkspecs/haiku-g++/qplatformdefs.h b/mkspecs/haiku-g++/qplatformdefs.h index 000541912f..21636c031e 100644 --- a/mkspecs/haiku-g++/qplatformdefs.h +++ b/mkspecs/haiku-g++/qplatformdefs.h @@ -67,9 +67,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #include "../common/posix/qplatformdefs.h" diff --git a/mkspecs/hpuxi-g++-64/qplatformdefs.h b/mkspecs/hpuxi-g++-64/qplatformdefs.h index 966dfcf8c2..816fd0de6c 100644 --- a/mkspecs/hpuxi-g++-64/qplatformdefs.h +++ b/mkspecs/hpuxi-g++-64/qplatformdefs.h @@ -70,9 +70,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #define QT_USE_XOPEN_LFS_EXTENSIONS #define QT_NO_READDIR64 diff --git a/mkspecs/hurd-g++/qplatformdefs.h b/mkspecs/hurd-g++/qplatformdefs.h index 9ee7de783b..3c80cbdfad 100644 --- a/mkspecs/hurd-g++/qplatformdefs.h +++ b/mkspecs/hurd-g++/qplatformdefs.h @@ -76,9 +76,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #include "../common/posix/qplatformdefs.h" diff --git a/mkspecs/linux-clang/qplatformdefs.h b/mkspecs/linux-clang/qplatformdefs.h index d29225f12f..a818d973f0 100644 --- a/mkspecs/linux-clang/qplatformdefs.h +++ b/mkspecs/linux-clang/qplatformdefs.h @@ -75,9 +75,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #define QT_USE_XOPEN_LFS_EXTENSIONS #include "../common/posix/qplatformdefs.h" diff --git a/mkspecs/linux-g++/qplatformdefs.h b/mkspecs/linux-g++/qplatformdefs.h index c9c0db7b5e..13523f0702 100644 --- a/mkspecs/linux-g++/qplatformdefs.h +++ b/mkspecs/linux-g++/qplatformdefs.h @@ -75,9 +75,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #define QT_USE_XOPEN_LFS_EXTENSIONS #include "../common/posix/qplatformdefs.h" diff --git a/mkspecs/linux-llvm/qplatformdefs.h b/mkspecs/linux-llvm/qplatformdefs.h index 1b2a8997cf..dc750ab1ef 100644 --- a/mkspecs/linux-llvm/qplatformdefs.h +++ b/mkspecs/linux-llvm/qplatformdefs.h @@ -76,9 +76,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #define QT_USE_XOPEN_LFS_EXTENSIONS #include "../common/posix/qplatformdefs.h" diff --git a/mkspecs/linux-lsb-g++/qplatformdefs.h b/mkspecs/linux-lsb-g++/qplatformdefs.h index 0ff012aaf3..4c4e53da2a 100644 --- a/mkspecs/linux-lsb-g++/qplatformdefs.h +++ b/mkspecs/linux-lsb-g++/qplatformdefs.h @@ -77,9 +77,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif // LSB 3.1 defines htonl and friends here #include <arpa/inet.h> diff --git a/mkspecs/lynxos-g++/qplatformdefs.h b/mkspecs/lynxos-g++/qplatformdefs.h index 7231b17840..4339ea2b23 100644 --- a/mkspecs/lynxos-g++/qplatformdefs.h +++ b/mkspecs/lynxos-g++/qplatformdefs.h @@ -69,9 +69,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #include "../common/posix/qplatformdefs.h" diff --git a/mkspecs/solaris-cc-64/qplatformdefs.h b/mkspecs/solaris-cc-64/qplatformdefs.h index 7a01081933..f430664a9e 100644 --- a/mkspecs/solaris-cc-64/qplatformdefs.h +++ b/mkspecs/solaris-cc-64/qplatformdefs.h @@ -70,9 +70,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #define QT_USE_XOPEN_LFS_EXTENSIONS #include "../common/posix/qplatformdefs.h" diff --git a/mkspecs/solaris-cc/qplatformdefs.h b/mkspecs/solaris-cc/qplatformdefs.h index a5ad9005a0..8350836deb 100644 --- a/mkspecs/solaris-cc/qplatformdefs.h +++ b/mkspecs/solaris-cc/qplatformdefs.h @@ -70,9 +70,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #define QT_USE_XOPEN_LFS_EXTENSIONS #include "../common/posix/qplatformdefs.h" diff --git a/mkspecs/solaris-g++-64/qplatformdefs.h b/mkspecs/solaris-g++-64/qplatformdefs.h index 7504912a89..ae559183ff 100644 --- a/mkspecs/solaris-g++-64/qplatformdefs.h +++ b/mkspecs/solaris-g++-64/qplatformdefs.h @@ -73,9 +73,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #define QT_USE_XOPEN_LFS_EXTENSIONS #include "../common/posix/qplatformdefs.h" diff --git a/mkspecs/solaris-g++/qplatformdefs.h b/mkspecs/solaris-g++/qplatformdefs.h index 112850ee8a..bd14a86b51 100644 --- a/mkspecs/solaris-g++/qplatformdefs.h +++ b/mkspecs/solaris-g++/qplatformdefs.h @@ -73,9 +73,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif #define QT_USE_XOPEN_LFS_EXTENSIONS #include "../common/posix/qplatformdefs.h" diff --git a/mkspecs/unsupported/qnx-X11-g++/qplatformdefs.h b/mkspecs/unsupported/qnx-X11-g++/qplatformdefs.h index de4a2cc2cb..e090179f52 100644 --- a/mkspecs/unsupported/qnx-X11-g++/qplatformdefs.h +++ b/mkspecs/unsupported/qnx-X11-g++/qplatformdefs.h @@ -72,9 +72,6 @@ #include <sys/stat.h> #include <sys/wait.h> #include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif // for htonl #include <arpa/inet.h> diff --git a/src/android/jar/bundledjar.pro b/src/android/jar/bundledjar.pro deleted file mode 100644 index e82c01c51b..0000000000 --- a/src/android/jar/bundledjar.pro +++ /dev/null @@ -1,3 +0,0 @@ -TARGET = QtAndroid-bundled -CONFIG += bundled_jar_file -include(jar.pri) diff --git a/src/android/jar/distributedjar.pro b/src/android/jar/distributedjar.pro deleted file mode 100644 index 15f362f629..0000000000 --- a/src/android/jar/distributedjar.pro +++ /dev/null @@ -1,2 +0,0 @@ -TARGET = QtAndroid -include(jar.pri) diff --git a/src/android/jar/jar.pri b/src/android/jar/jar.pri deleted file mode 100644 index 4535880536..0000000000 --- a/src/android/jar/jar.pri +++ /dev/null @@ -1,26 +0,0 @@ -CONFIG += java -DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar -API_VERSION = android-16 - -PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/ - -JAVACLASSPATH += $$PWD/src/ -JAVASOURCES += \ - $$PATHPREFIX/accessibility/QtAccessibilityDelegate.java \ - $$PATHPREFIX/accessibility/QtNativeAccessibility.java \ - $$PATHPREFIX/QtActivityDelegate.java \ - $$PATHPREFIX/QtEditText.java \ - $$PATHPREFIX/QtInputConnection.java \ - $$PATHPREFIX/QtLayout.java \ - $$PATHPREFIX/QtMessageDialogHelper.java \ - $$PATHPREFIX/QtNative.java \ - $$PATHPREFIX/QtNativeLibrariesDir.java \ - $$PATHPREFIX/QtSurface.java \ - $$PATHPREFIX/ExtractStyle.java \ - $$PATHPREFIX/EditMenu.java \ - $$PATHPREFIX/EditPopupMenu.java \ - $$PATHPREFIX/CursorHandle.java - -# install -target.path = $$[QT_INSTALL_PREFIX]/jar -INSTALLS += target diff --git a/src/android/jar/jar.pro b/src/android/jar/jar.pro index 8d19c1b7d6..603e28aeee 100644 --- a/src/android/jar/jar.pro +++ b/src/android/jar/jar.pro @@ -1,2 +1,28 @@ -TEMPLATE = subdirs -SUBDIRS += bundledjar.pro distributedjar.pro +TARGET = QtAndroid + +CONFIG += java +DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar +API_VERSION = android-16 + +PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/ + +JAVACLASSPATH += $$PWD/src/ +JAVASOURCES += \ + $$PATHPREFIX/accessibility/QtAccessibilityDelegate.java \ + $$PATHPREFIX/accessibility/QtNativeAccessibility.java \ + $$PATHPREFIX/QtActivityDelegate.java \ + $$PATHPREFIX/QtEditText.java \ + $$PATHPREFIX/QtInputConnection.java \ + $$PATHPREFIX/QtLayout.java \ + $$PATHPREFIX/QtMessageDialogHelper.java \ + $$PATHPREFIX/QtNative.java \ + $$PATHPREFIX/QtNativeLibrariesDir.java \ + $$PATHPREFIX/QtSurface.java \ + $$PATHPREFIX/ExtractStyle.java \ + $$PATHPREFIX/EditMenu.java \ + $$PATHPREFIX/EditPopupMenu.java \ + $$PATHPREFIX/CursorHandle.java + +# install +target.path = $$[QT_INSTALL_PREFIX]/jar +INSTALLS += target diff --git a/src/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h index dbd000e8ba..082fa9e838 100644 --- a/src/concurrent/qtconcurrentiteratekernel.h +++ b/src/concurrent/qtconcurrentiteratekernel.h @@ -159,7 +159,7 @@ public: inline ResultReporter(ThreadEngine<void> *) { } inline void reserveSpace(int) { } inline void reportResults(int) { } - inline void * getPointer() { return Q_NULLPTR; } + inline void * getPointer() { return nullptr; } }; inline bool selectIteration(std::bidirectional_iterator_tag) diff --git a/src/concurrent/qtconcurrentthreadengine.h b/src/concurrent/qtconcurrentthreadengine.h index f915e9adfd..450e7b8d50 100644 --- a/src/concurrent/qtconcurrentthreadengine.h +++ b/src/concurrent/qtconcurrentthreadengine.h @@ -113,7 +113,7 @@ private: void startThreads(); void threadExit(); bool threadThrottleExit(); - void run() Q_DECL_OVERRIDE; + void run() override; virtual void asynchronousFinish() = 0; #ifndef QT_NO_EXCEPTIONS void handleException(const QException &exception); @@ -132,7 +132,7 @@ class ThreadEngine : public virtual ThreadEngineBase public: typedef T ResultType; - virtual T *result() { return Q_NULLPTR; } + virtual T *result() { return nullptr; } QFutureInterface<T> *futureInterfaceTyped() { @@ -173,7 +173,7 @@ public: return future; } - void asynchronousFinish() Q_DECL_OVERRIDE + void asynchronousFinish() override { finish(); futureInterfaceTyped()->reportFinished(result()); diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h index 727b4e7777..0ff6bc5176 100644 --- a/src/corelib/animation/qabstractanimation.h +++ b/src/corelib/animation/qabstractanimation.h @@ -82,7 +82,7 @@ public: DeleteWhenStopped }; - QAbstractAnimation(QObject *parent = Q_NULLPTR); + QAbstractAnimation(QObject *parent = nullptr); virtual ~QAbstractAnimation(); State state() const; @@ -117,8 +117,8 @@ public Q_SLOTS: void setCurrentTime(int msecs); protected: - QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent = Q_NULLPTR); - bool event(QEvent *event) Q_DECL_OVERRIDE; + QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent = nullptr); + bool event(QEvent *event) override; virtual void updateCurrentTime(int currentTime) = 0; virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); @@ -136,7 +136,7 @@ class Q_CORE_EXPORT QAnimationDriver : public QObject Q_DECLARE_PRIVATE(QAnimationDriver) public: - QAnimationDriver(QObject *parent = Q_NULLPTR); + QAnimationDriver(QObject *parent = nullptr); ~QAnimationDriver(); virtual void advance(); @@ -162,7 +162,7 @@ protected: virtual void start(); virtual void stop(); - QAnimationDriver(QAnimationDriverPrivate &dd, QObject *parent = Q_NULLPTR); + QAnimationDriver(QAnimationDriverPrivate &dd, QObject *parent = nullptr); private: friend class QUnifiedTimer; diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 3b901c4426..5593046e48 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -116,7 +116,7 @@ class QDefaultAnimationDriver : public QAnimationDriver Q_OBJECT public: QDefaultAnimationDriver(QUnifiedTimer *timer); - void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE; + void timerEvent(QTimerEvent *e) override; private Q_SLOTS: void startTimer(); @@ -196,7 +196,7 @@ public: qint64 elapsed() const; protected: - void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE; + void timerEvent(QTimerEvent *) override; private Q_SLOTS: void startTimers(); @@ -265,11 +265,11 @@ public: */ static void updateAnimationTimer(); - void restartAnimationTimer() Q_DECL_OVERRIDE; - void updateAnimationsTime(qint64 delta) Q_DECL_OVERRIDE; + void restartAnimationTimer() override; + void updateAnimationsTime(qint64 delta) override; //useful for profiling/debugging - int runningAnimationCount() Q_DECL_OVERRIDE { return animations.count(); } + int runningAnimationCount() override { return animations.count(); } private Q_SLOTS: void startAnimations(); diff --git a/src/corelib/animation/qanimationgroup.h b/src/corelib/animation/qanimationgroup.h index 20be0c0dd4..136ad3ca9f 100644 --- a/src/corelib/animation/qanimationgroup.h +++ b/src/corelib/animation/qanimationgroup.h @@ -53,7 +53,7 @@ class Q_CORE_EXPORT QAnimationGroup : public QAbstractAnimation Q_OBJECT public: - QAnimationGroup(QObject *parent = Q_NULLPTR); + QAnimationGroup(QObject *parent = nullptr); ~QAnimationGroup(); QAbstractAnimation *animationAt(int index) const; @@ -67,7 +67,7 @@ public: protected: QAnimationGroup(QAnimationGroupPrivate &dd, QObject *parent); - bool event(QEvent *event) Q_DECL_OVERRIDE; + bool event(QEvent *event) override; private: Q_DISABLE_COPY(QAnimationGroup) diff --git a/src/corelib/animation/qparallelanimationgroup.h b/src/corelib/animation/qparallelanimationgroup.h index 3a00e9fd12..09a439ef24 100644 --- a/src/corelib/animation/qparallelanimationgroup.h +++ b/src/corelib/animation/qparallelanimationgroup.h @@ -53,18 +53,18 @@ class Q_CORE_EXPORT QParallelAnimationGroup : public QAnimationGroup Q_OBJECT public: - QParallelAnimationGroup(QObject *parent = Q_NULLPTR); + QParallelAnimationGroup(QObject *parent = nullptr); ~QParallelAnimationGroup(); - int duration() const Q_DECL_OVERRIDE; + int duration() const override; protected: QParallelAnimationGroup(QParallelAnimationGroupPrivate &dd, QObject *parent); - bool event(QEvent *event) Q_DECL_OVERRIDE; + bool event(QEvent *event) override; - void updateCurrentTime(int currentTime) Q_DECL_OVERRIDE; - void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) Q_DECL_OVERRIDE; - void updateDirection(QAbstractAnimation::Direction direction) Q_DECL_OVERRIDE; + void updateCurrentTime(int currentTime) override; + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override; + void updateDirection(QAbstractAnimation::Direction direction) override; private: Q_DISABLE_COPY(QParallelAnimationGroup) diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h index 069ba8e51a..1c9c3072f7 100644 --- a/src/corelib/animation/qparallelanimationgroup_p.h +++ b/src/corelib/animation/qparallelanimationgroup_p.h @@ -78,7 +78,7 @@ public: void connectUncontrolledAnimations(); void disconnectUncontrolledAnimations(); - void animationRemoved(int index, QAbstractAnimation *) Q_DECL_OVERRIDE; + void animationRemoved(int index, QAbstractAnimation *) override; // private slot void _q_uncontrolledAnimationFinished(); diff --git a/src/corelib/animation/qpauseanimation.h b/src/corelib/animation/qpauseanimation.h index c077164beb..e2095a39d6 100644 --- a/src/corelib/animation/qpauseanimation.h +++ b/src/corelib/animation/qpauseanimation.h @@ -54,16 +54,16 @@ class Q_CORE_EXPORT QPauseAnimation : public QAbstractAnimation Q_OBJECT Q_PROPERTY(int duration READ duration WRITE setDuration) public: - QPauseAnimation(QObject *parent = Q_NULLPTR); - QPauseAnimation(int msecs, QObject *parent = Q_NULLPTR); + QPauseAnimation(QObject *parent = nullptr); + QPauseAnimation(int msecs, QObject *parent = nullptr); ~QPauseAnimation(); - int duration() const Q_DECL_OVERRIDE; + int duration() const override; void setDuration(int msecs); protected: - bool event(QEvent *e) Q_DECL_OVERRIDE; - void updateCurrentTime(int) Q_DECL_OVERRIDE; + bool event(QEvent *e) override; + void updateCurrentTime(int) override; private: Q_DISABLE_COPY(QPauseAnimation) diff --git a/src/corelib/animation/qpropertyanimation.h b/src/corelib/animation/qpropertyanimation.h index ecc7524884..3270591d1d 100644 --- a/src/corelib/animation/qpropertyanimation.h +++ b/src/corelib/animation/qpropertyanimation.h @@ -55,8 +55,8 @@ class Q_CORE_EXPORT QPropertyAnimation : public QVariantAnimation Q_PROPERTY(QObject* targetObject READ targetObject WRITE setTargetObject) public: - QPropertyAnimation(QObject *parent = Q_NULLPTR); - QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent = Q_NULLPTR); + QPropertyAnimation(QObject *parent = nullptr); + QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent = nullptr); ~QPropertyAnimation(); QObject *targetObject() const; @@ -66,9 +66,9 @@ public: void setPropertyName(const QByteArray &propertyName); protected: - bool event(QEvent *event) Q_DECL_OVERRIDE; - void updateCurrentValue(const QVariant &value) Q_DECL_OVERRIDE; - void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) Q_DECL_OVERRIDE; + bool event(QEvent *event) override; + void updateCurrentValue(const QVariant &value) override; + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override; private: Q_DISABLE_COPY(QPropertyAnimation) diff --git a/src/corelib/animation/qsequentialanimationgroup.h b/src/corelib/animation/qsequentialanimationgroup.h index 3caf93b054..1c8e67d256 100644 --- a/src/corelib/animation/qsequentialanimationgroup.h +++ b/src/corelib/animation/qsequentialanimationgroup.h @@ -56,25 +56,25 @@ class Q_CORE_EXPORT QSequentialAnimationGroup : public QAnimationGroup Q_PROPERTY(QAbstractAnimation* currentAnimation READ currentAnimation NOTIFY currentAnimationChanged) public: - QSequentialAnimationGroup(QObject *parent = Q_NULLPTR); + QSequentialAnimationGroup(QObject *parent = nullptr); ~QSequentialAnimationGroup(); QPauseAnimation *addPause(int msecs); QPauseAnimation *insertPause(int index, int msecs); QAbstractAnimation *currentAnimation() const; - int duration() const Q_DECL_OVERRIDE; + int duration() const override; Q_SIGNALS: void currentAnimationChanged(QAbstractAnimation *current); protected: QSequentialAnimationGroup(QSequentialAnimationGroupPrivate &dd, QObject *parent); - bool event(QEvent *event) Q_DECL_OVERRIDE; + bool event(QEvent *event) override; - void updateCurrentTime(int) Q_DECL_OVERRIDE; - void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) Q_DECL_OVERRIDE; - void updateDirection(QAbstractAnimation::Direction direction) Q_DECL_OVERRIDE; + void updateCurrentTime(int) override; + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override; + void updateDirection(QAbstractAnimation::Direction direction) override; private: Q_DISABLE_COPY(QSequentialAnimationGroup) diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h index 1b07e1330a..e4f3d9c96a 100644 --- a/src/corelib/animation/qsequentialanimationgroup_p.h +++ b/src/corelib/animation/qsequentialanimationgroup_p.h @@ -82,8 +82,8 @@ public: void setCurrentAnimation(int index, bool intermediate = false); void activateCurrentAnimation(bool intermediate = false); - void animationInsertedAt(int index) Q_DECL_OVERRIDE; - void animationRemoved(int index, QAbstractAnimation *anim) Q_DECL_OVERRIDE; + void animationInsertedAt(int index) override; + void animationRemoved(int index, QAbstractAnimation *anim) override; bool atEnd() const; diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h index f21832b256..ed38979ad0 100644 --- a/src/corelib/animation/qvariantanimation.h +++ b/src/corelib/animation/qvariantanimation.h @@ -65,7 +65,7 @@ public: typedef QPair<qreal, QVariant> KeyValue; typedef QVector<KeyValue> KeyValues; - QVariantAnimation(QObject *parent = Q_NULLPTR); + QVariantAnimation(QObject *parent = nullptr); ~QVariantAnimation(); QVariant startValue() const; @@ -82,7 +82,7 @@ public: QVariant currentValue() const; - int duration() const Q_DECL_OVERRIDE; + int duration() const override; void setDuration(int msecs); QEasingCurve easingCurve() const; @@ -94,11 +94,11 @@ Q_SIGNALS: void valueChanged(const QVariant &value); protected: - QVariantAnimation(QVariantAnimationPrivate &dd, QObject *parent = Q_NULLPTR); - bool event(QEvent *event) Q_DECL_OVERRIDE; + QVariantAnimation(QVariantAnimationPrivate &dd, QObject *parent = nullptr); + bool event(QEvent *event) override; - void updateCurrentTime(int) Q_DECL_OVERRIDE; - void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) Q_DECL_OVERRIDE; + void updateCurrentTime(int) override; + void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override; virtual void updateCurrentValue(const QVariant &value); virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const; diff --git a/src/corelib/arch/qatomic_cxx11.h b/src/corelib/arch/qatomic_cxx11.h index 1404849382..2fc0bf5419 100644 --- a/src/corelib/arch/qatomic_cxx11.h +++ b/src/corelib/arch/qatomic_cxx11.h @@ -276,7 +276,7 @@ template <typename X> struct QAtomicOps static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return false; } template <typename T> - static bool testAndSetRelaxed(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW + static bool testAndSetRelaxed(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW { bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_relaxed, std::memory_order_relaxed); if (currentValue) @@ -285,7 +285,7 @@ template <typename X> struct QAtomicOps } template <typename T> - static bool testAndSetAcquire(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW + static bool testAndSetAcquire(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW { bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acquire, std::memory_order_acquire); if (currentValue) @@ -294,7 +294,7 @@ template <typename X> struct QAtomicOps } template <typename T> - static bool testAndSetRelease(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW + static bool testAndSetRelease(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW { bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_release, std::memory_order_relaxed); if (currentValue) @@ -303,7 +303,7 @@ template <typename X> struct QAtomicOps } template <typename T> - static bool testAndSetOrdered(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW + static bool testAndSetOrdered(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW { bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acq_rel, std::memory_order_acquire); if (currentValue) diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp index d6362b6fbc..330eb7c038 100644 --- a/src/corelib/codecs/qiconvcodec.cpp +++ b/src/corelib/codecs/qiconvcodec.cpp @@ -53,7 +53,7 @@ QT_REQUIRE_CONFIG(iconv); // unistd.h is needed for the _XOPEN_UNIX macro #include <unistd.h> -#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF) +#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX) # include <langinfo.h> #endif @@ -447,7 +447,7 @@ iconv_t QIconvCodec::createIconv_t(const char *to, const char *from) const char *codeset = 0; #endif -#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF) +#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX) if (cd == (iconv_t) -1) { codeset = nl_langinfo(CODESET); if (codeset) diff --git a/src/corelib/codecs/qicucodec_p.h b/src/corelib/codecs/qicucodec_p.h index 3a373ce5b3..0c2dbe17d6 100644 --- a/src/corelib/codecs/qicucodec_p.h +++ b/src/corelib/codecs/qicucodec_p.h @@ -74,12 +74,12 @@ public: static QTextCodec *codecForNameUnlocked(const char *name); static QTextCodec *codecForMibUnlocked(int mib); - QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE; - QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE; + QString convertToUnicode(const char *, int, ConverterState *) const override; + QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override; - QByteArray name() const Q_DECL_OVERRIDE; - QList<QByteArray> aliases() const Q_DECL_OVERRIDE; - int mibEnum() const Q_DECL_OVERRIDE; + QByteArray name() const override; + QList<QByteArray> aliases() const override; + int mibEnum() const override; private: QIcuCodec(const char *name); diff --git a/src/corelib/codecs/qisciicodec_p.h b/src/corelib/codecs/qisciicodec_p.h index f92c0091ce..f818e7d83e 100644 --- a/src/corelib/codecs/qisciicodec_p.h +++ b/src/corelib/codecs/qisciicodec_p.h @@ -65,11 +65,11 @@ public: static QTextCodec *create(const char *name); - QByteArray name() const Q_DECL_OVERRIDE; - int mibEnum() const Q_DECL_OVERRIDE; + QByteArray name() const override; + int mibEnum() const override; - QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE; - QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE; + QString convertToUnicode(const char *, int, ConverterState *) const override; + QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override; private: int idx; diff --git a/src/corelib/codecs/qlatincodec_p.h b/src/corelib/codecs/qlatincodec_p.h index 1042c3b80d..3e258e5ae1 100644 --- a/src/corelib/codecs/qlatincodec_p.h +++ b/src/corelib/codecs/qlatincodec_p.h @@ -63,12 +63,12 @@ class QLatin1Codec : public QTextCodec public: ~QLatin1Codec(); - QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE; - QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE; + QString convertToUnicode(const char *, int, ConverterState *) const override; + QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override; - QByteArray name() const Q_DECL_OVERRIDE; - QList<QByteArray> aliases() const Q_DECL_OVERRIDE; - int mibEnum() const Q_DECL_OVERRIDE; + QByteArray name() const override; + QList<QByteArray> aliases() const override; + int mibEnum() const override; }; @@ -78,12 +78,12 @@ class QLatin15Codec: public QTextCodec public: ~QLatin15Codec(); - QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE; - QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE; + QString convertToUnicode(const char *, int, ConverterState *) const override; + QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override; - QByteArray name() const Q_DECL_OVERRIDE; - QList<QByteArray> aliases() const Q_DECL_OVERRIDE; - int mibEnum() const Q_DECL_OVERRIDE; + QByteArray name() const override; + QList<QByteArray> aliases() const override; + int mibEnum() const override; }; #endif // QT_NO_TEXTCODEC diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 4f0cd914ca..1541c498e6 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -88,7 +88,7 @@ #include <stdlib.h> #include <ctype.h> #include <locale.h> -#if defined (_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF) && !defined(Q_OS_ANDROID) +#if defined (_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_ANDROID) # include <langinfo.h> #endif @@ -180,7 +180,7 @@ static QTextCodec *setupLocaleMapper() // This is because the builtin utf8 codec is around 5 times faster // then the using QIconvCodec -#if defined (_XOPEN_UNIX) && !defined(Q_OS_OSF) +#if defined (_XOPEN_UNIX) char *charset = nl_langinfo(CODESET); if (charset) locale = QTextCodec::codecForName(charset); diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h index 5163d37238..8153bebac8 100644 --- a/src/corelib/codecs/qtextcodec.h +++ b/src/corelib/codecs/qtextcodec.h @@ -100,7 +100,7 @@ public: struct Q_CORE_EXPORT ConverterState { ConverterState(ConversionFlags f = DefaultConversion) - : flags(f), remainingChars(0), invalidChars(0), d(Q_NULLPTR) { state_data[0] = state_data[1] = state_data[2] = 0; } + : flags(f), remainingChars(0), invalidChars(0), d(nullptr) { state_data[0] = state_data[1] = state_data[2] = 0; } ~ConverterState(); ConversionFlags flags; int remainingChars; @@ -111,9 +111,9 @@ public: Q_DISABLE_COPY(ConverterState) }; - QString toUnicode(const char *in, int length, ConverterState *state = Q_NULLPTR) const + QString toUnicode(const char *in, int length, ConverterState *state = nullptr) const { return convertToUnicode(in, length, state); } - QByteArray fromUnicode(const QChar *in, int length, ConverterState *state = Q_NULLPTR) const + QByteArray fromUnicode(const QChar *in, int length, ConverterState *state = nullptr) const { return convertFromUnicode(in, length, state); } QTextDecoder* makeDecoder(ConversionFlags flags = DefaultConversion) const; diff --git a/src/corelib/codecs/qtsciicodec_p.h b/src/corelib/codecs/qtsciicodec_p.h index 68ab01f7b5..78f9350a19 100644 --- a/src/corelib/codecs/qtsciicodec_p.h +++ b/src/corelib/codecs/qtsciicodec_p.h @@ -91,11 +91,11 @@ class QTsciiCodec : public QTextCodec { public: ~QTsciiCodec(); - QByteArray name() const Q_DECL_OVERRIDE; - int mibEnum() const Q_DECL_OVERRIDE; + QByteArray name() const override; + int mibEnum() const override; - QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE; - QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE; + QString convertToUnicode(const char *, int, ConverterState *) const override; + QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override; }; #endif // QT_NO_CODECS diff --git a/src/corelib/codecs/qutfcodec_p.h b/src/corelib/codecs/qutfcodec_p.h index 152fe174c4..36752cc909 100644 --- a/src/corelib/codecs/qutfcodec_p.h +++ b/src/corelib/codecs/qutfcodec_p.h @@ -310,11 +310,11 @@ class QUtf8Codec : public QTextCodec { public: ~QUtf8Codec(); - QByteArray name() const Q_DECL_OVERRIDE; - int mibEnum() const Q_DECL_OVERRIDE; + QByteArray name() const override; + int mibEnum() const override; - QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE; - QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE; + QString convertToUnicode(const char *, int, ConverterState *) const override; + QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override; void convertToUnicode(QString *target, const char *, int, ConverterState *) const; }; @@ -324,12 +324,12 @@ public: QUtf16Codec() { e = DetectEndianness; } ~QUtf16Codec(); - QByteArray name() const Q_DECL_OVERRIDE; - QList<QByteArray> aliases() const Q_DECL_OVERRIDE; - int mibEnum() const Q_DECL_OVERRIDE; + QByteArray name() const override; + QList<QByteArray> aliases() const override; + int mibEnum() const override; - QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE; - QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE; + QString convertToUnicode(const char *, int, ConverterState *) const override; + QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override; protected: DataEndianness e; @@ -338,17 +338,17 @@ protected: class QUtf16BECodec : public QUtf16Codec { public: QUtf16BECodec() : QUtf16Codec() { e = BigEndianness; } - QByteArray name() const Q_DECL_OVERRIDE; - QList<QByteArray> aliases() const Q_DECL_OVERRIDE; - int mibEnum() const Q_DECL_OVERRIDE; + QByteArray name() const override; + QList<QByteArray> aliases() const override; + int mibEnum() const override; }; class QUtf16LECodec : public QUtf16Codec { public: QUtf16LECodec() : QUtf16Codec() { e = LittleEndianness; } - QByteArray name() const Q_DECL_OVERRIDE; - QList<QByteArray> aliases() const Q_DECL_OVERRIDE; - int mibEnum() const Q_DECL_OVERRIDE; + QByteArray name() const override; + QList<QByteArray> aliases() const override; + int mibEnum() const override; }; class QUtf32Codec : public QTextCodec { @@ -356,12 +356,12 @@ public: QUtf32Codec() { e = DetectEndianness; } ~QUtf32Codec(); - QByteArray name() const Q_DECL_OVERRIDE; - QList<QByteArray> aliases() const Q_DECL_OVERRIDE; - int mibEnum() const Q_DECL_OVERRIDE; + QByteArray name() const override; + QList<QByteArray> aliases() const override; + int mibEnum() const override; - QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE; - QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE; + QString convertToUnicode(const char *, int, ConverterState *) const override; + QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override; protected: DataEndianness e; @@ -370,17 +370,17 @@ protected: class QUtf32BECodec : public QUtf32Codec { public: QUtf32BECodec() : QUtf32Codec() { e = BigEndianness; } - QByteArray name() const Q_DECL_OVERRIDE; - QList<QByteArray> aliases() const Q_DECL_OVERRIDE; - int mibEnum() const Q_DECL_OVERRIDE; + QByteArray name() const override; + QList<QByteArray> aliases() const override; + int mibEnum() const override; }; class QUtf32LECodec : public QUtf32Codec { public: QUtf32LECodec() : QUtf32Codec() { e = LittleEndianness; } - QByteArray name() const Q_DECL_OVERRIDE; - QList<QByteArray> aliases() const Q_DECL_OVERRIDE; - int mibEnum() const Q_DECL_OVERRIDE; + QByteArray name() const override; + QList<QByteArray> aliases() const override; + int mibEnum() const override; }; diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 6dc11e1a4d..1a7a463c2d 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -10,18 +10,15 @@ CONFIG += $$MODULE_CONFIG DEFINES += $$MODULE_DEFINES DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000 -irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused CONFIG += optimize_full QMAKE_DOCS = $$PWD/doc/qtcore.qdocconf -ANDROID_JAR_DEPENDENCIES = \ - jar/QtAndroid.jar ANDROID_LIB_DEPENDENCIES = \ plugins/platforms/android/libqtforandroid.so ANDROID_BUNDLED_JAR_DEPENDENCIES = \ - jar/QtAndroid-bundled.jar + jar/QtAndroid.jar ANDROID_PERMISSIONS = \ android.permission.INTERNET \ android.permission.WRITE_EXTERNAL_STORAGE diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index feeb488acd..4806f6cd74 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -118,7 +118,7 @@ public: Q_DECL_CONSTEXPR inline QFlags &operator=(const QFlags &other); #endif Q_DECL_CONSTEXPR inline QFlags(Enum f) Q_DECL_NOTHROW : i(Int(f)) {} - Q_DECL_CONSTEXPR inline QFlags(Zero = Q_NULLPTR) Q_DECL_NOTHROW : i(0) {} + Q_DECL_CONSTEXPR inline QFlags(Zero = nullptr) Q_DECL_NOTHROW : i(0) {} Q_DECL_CONSTEXPR inline QFlags(QFlag f) Q_DECL_NOTHROW : i(f) {} #ifdef Q_COMPILER_INITIALIZER_LISTS diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 36b7560398..7200f55777 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. +** Copyright (C) 2017 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -73,6 +73,10 @@ #include <Ws2tcpip.h> #endif // Q_OS_WINRT +#ifdef Q_OS_WIN +# include <qt_windows.h> +#endif + #if defined(Q_OS_VXWORKS) && defined(_WRS_KERNEL) # include <envLib.h> #endif @@ -1428,13 +1432,6 @@ bool qSharedBuild() Q_DECL_NOTHROW */ /*! - \macro Q_OS_ULTRIX - \relates <QtGlobal> - - Defined on DEC Ultrix. -*/ - -/*! \macro Q_OS_LINUX \relates <QtGlobal> @@ -1470,41 +1467,6 @@ bool qSharedBuild() Q_DECL_NOTHROW */ /*! - \macro Q_OS_BSDI - \relates <QtGlobal> - - Defined on BSD/OS. -*/ - -/*! - \macro Q_OS_IRIX - \relates <QtGlobal> - - Defined on SGI Irix. -*/ - -/*! - \macro Q_OS_OSF - \relates <QtGlobal> - - Defined on HP Tru64 UNIX. -*/ - -/*! - \macro Q_OS_SCO - \relates <QtGlobal> - - Defined on SCO OpenServer 5. -*/ - -/*! - \macro Q_OS_UNIXWARE - \relates <QtGlobal> - - Defined on UnixWare 7, Open UNIX 8. -*/ - -/*! \macro Q_OS_AIX \relates <QtGlobal> @@ -1519,27 +1481,6 @@ bool qSharedBuild() Q_DECL_NOTHROW */ /*! - \macro Q_OS_DGUX - \relates <QtGlobal> - - Defined on DG/UX. -*/ - -/*! - \macro Q_OS_RELIANT - \relates <QtGlobal> - - Defined on Reliant UNIX. -*/ - -/*! - \macro Q_OS_DYNIX - \relates <QtGlobal> - - Defined on DYNIX/ptx. -*/ - -/*! \macro Q_OS_QNX \relates <QtGlobal> @@ -2881,10 +2822,11 @@ QString QSysInfo::prettyProductName() This function returns the same as QHostInfo::localHostName(). - \sa QHostInfo::localDomainName + \sa QHostInfo::localDomainName, machineUniqueId() */ QString QSysInfo::machineHostName() { + // the hostname can change, so we can't cache it #if defined(Q_OS_LINUX) // gethostname(3) on Linux just calls uname(2), so do it ourselves // and avoid a memcpy @@ -2907,6 +2849,119 @@ QString QSysInfo::machineHostName() } #endif // QT_BOOTSTRAPPED +enum { + UuidStringLen = sizeof("00000000-0000-0000-0000-000000000000") - 1 +}; + +/*! + \since 5.10 + + Returns a unique ID for this machine, if one can be determined. If no + unique ID could be determined, this function returns an empty byte array. + Unlike machineHostName(), the value returned by this function is likely + globally unique. + + A unique ID is useful in network operations to identify this machine for an + extended period of time, when the IP address could change or if this + machine could have more than one IP address. For example, the ID could be + used when communicating with a server or when storing device-specific data + in shared network storage. + + Note that on some systems, this value will persist across reboots and on + some it will not. Applications should not blindly depend on this fact + without verifying the OS capabilities. In particular, on Linux systems, + this ID is usually permanent and it matches the D-Bus machine ID, except + for nodes without their own storage (replicated nodes). + + \sa machineHostName(), bootUniqueId() +*/ +QByteArray QSysInfo::machineUniqueId() +{ +#ifdef Q_OS_BSD4 + char uuid[UuidStringLen]; + size_t uuidlen = sizeof(uuid); +# ifdef KERN_HOSTUUID + int name[] = { CTL_KERN, KERN_HOSTUUID }; + if (sysctl(name, sizeof name / sizeof name[0], &uuid, &uuidlen, nullptr, 0) == 0 + && uuidlen == sizeof(uuid)) + return QByteArray(uuid, uuidlen); + +# else + // Darwin: no fixed value, we need to search by name + if (sysctlbyname("kern.uuid", uuid, &uuidlen, nullptr, 0) == 0 && uuidlen == sizeof(uuid)) + return QByteArray(uuid, uuidlen); +# endif +#elif defined(Q_OS_UNIX) + // The modern name on Linux is /etc/machine-id, but that path is + // unlikely to exist on non-Linux (non-systemd) systems. The old + // path is more than enough. + static const char fullfilename[] = "/usr/local/var/lib/dbus/machine-id"; + const char *firstfilename = fullfilename + sizeof("/usr/local") - 1; + int fd = qt_safe_open(firstfilename, O_RDONLY); + if (fd == -1 && errno == ENOENT) + fd = qt_safe_open(fullfilename, O_RDONLY); + + if (fd != -1) { + char buffer[32]; // 128 bits, hex-encoded + qint64 len = qt_safe_read(fd, buffer, sizeof(buffer)); + qt_safe_close(fd); + + if (len != -1) + return QByteArray(buffer, len); + } +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) + // Let's poke at the registry + HKEY key = NULL; + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_READ, &key) + == ERROR_SUCCESS) { + wchar_t buffer[UuidStringLen + 1]; + DWORD size = sizeof(buffer); + bool ok = (RegQueryValueEx(key, L"MachineGuid", NULL, NULL, (LPBYTE)buffer, &size) == + ERROR_SUCCESS); + RegCloseKey(key); + if (ok) + return QStringView(buffer, (size - 1) / 2).toLatin1(); + } +#endif + return QByteArray(); +} + +/*! + \since 5.10 + + Returns a unique ID for this machine's boot, if one can be determined. If + no unique ID could be determined, this function returns an empty byte + array. This value is expected to change after every boot and can be + considered globally unique. + + This function is currently only implemented for Linux and Apple operating + systems. + + \sa machineUniqueId() +*/ +QByteArray QSysInfo::bootUniqueId() +{ +#ifdef Q_OS_LINUX + // use low-level API here for simplicity + int fd = qt_safe_open("/proc/sys/kernel/random/boot_id", O_RDONLY); + if (fd != -1) { + char uuid[UuidStringLen]; + qint64 len = qt_safe_read(fd, uuid, sizeof(uuid)); + qt_safe_close(fd); + if (len == UuidStringLen) + return QByteArray(uuid, UuidStringLen); + } +#elif defined(Q_OS_DARWIN) + // "kern.bootsessionuuid" is only available by name + char uuid[UuidStringLen]; + size_t uuidlen = sizeof(uuid); + if (sysctlbyname("kern.bootsessionuuid", uuid, &uuidlen, nullptr, 0) == 0 + && uuidlen == sizeof(uuid)) + return QByteArray(uuid, uuidlen); +#endif + return QByteArray(); +}; + /*! \macro void Q_ASSERT(bool test) \relates <QtGlobal> diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 7b691ca59e..e49bace002 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1138,7 +1138,7 @@ Q_CORE_EXPORT bool qunsetenv(const char *varName); Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT; Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT; -Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=Q_NULLPTR) Q_DECL_NOEXCEPT; +Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) Q_DECL_NOEXCEPT; inline int qIntCast(double f) { return int(f); } inline int qIntCast(float f) { return int(f); } diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h index ec21198784..0c8d7dab38 100644 --- a/src/corelib/global/qlogging.h +++ b/src/corelib/global/qlogging.h @@ -64,7 +64,7 @@ class QMessageLogContext Q_DISABLE_COPY(QMessageLogContext) public: Q_DECL_CONSTEXPR QMessageLogContext() - : version(2), line(0), file(Q_NULLPTR), function(Q_NULLPTR), category(Q_NULLPTR) {} + : version(2), line(0), file(nullptr), function(nullptr), category(nullptr) {} Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName) : version(2), line(lineNumber), file(fileName), function(functionName), category(categoryName) {} @@ -150,9 +150,9 @@ private: #define QT_MESSAGELOG_LINE __LINE__ #define QT_MESSAGELOG_FUNC Q_FUNC_INFO #else - #define QT_MESSAGELOG_FILE Q_NULLPTR + #define QT_MESSAGELOG_FILE nullptr #define QT_MESSAGELOG_LINE 0 - #define QT_MESSAGELOG_FUNC Q_NULLPTR + #define QT_MESSAGELOG_FUNC nullptr #endif #define qDebug QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).debug diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index ab83730caa..38f194afb5 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -243,7 +243,7 @@ public: // size of a multi-variant string. TextLongestVariant = 0x80000 -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) , TextBypassShaping = 0x100000 #endif }; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index e64fb221d3..c53db50e71 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -3077,9 +3077,8 @@ it is displayed regardless of device type. The keypad is used to implement a virtual cursor, unless the device has an analog mouse type of input device (e.g. touchpad) - - \note In 4.6, cursor navigation is only implemented for Symbian OS. - On other platforms, it behaves as NavigationModeNone. + \note Cursor navigation is not currently implemented on any platform + and behaves as NavigationModeNone. \sa QApplication::setNavigationMode() \sa QApplication::navigationMode() */ diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index 6b73a17dc5..a3fa0fcb27 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -240,6 +240,8 @@ QT_WARNING_POP static QString prettyProductName(); static QString machineHostName(); + static QByteArray machineUniqueId(); + static QByteArray bootUniqueId(); }; #undef QT_SYSINFO_DEPRECATED_X diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h index 4a2c3f79bb..ff0e03108b 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h @@ -52,30 +52,18 @@ IOS - iOS WATCHOS - watchOS TVOS - tvOS - MSDOS - MS-DOS and Windows - OS2 - OS/2 - OS2EMX - XFree86 on OS/2 (not PM) WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) - WINRT - WinRT (Windows 8 Runtime) + WINRT - WinRT (Windows Runtime) CYGWIN - Cygwin SOLARIS - Sun Solaris HPUX - HP-UX - ULTRIX - DEC Ultrix LINUX - Linux [has variants] FREEBSD - FreeBSD [has variants] NETBSD - NetBSD OPENBSD - OpenBSD - BSDI - BSD/OS INTERIX - Interix - IRIX - SGI Irix - OSF - HP Tru64 UNIX - SCO - SCO OpenServer 5 - UNIXWARE - UnixWare 7, Open UNIX 8 AIX - AIX HURD - GNU Hurd - DGUX - DG/UX - RELIANT - Reliant UNIX - DYNIX - DYNIX/ptx QNX - QNX [has variants] QNX6 - QNX RTP 6.1 LYNX - LynxOS @@ -147,10 +135,6 @@ # define Q_OS_SOLARIS #elif defined(hpux) || defined(__hpux) # define Q_OS_HPUX -#elif defined(__ultrix) || defined(ultrix) -# define Q_OS_ULTRIX -#elif defined(sinix) -# define Q_OS_RELIANT #elif defined(__native_client__) # define Q_OS_NACL #elif defined(__linux__) || defined(__linux) @@ -167,34 +151,17 @@ #elif defined(__OpenBSD__) # define Q_OS_OPENBSD # define Q_OS_BSD4 -#elif defined(__bsdi__) -# define Q_OS_BSDI -# define Q_OS_BSD4 #elif defined(__INTERIX) # define Q_OS_INTERIX # define Q_OS_BSD4 -#elif defined(__sgi) -# define Q_OS_IRIX -#elif defined(__osf__) -# define Q_OS_OSF #elif defined(_AIX) # define Q_OS_AIX #elif defined(__Lynx__) # define Q_OS_LYNX #elif defined(__GNU__) # define Q_OS_HURD -#elif defined(__DGUX__) -# define Q_OS_DGUX #elif defined(__QNXNTO__) # define Q_OS_QNX -#elif defined(_SEQUENT_) -# define Q_OS_DYNIX -#elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */ -# define Q_OS_SCO -#elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */ -# define Q_OS_UNIXWARE -#elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */ -# define Q_OS_UNIXWARE #elif defined(__INTEGRITY) # define Q_OS_INTEGRITY #elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */ diff --git a/src/corelib/global/qversiontagging.cpp b/src/corelib/global/qversiontagging.cpp index e3d4037a16..cbfd93f135 100644 --- a/src/corelib/global/qversiontagging.cpp +++ b/src/corelib/global/qversiontagging.cpp @@ -84,6 +84,16 @@ make_versioned_symbol(SYM, QT_VERSION_MAJOR, 8, "@"); make_versioned_symbol(SYM, QT_VERSION_MAJOR, 9, "@"); #endif #if QT_VERSION_MINOR > 10 +make_versioned_symbol(SYM, QT_VERSION_MAJOR, 10, "@"); +#endif +#if QT_VERSION_MINOR > 11 +make_versioned_symbol(SYM, QT_VERSION_MAJOR, 11, "@"); +#endif +#if QT_VERSION_MINOR > 12 +make_versioned_symbol(SYM, QT_VERSION_MAJOR, 12, "@"); +#endif +#if QT_VERSION_MINOR > 13 +// We don't expect there will be a Qt 5.13 # error "Please update this file with more Qt versions." #endif diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp index 86dd737809..e0b9c41323 100644 --- a/src/corelib/io/qbuffer.cpp +++ b/src/corelib/io/qbuffer.cpp @@ -60,8 +60,8 @@ public: QByteArray *buf; QByteArray defaultBuf; - virtual qint64 peek(char *data, qint64 maxSize) Q_DECL_OVERRIDE; - virtual QByteArray peek(qint64 maxSize) Q_DECL_OVERRIDE; + virtual qint64 peek(char *data, qint64 maxSize) override; + virtual QByteArray peek(qint64 maxSize) override; #ifndef QT_NO_QOBJECT // private slots diff --git a/src/corelib/io/qbuffer.h b/src/corelib/io/qbuffer.h index fd05dff311..39e1e7b39d 100644 --- a/src/corelib/io/qbuffer.h +++ b/src/corelib/io/qbuffer.h @@ -57,8 +57,8 @@ class Q_CORE_EXPORT QBuffer : public QIODevice public: #ifndef QT_NO_QOBJECT - explicit QBuffer(QObject *parent = Q_NULLPTR); - QBuffer(QByteArray *buf, QObject *parent = Q_NULLPTR); + explicit QBuffer(QObject *parent = nullptr); + QBuffer(QByteArray *buf, QObject *parent = nullptr); #else QBuffer(); explicit QBuffer(QByteArray *buf); @@ -73,22 +73,22 @@ public: inline void setData(const char *data, int len); const QByteArray &data() const; - bool open(OpenMode openMode) Q_DECL_OVERRIDE; + bool open(OpenMode openMode) override; - void close() Q_DECL_OVERRIDE; - qint64 size() const Q_DECL_OVERRIDE; - qint64 pos() const Q_DECL_OVERRIDE; - bool seek(qint64 off) Q_DECL_OVERRIDE; - bool atEnd() const Q_DECL_OVERRIDE; - bool canReadLine() const Q_DECL_OVERRIDE; + void close() override; + qint64 size() const override; + qint64 pos() const override; + bool seek(qint64 off) override; + bool atEnd() const override; + bool canReadLine() const override; protected: #ifndef QT_NO_QOBJECT - void connectNotify(const QMetaMethod &) Q_DECL_OVERRIDE; - void disconnectNotify(const QMetaMethod &) Q_DECL_OVERRIDE; + void connectNotify(const QMetaMethod &) override; + void disconnectNotify(const QMetaMethod &) override; #endif - qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE; - qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE; + qint64 readData(char *data, qint64 maxlen) override; + qint64 writeData(const char *data, qint64 len) override; private: Q_DECLARE_PRIVATE(QBuffer) diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index 1486d3630c..5fa5b558ea 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -563,6 +563,7 @@ void QDataStream::setByteOrder(ByteOrder bo) \value Qt_5_8 Same as Qt_5_6 \value Qt_5_9 Same as Qt_5_6 \value Qt_5_10 Same as Qt_5_6 + \value Qt_5_11 Same as Qt_5_6 \omitvalue Qt_DefaultCompiledVersion \sa setVersion(), version() diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h index 0a429d091a..1f1b13686c 100644 --- a/src/corelib/io/qdatastream.h +++ b/src/corelib/io/qdatastream.h @@ -97,10 +97,11 @@ public: Qt_5_8 = Qt_5_7, Qt_5_9 = Qt_5_8, Qt_5_10 = Qt_5_9, -#if QT_VERSION >= 0x050b00 + Qt_5_11 = Qt_5_10, +#if QT_VERSION >= 0x050c00 #error Add the datastream version for this Qt version and update Qt_DefaultCompiledVersion #endif - Qt_DefaultCompiledVersion = Qt_5_10 + Qt_DefaultCompiledVersion = Qt_5_11 }; enum ByteOrder { diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 6d144cb65d..520f98b18f 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -2087,6 +2087,7 @@ bool QDir::match(const QString &filter, const QString &fileName) #endif // QT_NO_REGEXP /*! + \internal Returns \a path with redundant directory separators removed, and "."s and ".."s resolved (as far as possible). diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h index c5819e8076..e6f3d942fe 100644 --- a/src/corelib/io/qfile.h +++ b/src/corelib/io/qfile.h @@ -70,7 +70,7 @@ public: #endif ~QFile(); - QString fileName() const Q_DECL_OVERRIDE; + QString fileName() const override; void setFileName(const QString &name); #if defined(Q_OS_DARWIN) @@ -124,25 +124,25 @@ public: bool copy(const QString &newName); static bool copy(const QString &fileName, const QString &newName); - bool open(OpenMode flags) Q_DECL_OVERRIDE; + bool open(OpenMode flags) override; bool open(FILE *f, OpenMode ioFlags, FileHandleFlags handleFlags=DontCloseHandle); bool open(int fd, OpenMode ioFlags, FileHandleFlags handleFlags=DontCloseHandle); - qint64 size() const Q_DECL_OVERRIDE; + qint64 size() const override; - bool resize(qint64 sz) Q_DECL_OVERRIDE; + bool resize(qint64 sz) override; static bool resize(const QString &filename, qint64 sz); - Permissions permissions() const Q_DECL_OVERRIDE; + Permissions permissions() const override; static Permissions permissions(const QString &filename); - bool setPermissions(Permissions permissionSpec) Q_DECL_OVERRIDE; + bool setPermissions(Permissions permissionSpec) override; static bool setPermissions(const QString &filename, Permissions permissionSpec); protected: #ifdef QT_NO_QOBJECT QFile(QFilePrivate &dd); #else - QFile(QFilePrivate &dd, QObject *parent = Q_NULLPTR); + QFile(QFilePrivate &dd, QObject *parent = nullptr); #endif private: diff --git a/src/corelib/io/qfiledevice.h b/src/corelib/io/qfiledevice.h index e941781c25..af41bec2f6 100644 --- a/src/corelib/io/qfiledevice.h +++ b/src/corelib/io/qfiledevice.h @@ -100,19 +100,19 @@ public: FileError error() const; void unsetError(); - virtual void close() Q_DECL_OVERRIDE; + virtual void close() override; - bool isSequential() const Q_DECL_OVERRIDE; + bool isSequential() const override; int handle() const; virtual QString fileName() const; - qint64 pos() const Q_DECL_OVERRIDE; - bool seek(qint64 offset) Q_DECL_OVERRIDE; - bool atEnd() const Q_DECL_OVERRIDE; + qint64 pos() const override; + bool seek(qint64 offset) override; + bool atEnd() const override; bool flush(); - qint64 size() const Q_DECL_OVERRIDE; + qint64 size() const override; virtual bool resize(qint64 sz); virtual Permissions permissions() const; @@ -136,12 +136,12 @@ protected: QFileDevice(QFileDevicePrivate &dd); #else explicit QFileDevice(QObject *parent); - QFileDevice(QFileDevicePrivate &dd, QObject *parent = Q_NULLPTR); + QFileDevice(QFileDevicePrivate &dd, QObject *parent = nullptr); #endif - qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE; - qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE; - qint64 readLineData(char *data, qint64 maxlen) Q_DECL_OVERRIDE; + qint64 readData(char *data, qint64 maxlen) override; + qint64 writeData(const char *data, qint64 len) override; + qint64 readLineData(char *data, qint64 maxlen) override; private: Q_DISABLE_COPY(QFileDevice) diff --git a/src/corelib/io/qfiledevice_p.h b/src/corelib/io/qfiledevice_p.h index 60c51afb7e..47053d01b7 100644 --- a/src/corelib/io/qfiledevice_p.h +++ b/src/corelib/io/qfiledevice_p.h @@ -69,7 +69,7 @@ protected: inline bool ensureFlushed() const; - bool putCharHelper(char c) Q_DECL_OVERRIDE; + bool putCharHelper(char c) override; void setError(QFileDevice::FileError err); void setError(QFileDevice::FileError err, const QString &errorString); diff --git a/src/corelib/io/qfileselector.h b/src/corelib/io/qfileselector.h index fafb7f7609..c9c2f564f6 100644 --- a/src/corelib/io/qfileselector.h +++ b/src/corelib/io/qfileselector.h @@ -50,7 +50,7 @@ class Q_CORE_EXPORT QFileSelector : public QObject { Q_OBJECT public: - explicit QFileSelector(QObject *parent = Q_NULLPTR); + explicit QFileSelector(QObject *parent = nullptr); ~QFileSelector(); QString select(const QString &filePath) const; diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp index 0d1438f137..a9acf542d4 100644 --- a/src/corelib/io/qfilesystemiterator_unix.cpp +++ b/src/corelib/io/qfilesystemiterator_unix.cpp @@ -77,12 +77,19 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa if (!dir) return false; - dirEntry = QT_READDIR(dir); + for (;;) { + dirEntry = QT_READDIR(dir); - if (dirEntry) { - fileEntry = QFileSystemEntry(nativePath + QByteArray(dirEntry->d_name), QFileSystemEntry::FromNativePath()); - metaData.fillFromDirEnt(*dirEntry); - return true; + if (dirEntry) { + // process entries with correct UTF-8 names only + if (QFile::encodeName(QFile::decodeName(dirEntry->d_name)) == dirEntry->d_name) { + fileEntry = QFileSystemEntry(nativePath + QByteArray(dirEntry->d_name), QFileSystemEntry::FromNativePath()); + metaData.fillFromDirEnt(*dirEntry); + return true; + } + } else { + break; + } } lastError = errno; diff --git a/src/corelib/io/qfilesystemwatcher.h b/src/corelib/io/qfilesystemwatcher.h index 09d4e8e65e..057a20672c 100644 --- a/src/corelib/io/qfilesystemwatcher.h +++ b/src/corelib/io/qfilesystemwatcher.h @@ -55,8 +55,8 @@ class Q_CORE_EXPORT QFileSystemWatcher : public QObject Q_DECLARE_PRIVATE(QFileSystemWatcher) public: - QFileSystemWatcher(QObject *parent = Q_NULLPTR); - QFileSystemWatcher(const QStringList &paths, QObject *parent = Q_NULLPTR); + QFileSystemWatcher(QObject *parent = nullptr); + QFileSystemWatcher(const QStringList &paths, QObject *parent = nullptr); ~QFileSystemWatcher(); bool addPath(const QString &file); diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm index b4517cbac7..792ea387ac 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents.mm +++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm @@ -336,7 +336,7 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths, QMutexLocker locker(&lock); - bool wasRunning = stream != Q_NULLPTR; + bool wasRunning = stream != nullptr; bool needsRestart = false; WatchingState oldState = watchingState; diff --git a/src/corelib/io/qfilesystemwatcher_inotify_p.h b/src/corelib/io/qfilesystemwatcher_inotify_p.h index 777d62dc8a..0c873466c8 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify_p.h +++ b/src/corelib/io/qfilesystemwatcher_inotify_p.h @@ -70,8 +70,8 @@ public: static QInotifyFileSystemWatcherEngine *create(QObject *parent); - QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) Q_DECL_OVERRIDE; - QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) Q_DECL_OVERRIDE; + QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) override; + QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) override; private Q_SLOTS: void readFromInotify(); diff --git a/src/corelib/io/qfilesystemwatcher_polling_p.h b/src/corelib/io/qfilesystemwatcher_polling_p.h index 6dff08ac05..4c46633fdf 100644 --- a/src/corelib/io/qfilesystemwatcher_polling_p.h +++ b/src/corelib/io/qfilesystemwatcher_polling_p.h @@ -110,8 +110,8 @@ class QPollingFileSystemWatcherEngine : public QFileSystemWatcherEngine public: QPollingFileSystemWatcherEngine(QObject *parent); - QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) Q_DECL_OVERRIDE; - QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) Q_DECL_OVERRIDE; + QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) override; + QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) override; private Q_SLOTS: void timeout(); diff --git a/src/corelib/io/qfsfileengine_iterator_p.h b/src/corelib/io/qfsfileengine_iterator_p.h index 7f094ba9d7..bde00bf578 100644 --- a/src/corelib/io/qfsfileengine_iterator_p.h +++ b/src/corelib/io/qfsfileengine_iterator_p.h @@ -68,11 +68,11 @@ public: QFSFileEngineIterator(QDir::Filters filters, const QStringList &filterNames); ~QFSFileEngineIterator(); - QString next() Q_DECL_OVERRIDE; - bool hasNext() const Q_DECL_OVERRIDE; + QString next() override; + bool hasNext() const override; - QString currentFileName() const Q_DECL_OVERRIDE; - QFileInfo currentFileInfo() const Q_DECL_OVERRIDE; + QString currentFileName() const override; + QFileInfo currentFileInfo() const override; private: void advance() const; diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index 1f34dfc2be..bf90995fdd 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -71,49 +71,49 @@ public: explicit QFSFileEngine(const QString &file); ~QFSFileEngine(); - bool open(QIODevice::OpenMode openMode) Q_DECL_OVERRIDE; + bool open(QIODevice::OpenMode openMode) override; bool open(QIODevice::OpenMode flags, FILE *fh); - bool close() Q_DECL_OVERRIDE; - bool flush() Q_DECL_OVERRIDE; - bool syncToDisk() Q_DECL_OVERRIDE; - qint64 size() const Q_DECL_OVERRIDE; - qint64 pos() const Q_DECL_OVERRIDE; - bool seek(qint64) Q_DECL_OVERRIDE; - bool isSequential() const Q_DECL_OVERRIDE; - bool remove() Q_DECL_OVERRIDE; - bool copy(const QString &newName) Q_DECL_OVERRIDE; - bool rename(const QString &newName) Q_DECL_OVERRIDE; - bool renameOverwrite(const QString &newName) Q_DECL_OVERRIDE; - bool link(const QString &newName) Q_DECL_OVERRIDE; - bool mkdir(const QString &dirName, bool createParentDirectories) const Q_DECL_OVERRIDE; - bool rmdir(const QString &dirName, bool recurseParentDirectories) const Q_DECL_OVERRIDE; - bool setSize(qint64 size) Q_DECL_OVERRIDE; - bool caseSensitive() const Q_DECL_OVERRIDE; - bool isRelativePath() const Q_DECL_OVERRIDE; - QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const Q_DECL_OVERRIDE; - FileFlags fileFlags(FileFlags type) const Q_DECL_OVERRIDE; - bool setPermissions(uint perms) Q_DECL_OVERRIDE; + bool close() override; + bool flush() override; + bool syncToDisk() override; + qint64 size() const override; + qint64 pos() const override; + bool seek(qint64) override; + bool isSequential() const override; + bool remove() override; + bool copy(const QString &newName) override; + bool rename(const QString &newName) override; + bool renameOverwrite(const QString &newName) override; + bool link(const QString &newName) override; + bool mkdir(const QString &dirName, bool createParentDirectories) const override; + bool rmdir(const QString &dirName, bool recurseParentDirectories) const override; + bool setSize(qint64 size) override; + bool caseSensitive() const override; + bool isRelativePath() const override; + QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const override; + FileFlags fileFlags(FileFlags type) const override; + bool setPermissions(uint perms) override; QByteArray id() const override; - QString fileName(FileName file) const Q_DECL_OVERRIDE; - uint ownerId(FileOwner) const Q_DECL_OVERRIDE; - QString owner(FileOwner) const Q_DECL_OVERRIDE; - bool setFileTime(const QDateTime &newDate, FileTime time) Q_DECL_OVERRIDE; - QDateTime fileTime(FileTime time) const Q_DECL_OVERRIDE; - void setFileName(const QString &file) Q_DECL_OVERRIDE; - int handle() const Q_DECL_OVERRIDE; + QString fileName(FileName file) const override; + uint ownerId(FileOwner) const override; + QString owner(FileOwner) const override; + bool setFileTime(const QDateTime &newDate, FileTime time) override; + QDateTime fileTime(FileTime time) const override; + void setFileName(const QString &file) override; + int handle() const override; #ifndef QT_NO_FILESYSTEMITERATOR - Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) Q_DECL_OVERRIDE; - Iterator *endEntryList() Q_DECL_OVERRIDE; + Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override; + Iterator *endEntryList() override; #endif - qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE; - qint64 readLine(char *data, qint64 maxlen) Q_DECL_OVERRIDE; - qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE; + qint64 read(char *data, qint64 maxlen) override; + qint64 readLine(char *data, qint64 maxlen) override; + qint64 write(const char *data, qint64 len) override; bool cloneTo(QAbstractFileEngine *target) override; - bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) Q_DECL_OVERRIDE; - bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE; + bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) override; + bool supportsExtension(Extension extension) const override; //FS only!! bool open(QIODevice::OpenMode flags, int fd); diff --git a/src/corelib/io/qiodevice.h b/src/corelib/io/qiodevice.h index e64a4d0bb1..af37b3fd53 100644 --- a/src/corelib/io/qiodevice.h +++ b/src/corelib/io/qiodevice.h @@ -161,7 +161,7 @@ protected: #ifdef QT_NO_QOBJECT QIODevice(QIODevicePrivate &dd); #else - QIODevice(QIODevicePrivate &dd, QObject *parent = Q_NULLPTR); + QIODevice(QIODevicePrivate &dd, QObject *parent = nullptr); #endif virtual qint64 readData(char *data, qint64 maxlen) = 0; virtual qint64 readLineData(char *data, qint64 maxlen); diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h index de2aa1597e..15a53a67dc 100644 --- a/src/corelib/io/qiodevice_p.h +++ b/src/corelib/io/qiodevice_p.h @@ -88,14 +88,14 @@ public: class QRingBufferRef { QRingBuffer *m_buf; - inline QRingBufferRef() : m_buf(Q_NULLPTR) { } + inline QRingBufferRef() : m_buf(nullptr) { } friend class QIODevicePrivate; public: // wrap functions from QRingBuffer inline void setChunkSize(int size) { Q_ASSERT(m_buf); m_buf->setChunkSize(size); } inline int chunkSize() const { Q_ASSERT(m_buf); return m_buf->chunkSize(); } inline qint64 nextDataBlockSize() const { return (m_buf ? m_buf->nextDataBlockSize() : Q_INT64_C(0)); } - inline const char *readPointer() const { return (m_buf ? m_buf->readPointer() : Q_NULLPTR); } + inline const char *readPointer() const { return (m_buf ? m_buf->readPointer() : nullptr); } inline const char *readPointerAtPosition(qint64 pos, qint64 &length) const { Q_ASSERT(m_buf); return m_buf->readPointerAtPosition(pos, length); } inline void free(qint64 bytes) { Q_ASSERT(m_buf); m_buf->free(bytes); } inline char *reserve(qint64 bytes) { Q_ASSERT(m_buf); return m_buf->reserve(bytes); } diff --git a/src/corelib/io/qlockfile.cpp b/src/corelib/io/qlockfile.cpp index 129cf01b63..aa84ce6bc1 100644 --- a/src/corelib/io/qlockfile.cpp +++ b/src/corelib/io/qlockfile.cpp @@ -56,6 +56,8 @@ struct LockFileInfo qint64 pid; QString appname; QString hostname; + QByteArray hostid; + QByteArray bootid; }; } @@ -331,13 +333,15 @@ QByteArray QLockFilePrivate::lockFileContents() const // Use operator% from the fast builder to avoid multiple memory allocations. return QByteArray::number(QCoreApplication::applicationPid()) % '\n' % processNameByPid(QCoreApplication::applicationPid()).toUtf8() % '\n' - % machineName().toUtf8() % '\n'; + % machineName().toUtf8() % '\n' + % QSysInfo::machineUniqueId() % '\n' + % QSysInfo::bootUniqueId() % '\n'; } static bool getLockInfo_helper(const QString &fileName, LockFileInfo *info) { QFile reader(fileName); - if (!reader.open(QIODevice::ReadOnly)) + if (!reader.open(QIODevice::ReadOnly | QIODevice::Text)) return false; QByteArray pidLine = reader.readLine(); @@ -349,9 +353,17 @@ static bool getLockInfo_helper(const QString &fileName, LockFileInfo *info) QByteArray hostNameLine = reader.readLine(); hostNameLine.chop(1); + // prior to Qt 5.10, only the lines above were recorded + QByteArray hostId = reader.readLine(); + hostId.chop(1); + QByteArray bootId = reader.readLine(); + bootId.chop(1); + bool ok; info->appname = QString::fromUtf8(appNameLine); info->hostname = QString::fromUtf8(hostNameLine); + info->hostid = hostId; + info->bootid = bootId; info->pid = pidLine.toLongLong(&ok); return ok && info->pid > 0; } @@ -360,7 +372,20 @@ bool QLockFilePrivate::isApparentlyStale() const { LockFileInfo info; if (getLockInfo_helper(fileName, &info)) { - if (info.hostname.isEmpty() || info.hostname == machineName()) { + bool sameHost = info.hostname.isEmpty() || info.hostname == machineName(); + if (!info.hostid.isEmpty()) { + // Override with the host ID, if we know it. + QByteArray ourHostId = QSysInfo::machineUniqueId(); + if (!ourHostId.isEmpty()) + sameHost = (ourHostId == info.hostid); + } + + if (sameHost) { + if (!info.bootid.isEmpty()) { + // If we've rebooted, then the lock is definitely stale. + if (info.bootid != QSysInfo::bootUniqueId()) + return true; + } if (!isProcessRunning(info.pid, info.appname)) return true; } diff --git a/src/corelib/io/qlockfile_p.h b/src/corelib/io/qlockfile_p.h index b41dfb38ad..5b69347206 100644 --- a/src/corelib/io/qlockfile_p.h +++ b/src/corelib/io/qlockfile_p.h @@ -55,7 +55,10 @@ #include <QtCore/qlockfile.h> #include <QtCore/qfile.h> +#include <qplatformdefs.h> + #ifdef Q_OS_WIN +#include <io.h> #include <qt_windows.h> #endif @@ -96,6 +99,19 @@ public: int staleLockTime; // "int milliseconds" is big enough for 24 days QLockFile::LockError lockError; bool isLocked; + + static int getLockFileHandle(QLockFile *f) + { + int fd; +#ifdef Q_OS_WIN + // Use of this function on Windows WILL leak a file descriptor. + fd = _open_osfhandle(intptr_t(f->d_func()->fileHandle), 0); +#else + fd = f->d_func()->fileHandle; +#endif + QT_LSEEK(fd, 0, SEEK_SET); + return fd; + } }; QT_END_NAMESPACE diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index fc01f83e80..418b7d22ba 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -147,7 +147,7 @@ static bool setNativeLocks(int fd) QLockFile::LockError QLockFilePrivate::tryLock_sys() { const QByteArray lockFileName = QFile::encodeName(fileName); - const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0666); + const int fd = qt_safe_open(lockFileName.constData(), O_RDWR | O_CREAT | O_EXCL, 0666); if (fd < 0) { switch (errno) { case EEXIST: diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp index de64ec0432..6b8028460c 100644 --- a/src/corelib/io/qlockfile_win.cpp +++ b/src/corelib/io/qlockfile_win.cpp @@ -68,7 +68,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys() #ifndef Q_OS_WINRT SECURITY_ATTRIBUTES securityAtts = { sizeof(SECURITY_ATTRIBUTES), NULL, FALSE }; HANDLE fh = CreateFile((const wchar_t*)fileEntry.nativeFilePath().utf16(), - GENERIC_WRITE, + GENERIC_READ | GENERIC_WRITE, dwShareMode, &securityAtts, CREATE_NEW, // error if already exists @@ -76,7 +76,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys() NULL); #else // !Q_OS_WINRT HANDLE fh = CreateFile2((const wchar_t*)fileEntry.nativeFilePath().utf16(), - GENERIC_WRITE, + GENERIC_READ | GENERIC_WRITE, dwShareMode, CREATE_NEW, // error if already exists NULL); diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h index bb0b533831..ebed1120db 100644 --- a/src/corelib/io/qnoncontiguousbytedevice_p.h +++ b/src/corelib/io/qnoncontiguousbytedevice_p.h @@ -105,12 +105,12 @@ class QNonContiguousByteDeviceByteArrayImpl : public QNonContiguousByteDevice public: QNonContiguousByteDeviceByteArrayImpl(QByteArray *ba); ~QNonContiguousByteDeviceByteArrayImpl(); - const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE; - bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE; - bool atEnd() const Q_DECL_OVERRIDE; - bool reset() Q_DECL_OVERRIDE; - qint64 size() const Q_DECL_OVERRIDE; - qint64 pos() const Q_DECL_OVERRIDE; + const char* readPointer(qint64 maximumLength, qint64 &len) override; + bool advanceReadPointer(qint64 amount) override; + bool atEnd() const override; + bool reset() override; + qint64 size() const override; + qint64 pos() const override; protected: QByteArray* byteArray; qint64 currentPosition; @@ -121,12 +121,12 @@ class QNonContiguousByteDeviceRingBufferImpl : public QNonContiguousByteDevice public: QNonContiguousByteDeviceRingBufferImpl(QSharedPointer<QRingBuffer> rb); ~QNonContiguousByteDeviceRingBufferImpl(); - const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE; - bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE; - bool atEnd() const Q_DECL_OVERRIDE; - bool reset() Q_DECL_OVERRIDE; - qint64 size() const Q_DECL_OVERRIDE; - qint64 pos() const Q_DECL_OVERRIDE; + const char* readPointer(qint64 maximumLength, qint64 &len) override; + bool advanceReadPointer(qint64 amount) override; + bool atEnd() const override; + bool reset() override; + qint64 size() const override; + qint64 pos() const override; protected: QSharedPointer<QRingBuffer> ringBuffer; qint64 currentPosition; @@ -139,12 +139,12 @@ class QNonContiguousByteDeviceIoDeviceImpl : public QNonContiguousByteDevice public: QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d); ~QNonContiguousByteDeviceIoDeviceImpl(); - const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE; - bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE; - bool atEnd() const Q_DECL_OVERRIDE; - bool reset() Q_DECL_OVERRIDE; - qint64 size() const Q_DECL_OVERRIDE; - qint64 pos() const Q_DECL_OVERRIDE; + const char* readPointer(qint64 maximumLength, qint64 &len) override; + bool advanceReadPointer(qint64 amount) override; + bool atEnd() const override; + bool reset() override; + qint64 size() const override; + qint64 pos() const override; protected: QIODevice* device; QByteArray* currentReadBuffer; @@ -162,11 +162,11 @@ class QNonContiguousByteDeviceBufferImpl : public QNonContiguousByteDevice public: QNonContiguousByteDeviceBufferImpl(QBuffer *b); ~QNonContiguousByteDeviceBufferImpl(); - const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE; - bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE; - bool atEnd() const Q_DECL_OVERRIDE; - bool reset() Q_DECL_OVERRIDE; - qint64 size() const Q_DECL_OVERRIDE; + const char* readPointer(qint64 maximumLength, qint64 &len) override; + bool advanceReadPointer(qint64 amount) override; + bool atEnd() const override; + bool reset() override; + qint64 size() const override; protected: QBuffer* buffer; QByteArray byteArray; @@ -179,13 +179,13 @@ class QByteDeviceWrappingIoDevice : public QIODevice public: QByteDeviceWrappingIoDevice (QNonContiguousByteDevice *bd); ~QByteDeviceWrappingIoDevice (); - virtual bool isSequential () const Q_DECL_OVERRIDE; - virtual bool atEnd () const Q_DECL_OVERRIDE; - virtual bool reset () Q_DECL_OVERRIDE; - virtual qint64 size () const Q_DECL_OVERRIDE; + virtual bool isSequential () const override; + virtual bool atEnd () const override; + virtual bool reset () override; + virtual qint64 size () const override; protected: - virtual qint64 readData ( char * data, qint64 maxSize ) Q_DECL_OVERRIDE; - virtual qint64 writeData ( const char * data, qint64 maxSize ) Q_DECL_OVERRIDE; + virtual qint64 readData ( char * data, qint64 maxSize ) override; + virtual qint64 writeData ( const char * data, qint64 maxSize ) override; QNonContiguousByteDevice *byteDevice; }; diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index c8aef2f0b1..474fc87de8 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -155,7 +155,7 @@ public: }; Q_ENUM(ExitStatus) - explicit QProcess(QObject *parent = Q_NULLPTR); + explicit QProcess(QObject *parent = nullptr); virtual ~QProcess(); void start(const QString &program, const QStringList &arguments, OpenMode mode = ReadWrite); @@ -164,7 +164,7 @@ public: #endif void start(OpenMode mode = ReadWrite); bool startDetached(qint64 *pid = nullptr); - bool open(OpenMode mode = ReadWrite) Q_DECL_OVERRIDE; + bool open(OpenMode mode = ReadWrite) override; QString program() const; void setProgram(const QString &program); @@ -227,8 +227,8 @@ public: qint64 processId() const; bool waitForStarted(int msecs = 30000); - bool waitForReadyRead(int msecs = 30000) Q_DECL_OVERRIDE; - bool waitForBytesWritten(int msecs = 30000) Q_DECL_OVERRIDE; + bool waitForReadyRead(int msecs = 30000) override; + bool waitForBytesWritten(int msecs = 30000) override; bool waitForFinished(int msecs = 30000); QByteArray readAllStandardOutput(); @@ -238,12 +238,12 @@ public: QProcess::ExitStatus exitStatus() const; // QIODevice - qint64 bytesAvailable() const Q_DECL_OVERRIDE; // ### Qt6: remove trivial override - qint64 bytesToWrite() const Q_DECL_OVERRIDE; - bool isSequential() const Q_DECL_OVERRIDE; - bool canReadLine() const Q_DECL_OVERRIDE; // ### Qt6: remove trivial override - void close() Q_DECL_OVERRIDE; - bool atEnd() const Q_DECL_OVERRIDE; // ### Qt6: remove trivial override + qint64 bytesAvailable() const override; // ### Qt6: remove trivial override + qint64 bytesToWrite() const override; + bool isSequential() const override; + bool canReadLine() const override; // ### Qt6: remove trivial override + void close() override; + bool atEnd() const override; // ### Qt6: remove trivial override static int execute(const QString &program, const QStringList &arguments); static int execute(const QString &command); @@ -253,7 +253,7 @@ public: #if defined(Q_QDOC) = QString() #endif - , qint64 *pid = Q_NULLPTR); + , qint64 *pid = nullptr); #if !defined(Q_QDOC) static bool startDetached(const QString &program, const QStringList &arguments); // ### Qt6: merge overloads #endif @@ -286,8 +286,8 @@ protected: virtual void setupChildProcess(); // QIODevice - qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE; - qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE; + qint64 readData(char *data, qint64 maxlen) override; + qint64 writeData(const char *data, qint64 len) override; private: Q_DECLARE_PRIVATE(QProcess) diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index deb29dca0a..aa7ecbe91d 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -352,7 +352,7 @@ public: #if defined(Q_OS_UNIX) void execChild(const char *workingDirectory, char **argv, char **envp); #endif - bool processStarted(QString *errorMessage = Q_NULLPTR); + bool processStarted(QString *errorMessage = nullptr); void terminateProcess(); void killProcess(); void findExitCode(); diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 15752f84b2..68b7a8bf9b 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -885,7 +885,7 @@ bool QProcessPrivate::waitForDeadChild() // read the process information from our fd forkfd_info info; int ret; - EINTR_LOOP(ret, forkfd_wait(forkfd, &info, Q_NULLPTR)); + EINTR_LOOP(ret, forkfd_wait(forkfd, &info, nullptr)); exitCode = info.status; crashed = info.code != CLD_EXITED; diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 8da6d6b16e..6ab806d9fe 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -114,9 +114,7 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe) dwOpenMode |= PIPE_ACCESS_INBOUND; dwInputBufferSize = dwPipeBufferSize; } - DWORD dwPipeFlags = PIPE_TYPE_BYTE | PIPE_WAIT; - if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) - dwPipeFlags |= PIPE_REJECT_REMOTE_CLIENTS; + DWORD dwPipeFlags = PIPE_TYPE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS; hServer = CreateNamedPipe(pipeName, dwOpenMode, dwPipeFlags, diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index c1187e5145..9a63374e6f 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -911,8 +911,8 @@ public: inline QDynamicBufferResourceRoot(const QString &_root) : root(_root), buffer(0) { } inline ~QDynamicBufferResourceRoot() { } inline const uchar *mappingBuffer() const { return buffer; } - virtual QString mappingRoot() const Q_DECL_OVERRIDE { return root; } - virtual ResourceRootType type() const Q_DECL_OVERRIDE { return Resource_Buffer; } + virtual QString mappingRoot() const override { return root; } + virtual ResourceRootType type() const override { return Resource_Buffer; } // size == -1 means "unknown" bool registerSelf(const uchar *b, int size) @@ -994,7 +994,7 @@ public: } } QString mappingFile() const { return fileName; } - virtual ResourceRootType type() const Q_DECL_OVERRIDE { return Resource_File; } + virtual ResourceRootType type() const override { return Resource_File; } bool registerSelf(const QString &f) { bool fromMM = false; diff --git a/src/corelib/io/qresource_iterator_p.h b/src/corelib/io/qresource_iterator_p.h index 6a4e215864..207a88b0ba 100644 --- a/src/corelib/io/qresource_iterator_p.h +++ b/src/corelib/io/qresource_iterator_p.h @@ -63,10 +63,10 @@ public: QResourceFileEngineIterator(QDir::Filters filters, const QStringList &filterNames); ~QResourceFileEngineIterator(); - QString next() Q_DECL_OVERRIDE; - bool hasNext() const Q_DECL_OVERRIDE; + QString next() override; + bool hasNext() const override; - QString currentFileName() const Q_DECL_OVERRIDE; + QString currentFileName() const override; private: mutable QStringList entries; diff --git a/src/corelib/io/qresource_p.h b/src/corelib/io/qresource_p.h index e08ba64d2b..dcfe46704c 100644 --- a/src/corelib/io/qresource_p.h +++ b/src/corelib/io/qresource_p.h @@ -64,52 +64,52 @@ public: explicit QResourceFileEngine(const QString &path); ~QResourceFileEngine(); - virtual void setFileName(const QString &file) Q_DECL_OVERRIDE; + virtual void setFileName(const QString &file) override; - virtual bool open(QIODevice::OpenMode flags) Q_DECL_OVERRIDE ; - virtual bool close() Q_DECL_OVERRIDE; - virtual bool flush() Q_DECL_OVERRIDE; - virtual qint64 size() const Q_DECL_OVERRIDE; - virtual qint64 pos() const Q_DECL_OVERRIDE; + virtual bool open(QIODevice::OpenMode flags) override ; + virtual bool close() override; + virtual bool flush() override; + virtual qint64 size() const override; + virtual qint64 pos() const override; virtual bool atEnd() const; - virtual bool seek(qint64) Q_DECL_OVERRIDE; - virtual qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE; - virtual qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE; + virtual bool seek(qint64) override; + virtual qint64 read(char *data, qint64 maxlen) override; + virtual qint64 write(const char *data, qint64 len) override; - virtual bool remove() Q_DECL_OVERRIDE; - virtual bool copy(const QString &newName) Q_DECL_OVERRIDE; - virtual bool rename(const QString &newName) Q_DECL_OVERRIDE; - virtual bool link(const QString &newName) Q_DECL_OVERRIDE; + virtual bool remove() override; + virtual bool copy(const QString &newName) override; + virtual bool rename(const QString &newName) override; + virtual bool link(const QString &newName) override; - virtual bool isSequential() const Q_DECL_OVERRIDE; + virtual bool isSequential() const override; - virtual bool isRelativePath() const Q_DECL_OVERRIDE; + virtual bool isRelativePath() const override; - virtual bool mkdir(const QString &dirName, bool createParentDirectories) const Q_DECL_OVERRIDE; - virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const Q_DECL_OVERRIDE; + virtual bool mkdir(const QString &dirName, bool createParentDirectories) const override; + virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const override; - virtual bool setSize(qint64 size) Q_DECL_OVERRIDE; + virtual bool setSize(qint64 size) override; - virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const Q_DECL_OVERRIDE; + virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const override; - virtual bool caseSensitive() const Q_DECL_OVERRIDE; + virtual bool caseSensitive() const override; - virtual FileFlags fileFlags(FileFlags type) const Q_DECL_OVERRIDE; + virtual FileFlags fileFlags(FileFlags type) const override; - virtual bool setPermissions(uint perms) Q_DECL_OVERRIDE; + virtual bool setPermissions(uint perms) override; - virtual QString fileName(QAbstractFileEngine::FileName file) const Q_DECL_OVERRIDE; + virtual QString fileName(QAbstractFileEngine::FileName file) const override; - virtual uint ownerId(FileOwner) const Q_DECL_OVERRIDE; - virtual QString owner(FileOwner) const Q_DECL_OVERRIDE; + virtual uint ownerId(FileOwner) const override; + virtual QString owner(FileOwner) const override; - virtual QDateTime fileTime(FileTime time) const Q_DECL_OVERRIDE; + virtual QDateTime fileTime(FileTime time) const override; - virtual Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) Q_DECL_OVERRIDE; - virtual Iterator *endEntryList() Q_DECL_OVERRIDE; + virtual Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override; + virtual Iterator *endEntryList() override; - bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) Q_DECL_OVERRIDE; - bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE; + bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) override; + bool supportsExtension(Extension extension) const override; }; QT_END_NAMESPACE diff --git a/src/corelib/io/qsavefile.h b/src/corelib/io/qsavefile.h index 09d6e29272..200068d30d 100644 --- a/src/corelib/io/qsavefile.h +++ b/src/corelib/io/qsavefile.h @@ -67,15 +67,15 @@ public: explicit QSaveFile(const QString &name); #ifndef QT_NO_QOBJECT - explicit QSaveFile(QObject *parent = Q_NULLPTR); + explicit QSaveFile(QObject *parent = nullptr); explicit QSaveFile(const QString &name, QObject *parent); #endif ~QSaveFile(); - QString fileName() const Q_DECL_OVERRIDE; + QString fileName() const override; void setFileName(const QString &name); - bool open(OpenMode flags) Q_DECL_OVERRIDE; + bool open(OpenMode flags) override; bool commit(); void cancelWriting(); @@ -84,10 +84,10 @@ public: bool directWriteFallback() const; protected: - qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE; + qint64 writeData(const char *data, qint64 len) override; private: - void close() Q_DECL_OVERRIDE; + void close() override; #if !QT_CONFIG(translation) static QString tr(const char *string) { return QString::fromLatin1(string); } #endif diff --git a/src/corelib/io/qsettings.h b/src/corelib/io/qsettings.h index da5502e5ca..f34e6bea1b 100644 --- a/src/corelib/io/qsettings.h +++ b/src/corelib/io/qsettings.h @@ -125,13 +125,13 @@ public: #ifndef QT_NO_QOBJECT explicit QSettings(const QString &organization, - const QString &application = QString(), QObject *parent = Q_NULLPTR); + const QString &application = QString(), QObject *parent = nullptr); QSettings(Scope scope, const QString &organization, - const QString &application = QString(), QObject *parent = Q_NULLPTR); + const QString &application = QString(), QObject *parent = nullptr); QSettings(Format format, Scope scope, const QString &organization, - const QString &application = QString(), QObject *parent = Q_NULLPTR); - QSettings(const QString &fileName, Format format, QObject *parent = Q_NULLPTR); - explicit QSettings(QObject *parent = Q_NULLPTR); + const QString &application = QString(), QObject *parent = nullptr); + QSettings(const QString &fileName, Format format, QObject *parent = nullptr); + explicit QSettings(QObject *parent = nullptr); #else explicit QSettings(const QString &organization, const QString &application = QString()); @@ -199,7 +199,7 @@ public: protected: #ifndef QT_NO_QOBJECT - bool event(QEvent *event) Q_DECL_OVERRIDE; + bool event(QEvent *event) override; #endif private: diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index 2a08ee2e64..aa14d8435a 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -616,7 +616,7 @@ bool QConfFileSettingsPrivate::readPlistFile(const QByteArray &data, ParsedSetti { QCFType<CFDataRef> cfData = data.toRawCFData(); QCFType<CFPropertyListRef> propertyList = - CFPropertyListCreateWithData(kCFAllocatorDefault, cfData, kCFPropertyListImmutable, Q_NULLPTR, Q_NULLPTR); + CFPropertyListCreateWithData(kCFAllocatorDefault, cfData, kCFPropertyListImmutable, nullptr, nullptr); if (!propertyList) return true; diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h index 7923c24770..d18c96a06c 100644 --- a/src/corelib/io/qsettings_p.h +++ b/src/corelib/io/qsettings_p.h @@ -261,17 +261,17 @@ public: QConfFileSettingsPrivate(const QString &fileName, QSettings::Format format); ~QConfFileSettingsPrivate(); - void remove(const QString &key) Q_DECL_OVERRIDE; - void set(const QString &key, const QVariant &value) Q_DECL_OVERRIDE; - bool get(const QString &key, QVariant *value) const Q_DECL_OVERRIDE; + void remove(const QString &key) override; + void set(const QString &key, const QVariant &value) override; + bool get(const QString &key, QVariant *value) const override; - QStringList children(const QString &prefix, ChildSpec spec) const Q_DECL_OVERRIDE; + QStringList children(const QString &prefix, ChildSpec spec) const override; - void clear() Q_DECL_OVERRIDE; - void sync() Q_DECL_OVERRIDE; - void flush() Q_DECL_OVERRIDE; - bool isWritable() const Q_DECL_OVERRIDE; - QString fileName() const Q_DECL_OVERRIDE; + void clear() override; + void sync() override; + void flush() override; + bool isWritable() const override; + QString fileName() const override; bool readIniFile(const QByteArray &data, UnparsedSettingsMap *unparsedIniSections); static bool readIniSection(const QSettingsKey §ion, const QByteArray &data, diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm index e25339a7d1..3bb7a7877a 100644 --- a/src/corelib/io/qstandardpaths_mac.mm +++ b/src/corelib/io/qstandardpaths_mac.mm @@ -203,28 +203,17 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) if (type == AppDataLocation || type == AppLocalDataLocation) { CFBundleRef mainBundle = CFBundleGetMainBundle(); if (mainBundle) { - CFURLRef bundleUrl = CFBundleCopyBundleURL(mainBundle); - CFStringRef cfBundlePath = CFURLCopyFileSystemPath(bundleUrl, kCFURLPOSIXPathStyle); - QString bundlePath = QString::fromCFString(cfBundlePath); - CFRelease(cfBundlePath); - CFRelease(bundleUrl); - - CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(mainBundle); - CFStringRef cfResourcesPath = CFURLCopyFileSystemPath(resourcesUrl, - kCFURLPOSIXPathStyle); - QString resourcesPath = QString::fromCFString(cfResourcesPath); - CFRelease(cfResourcesPath); - CFRelease(resourcesUrl); - - // Handle bundled vs unbundled executables. CFBundleGetMainBundle() returns - // a valid bundle in both cases. CFBundleCopyResourcesDirectoryURL() returns - // an absolute path for unbundled executables. - if (resourcesPath.startsWith(QLatin1Char('/'))) - dirs.append(resourcesPath); - else - dirs.append(bundlePath + resourcesPath); + if (QCFType<CFURLRef> resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle)) { + if (QCFType<CFURLRef> absoluteResouresURL = CFURLCopyAbsoluteURL(resourcesURL)) { + if (QCFType<CFStringRef> path = CFURLCopyFileSystemPath(absoluteResouresURL, + kCFURLPOSIXPathStyle)) { + dirs.append(QString::fromCFString(path)); + } + } + } } } + const QString localDir = writableLocation(type); if (!localDir.isEmpty()) dirs.prepend(localDir); diff --git a/src/corelib/io/qstorageinfo_mac.cpp b/src/corelib/io/qstorageinfo_mac.cpp index 0f271f2bc6..8b06543d71 100644 --- a/src/corelib/io/qstorageinfo_mac.cpp +++ b/src/corelib/io/qstorageinfo_mac.cpp @@ -112,7 +112,7 @@ void QStorageInfoPrivate::retrieveUrlProperties(bool initRootPath) QCFType<CFArrayRef> keys = CFArrayCreate(kCFAllocatorDefault, initRootPath ? rootPathKeys : propertyKeys, size, - Q_NULLPTR); + nullptr); if (!keys) return; @@ -178,9 +178,9 @@ QList<QStorageInfo> QStorageInfoPrivate::mountedVolumes() QList<QStorageInfo> volumes; QCFType<CFURLEnumeratorRef> enumerator; - enumerator = CFURLEnumeratorCreateForMountedVolumes(Q_NULLPTR, + enumerator = CFURLEnumeratorCreateForMountedVolumes(nullptr, kCFURLEnumeratorSkipInvisibles, - Q_NULLPTR); + nullptr); CFURLEnumeratorResult result = kCFURLEnumeratorSuccess; do { diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 1fc32e0f2d..cdaa6329f9 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -257,7 +257,7 @@ inline QStorageIterator::~QStorageIterator() inline bool QStorageIterator::isValid() const { - return fp != Q_NULLPTR; + return fp != nullptr; } inline bool QStorageIterator::next() @@ -357,12 +357,12 @@ inline QStorageIterator::~QStorageIterator() inline bool QStorageIterator::isValid() const { - return fp != Q_NULLPTR; + return fp != nullptr; } inline bool QStorageIterator::next() { - return ::getmntent_r(fp, &mnt, buffer.data(), buffer.size()) != Q_NULLPTR; + return ::getmntent_r(fp, &mnt, buffer.data(), buffer.size()) != nullptr; } inline QString QStorageIterator::rootPath() const diff --git a/src/corelib/io/qstorageinfo_win.cpp b/src/corelib/io/qstorageinfo_win.cpp index 3830c5480c..8a3db90f87 100644 --- a/src/corelib/io/qstorageinfo_win.cpp +++ b/src/corelib/io/qstorageinfo_win.cpp @@ -147,8 +147,8 @@ void QStorageInfoPrivate::retrieveVolumeInfo() const bool result = ::GetVolumeInformation(reinterpret_cast<const wchar_t *>(path.utf16()), nameBuffer, defaultBufferSize, - Q_NULLPTR, - Q_NULLPTR, + nullptr, + nullptr, &fileSystemFlags, fileSystemTypeBuffer, defaultBufferSize); diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index 2779246c5b..ed52472ab3 100644 --- a/src/corelib/io/qtemporarydir.cpp +++ b/src/corelib/io/qtemporarydir.cpp @@ -42,12 +42,12 @@ #ifndef QT_NO_TEMPORARYFILE +#include "qdebug.h" #include "qdiriterator.h" +#include "qpair.h" #include "qplatformdefs.h" +#include "qrandom.h" #include "private/qtemporaryfile_p.h" -#include <QDebug> -#include <QPair> -#include <QRandomGenerator> #if defined(QT_BUILD_CORE_LIB) #include "qcoreapplication.h" diff --git a/src/corelib/io/qtemporarydir.h b/src/corelib/io/qtemporarydir.h index 3f6b70a2eb..5864ce5cfc 100644 --- a/src/corelib/io/qtemporarydir.h +++ b/src/corelib/io/qtemporarydir.h @@ -41,7 +41,7 @@ #define QTEMPORARYDIR_H #include <QtCore/qdir.h> -#include <QtCore/QScopedPointer> +#include <QtCore/qscopedpointer.h> QT_BEGIN_NAMESPACE diff --git a/src/corelib/io/qtemporaryfile.h b/src/corelib/io/qtemporaryfile.h index 7fc5a299fc..90a6a613e6 100644 --- a/src/corelib/io/qtemporaryfile.h +++ b/src/corelib/io/qtemporaryfile.h @@ -77,7 +77,7 @@ public: // ### Hides open(flags) bool open() { return open(QIODevice::ReadWrite); } - QString fileName() const Q_DECL_OVERRIDE; + QString fileName() const override; QString fileTemplate() const; void setFileTemplate(const QString &name); @@ -95,7 +95,7 @@ public: static QTemporaryFile *createNativeFile(QFile &file); protected: - bool open(OpenMode flags) Q_DECL_OVERRIDE; + bool open(OpenMode flags) override; private: friend class QFile; diff --git a/src/corelib/io/qtextstream.h b/src/corelib/io/qtextstream.h index e72b7942fd..ee0b09419d 100644 --- a/src/corelib/io/qtextstream.h +++ b/src/corelib/io/qtextstream.h @@ -212,8 +212,8 @@ typedef void (QTextStream::*QTSMFC)(QChar); // manipulator w/QChar argument class Q_CORE_EXPORT QTextStreamManipulator { public: - Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFI m, int a) Q_DECL_NOTHROW : mf(m), mc(Q_NULLPTR), arg(a), ch() {} - Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFC m, QChar c) Q_DECL_NOTHROW : mf(Q_NULLPTR), mc(m), arg(-1), ch(c) {} + Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFI m, int a) Q_DECL_NOTHROW : mf(m), mc(nullptr), arg(a), ch() {} + Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFC m, QChar c) Q_DECL_NOTHROW : mf(nullptr), mc(m), arg(-1), ch(c) {} void exec(QTextStream &s) { if (mf) { (s.*mf)(arg); } else { (s.*mc)(ch); } } private: diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index 0bb8707ff9..5062ef7905 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -184,7 +184,7 @@ public: #endif #ifdef Q_COMPILER_RVALUE_REFS QUrl(QUrl &&other) Q_DECL_NOTHROW : d(other.d) - { other.d = Q_NULLPTR; } + { other.d = nullptr; } inline QUrl &operator=(QUrl &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index f893cf06e3..44622a0ad9 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -482,12 +482,12 @@ class QEmptyItemModel : public QAbstractItemModel { public: explicit QEmptyItemModel(QObject *parent = 0) : QAbstractItemModel(parent) {} - QModelIndex index(int, int, const QModelIndex &) const Q_DECL_OVERRIDE { return QModelIndex(); } - QModelIndex parent(const QModelIndex &) const Q_DECL_OVERRIDE { return QModelIndex(); } - int rowCount(const QModelIndex &) const Q_DECL_OVERRIDE { return 0; } - int columnCount(const QModelIndex &) const Q_DECL_OVERRIDE { return 0; } - bool hasChildren(const QModelIndex &) const Q_DECL_OVERRIDE { return false; } - QVariant data(const QModelIndex &, int) const Q_DECL_OVERRIDE { return QVariant(); } + QModelIndex index(int, int, const QModelIndex &) const override { return QModelIndex(); } + QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); } + int rowCount(const QModelIndex &) const override { return 0; } + int columnCount(const QModelIndex &) const override { return 0; } + bool hasChildren(const QModelIndex &) const override { return false; } + QVariant data(const QModelIndex &, int) const override { return QVariant(); } }; Q_GLOBAL_STATIC(QEmptyItemModel, qEmptyModel) diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h index a211d8e8ca..cd294ef8fa 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.h +++ b/src/corelib/itemmodels/qabstractitemmodel.h @@ -55,7 +55,7 @@ class Q_CORE_EXPORT QModelIndex { friend class QAbstractItemModel; public: - Q_DECL_CONSTEXPR inline QModelIndex() Q_DECL_NOTHROW : r(-1), c(-1), i(0), m(Q_NULLPTR) {} + Q_DECL_CONSTEXPR inline QModelIndex() Q_DECL_NOTHROW : r(-1), c(-1), i(0), m(nullptr) {} // compiler-generated copy/move ctors/assignment operators are fine! Q_DECL_CONSTEXPR inline int row() const Q_DECL_NOTHROW { return r; } Q_DECL_CONSTEXPR inline int column() const Q_DECL_NOTHROW { return c; } @@ -69,7 +69,7 @@ public: inline QVariant data(int role = Qt::DisplayRole) const; inline Qt::ItemFlags flags() const; Q_DECL_CONSTEXPR inline const QAbstractItemModel *model() const Q_DECL_NOTHROW { return m; } - Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW { return (r >= 0) && (c >= 0) && (m != Q_NULLPTR); } + Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW { return (r >= 0) && (c >= 0) && (m != nullptr); } Q_DECL_CONSTEXPR inline bool operator==(const QModelIndex &other) const Q_DECL_NOTHROW { return (other.r == r) && (other.i == i) && (other.c == c) && (other.m == m); } Q_DECL_CONSTEXPR inline bool operator!=(const QModelIndex &other) const Q_DECL_NOTHROW @@ -115,7 +115,7 @@ public: QPersistentModelIndex &operator=(const QPersistentModelIndex &other); #ifdef Q_COMPILER_RVALUE_REFS inline QPersistentModelIndex(QPersistentModelIndex &&other) Q_DECL_NOTHROW - : d(other.d) { other.d = Q_NULLPTR; } + : d(other.d) { other.d = nullptr; } inline QPersistentModelIndex &operator=(QPersistentModelIndex &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif @@ -171,7 +171,7 @@ class Q_CORE_EXPORT QAbstractItemModel : public QObject friend class QIdentityProxyModel; public: - explicit QAbstractItemModel(QObject *parent = Q_NULLPTR); + explicit QAbstractItemModel(QObject *parent = nullptr); virtual ~QAbstractItemModel(); Q_INVOKABLE bool hasIndex(int row, int column, const QModelIndex &parent = QModelIndex()) const; @@ -286,9 +286,9 @@ protected Q_SLOTS: void resetInternalData(); protected: - QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent = Q_NULLPTR); + QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent = nullptr); - inline QModelIndex createIndex(int row, int column, void *data = Q_NULLPTR) const; + inline QModelIndex createIndex(int row, int column, void *data = nullptr) const; inline QModelIndex createIndex(int row, int column, quintptr id) const; void encodeData(const QModelIndexList &indexes, QDataStream &stream) const; @@ -367,15 +367,15 @@ class Q_CORE_EXPORT QAbstractTableModel : public QAbstractItemModel Q_OBJECT public: - explicit QAbstractTableModel(QObject *parent = Q_NULLPTR); + explicit QAbstractTableModel(QObject *parent = nullptr); ~QAbstractTableModel(); - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE; + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; + QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; bool dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE; + int row, int column, const QModelIndex &parent) override; - Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; + Qt::ItemFlags flags(const QModelIndex &index) const override; using QObject::parent; @@ -384,8 +384,8 @@ protected: private: Q_DISABLE_COPY(QAbstractTableModel) - QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE; - bool hasChildren(const QModelIndex &parent) const Q_DECL_OVERRIDE; + QModelIndex parent(const QModelIndex &child) const override; + bool hasChildren(const QModelIndex &parent) const override; }; class Q_CORE_EXPORT QAbstractListModel : public QAbstractItemModel @@ -393,15 +393,15 @@ class Q_CORE_EXPORT QAbstractListModel : public QAbstractItemModel Q_OBJECT public: - explicit QAbstractListModel(QObject *parent = Q_NULLPTR); + explicit QAbstractListModel(QObject *parent = nullptr); ~QAbstractListModel(); - QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE; + QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override; + QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; bool dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE; + int row, int column, const QModelIndex &parent) override; - Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; + Qt::ItemFlags flags(const QModelIndex &index) const override; using QObject::parent; @@ -410,9 +410,9 @@ protected: private: Q_DISABLE_COPY(QAbstractListModel) - QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE; - int columnCount(const QModelIndex &parent) const Q_DECL_OVERRIDE; - bool hasChildren(const QModelIndex &parent) const Q_DECL_OVERRIDE; + QModelIndex parent(const QModelIndex &child) const override; + int columnCount(const QModelIndex &parent) const override; + bool hasChildren(const QModelIndex &parent) const override; }; // inline implementations diff --git a/src/corelib/itemmodels/qabstractproxymodel.h b/src/corelib/itemmodels/qabstractproxymodel.h index c9eafa09ee..6aa82b21ee 100644 --- a/src/corelib/itemmodels/qabstractproxymodel.h +++ b/src/corelib/itemmodels/qabstractproxymodel.h @@ -56,7 +56,7 @@ class Q_CORE_EXPORT QAbstractProxyModel : public QAbstractItemModel Q_PROPERTY(QAbstractItemModel* sourceModel READ sourceModel WRITE setSourceModel NOTIFY sourceModelChanged) public: - explicit QAbstractProxyModel(QObject *parent = Q_NULLPTR); + explicit QAbstractProxyModel(QObject *parent = nullptr); ~QAbstractProxyModel(); virtual void setSourceModel(QAbstractItemModel *sourceModel); @@ -68,34 +68,34 @@ public: Q_INVOKABLE virtual QItemSelection mapSelectionToSource(const QItemSelection &selection) const; Q_INVOKABLE virtual QItemSelection mapSelectionFromSource(const QItemSelection &selection) const; - bool submit() Q_DECL_OVERRIDE; - void revert() Q_DECL_OVERRIDE; + bool submit() override; + void revert() override; - QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - QMap<int, QVariant> itemData(const QModelIndex &index) const Q_DECL_OVERRIDE; - Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + QMap<int, QVariant> itemData(const QModelIndex &index) const override; + Qt::ItemFlags flags(const QModelIndex &index) const override; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE; - bool setItemData(const QModelIndex& index, const QMap<int, QVariant> &roles) Q_DECL_OVERRIDE; - bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; + bool setItemData(const QModelIndex& index, const QMap<int, QVariant> &roles) override; + bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override; - QModelIndex buddy(const QModelIndex &index) const Q_DECL_OVERRIDE; - bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE; - void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE; - void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE; - QSize span(const QModelIndex &index) const Q_DECL_OVERRIDE; - bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE; + QModelIndex buddy(const QModelIndex &index) const override; + bool canFetchMore(const QModelIndex &parent) const override; + void fetchMore(const QModelIndex &parent) override; + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; + QSize span(const QModelIndex &index) const override; + bool hasChildren(const QModelIndex &parent = QModelIndex()) const override; + QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; - QMimeData* mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE; + QMimeData* mimeData(const QModelIndexList &indexes) const override; bool canDropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent) const Q_DECL_OVERRIDE; + int row, int column, const QModelIndex &parent) const override; bool dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE; - QStringList mimeTypes() const Q_DECL_OVERRIDE; - Qt::DropActions supportedDragActions() const Q_DECL_OVERRIDE; - Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE; + int row, int column, const QModelIndex &parent) override; + QStringList mimeTypes() const override; + Qt::DropActions supportedDragActions() const override; + Qt::DropActions supportedDropActions() const override; Q_SIGNALS: void sourceModelChanged(QPrivateSignal); diff --git a/src/corelib/itemmodels/qidentityproxymodel.h b/src/corelib/itemmodels/qidentityproxymodel.h index e93740c1a2..d2b1ed9498 100644 --- a/src/corelib/itemmodels/qidentityproxymodel.h +++ b/src/corelib/itemmodels/qidentityproxymodel.h @@ -54,29 +54,29 @@ class Q_CORE_EXPORT QIdentityProxyModel : public QAbstractProxyModel { Q_OBJECT public: - explicit QIdentityProxyModel(QObject* parent = Q_NULLPTR); + explicit QIdentityProxyModel(QObject* parent = nullptr); ~QIdentityProxyModel(); - int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - QModelIndex mapFromSource(const QModelIndex& sourceIndex) const Q_DECL_OVERRIDE; - QModelIndex mapToSource(const QModelIndex& proxyIndex) const Q_DECL_OVERRIDE; - QModelIndex parent(const QModelIndex& child) const Q_DECL_OVERRIDE; + int columnCount(const QModelIndex& parent = QModelIndex()) const override; + QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override; + QModelIndex mapFromSource(const QModelIndex& sourceIndex) const override; + QModelIndex mapToSource(const QModelIndex& proxyIndex) const override; + QModelIndex parent(const QModelIndex& child) const override; using QObject::parent; - int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) Q_DECL_OVERRIDE; - QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE; - - QItemSelection mapSelectionFromSource(const QItemSelection& selection) const Q_DECL_OVERRIDE; - QItemSelection mapSelectionToSource(const QItemSelection& selection) const Q_DECL_OVERRIDE; - QModelIndexList match(const QModelIndex& start, int role, const QVariant& value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const Q_DECL_OVERRIDE; - void setSourceModel(QAbstractItemModel* sourceModel) Q_DECL_OVERRIDE; - - bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex()) Q_DECL_OVERRIDE; - bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) Q_DECL_OVERRIDE; - bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()) Q_DECL_OVERRIDE; - bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) Q_DECL_OVERRIDE; + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override; + QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; + + QItemSelection mapSelectionFromSource(const QItemSelection& selection) const override; + QItemSelection mapSelectionToSource(const QItemSelection& selection) const override; + QModelIndexList match(const QModelIndex& start, int role, const QVariant& value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const override; + void setSourceModel(QAbstractItemModel* sourceModel) override; + + bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override; + bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; + bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override; + bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; protected: QIdentityProxyModel(QIdentityProxyModelPrivate &dd, QObject* parent); diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h index 9d33303ddc..091c5a21a5 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.h +++ b/src/corelib/itemmodels/qitemselectionmodel.h @@ -164,7 +164,7 @@ public: Q_DECLARE_FLAGS(SelectionFlags, SelectionFlag) Q_FLAG(SelectionFlags) - explicit QItemSelectionModel(QAbstractItemModel *model = Q_NULLPTR); + explicit QItemSelectionModel(QAbstractItemModel *model = nullptr); explicit QItemSelectionModel(QAbstractItemModel *model, QObject *parent); virtual ~QItemSelectionModel(); diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index ef3281df30..fad980f568 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -300,7 +300,7 @@ public: void updateChildrenMapping(const QModelIndex &source_parent, Mapping *parent_mapping, Qt::Orientation orient, int start, int end, int delta_item_count, bool remove); - virtual void _q_sourceModelDestroyed() Q_DECL_OVERRIDE; + virtual void _q_sourceModelDestroyed() override; bool needsReorder(const QVector<int> &source_rows, const QModelIndex &source_parent) const; diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.h b/src/corelib/itemmodels/qsortfilterproxymodel.h index 6f2e9806ed..2f93836544 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.h +++ b/src/corelib/itemmodels/qsortfilterproxymodel.h @@ -70,16 +70,16 @@ class Q_CORE_EXPORT QSortFilterProxyModel : public QAbstractProxyModel Q_PROPERTY(bool recursiveFiltering READ recursiveFiltering WRITE setRecursiveFiltering) public: - explicit QSortFilterProxyModel(QObject *parent = Q_NULLPTR); + explicit QSortFilterProxyModel(QObject *parent = nullptr); ~QSortFilterProxyModel(); - void setSourceModel(QAbstractItemModel *sourceModel) Q_DECL_OVERRIDE; + void setSourceModel(QAbstractItemModel *sourceModel) override; - QModelIndex mapToSource(const QModelIndex &proxyIndex) const Q_DECL_OVERRIDE; - QModelIndex mapFromSource(const QModelIndex &sourceIndex) const Q_DECL_OVERRIDE; + QModelIndex mapToSource(const QModelIndex &proxyIndex) const override; + QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override; - QItemSelection mapSelectionToSource(const QItemSelection &proxySelection) const Q_DECL_OVERRIDE; - QItemSelection mapSelectionFromSource(const QItemSelection &sourceSelection) const Q_DECL_OVERRIDE; + QItemSelection mapSelectionToSource(const QItemSelection &proxySelection) const override; + QItemSelection mapSelectionFromSource(const QItemSelection &sourceSelection) const override; QRegExp filterRegExp() const; void setFilterRegExp(const QRegExp ®Exp); @@ -129,44 +129,44 @@ protected: public: using QObject::parent; - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE; - QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE; + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex &child) const override; + QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; - int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + bool hasChildren(const QModelIndex &parent = QModelIndex()) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; bool setHeaderData(int section, Qt::Orientation orientation, - const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE; + const QVariant &value, int role = Qt::EditRole) override; - QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE; + QMimeData *mimeData(const QModelIndexList &indexes) const override; bool dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE; + int row, int column, const QModelIndex &parent) override; - bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; - bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; - bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; - bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; + bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override; + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override; - void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE; - bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE; - Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; + void fetchMore(const QModelIndex &parent) override; + bool canFetchMore(const QModelIndex &parent) const override; + Qt::ItemFlags flags(const QModelIndex &index) const override; - QModelIndex buddy(const QModelIndex &index) const Q_DECL_OVERRIDE; + QModelIndex buddy(const QModelIndex &index) const override; QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits = 1, Qt::MatchFlags flags = - Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const Q_DECL_OVERRIDE; - QSize span(const QModelIndex &index) const Q_DECL_OVERRIDE; - void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE; + Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const override; + QSize span(const QModelIndex &index) const override; + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; - QStringList mimeTypes() const Q_DECL_OVERRIDE; - Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE; + QStringList mimeTypes() const override; + Qt::DropActions supportedDropActions() const override; private: Q_DECLARE_PRIVATE(QSortFilterProxyModel) Q_DISABLE_COPY(QSortFilterProxyModel) diff --git a/src/corelib/itemmodels/qstringlistmodel.h b/src/corelib/itemmodels/qstringlistmodel.h index 3bda848f48..38da1022ea 100644 --- a/src/corelib/itemmodels/qstringlistmodel.h +++ b/src/corelib/itemmodels/qstringlistmodel.h @@ -52,26 +52,26 @@ class Q_CORE_EXPORT QStringListModel : public QAbstractListModel { Q_OBJECT public: - explicit QStringListModel(QObject *parent = Q_NULLPTR); - explicit QStringListModel(const QStringList &strings, QObject *parent = Q_NULLPTR); + explicit QStringListModel(QObject *parent = nullptr); + explicit QStringListModel(const QStringList &strings, QObject *parent = nullptr); - int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; - Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; + Qt::ItemFlags flags(const QModelIndex &index) const override; - bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; - bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE; + bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; + bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; - void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE; + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; QStringList stringList() const; void setStringList(const QStringList &strings); - Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE; + Qt::DropActions supportedDropActions() const override; private: Q_DISABLE_COPY(QStringListModel) diff --git a/src/corelib/json/qjsonarray.h b/src/corelib/json/qjsonarray.h index ddba2ca78e..8d41138c97 100644 --- a/src/corelib/json/qjsonarray.h +++ b/src/corelib/json/qjsonarray.h @@ -133,7 +133,7 @@ public: typedef QJsonValueRef reference; typedef QJsonValueRefPtr pointer; - inline iterator() : a(Q_NULLPTR), i(0) { } + inline iterator() : a(nullptr), i(0) { } explicit inline iterator(QJsonArray *array, int index) : a(array), i(index) { } inline QJsonValueRef operator*() const { return QJsonValueRef(a, i); } @@ -178,7 +178,7 @@ public: typedef QJsonValue reference; typedef QJsonValuePtr pointer; - inline const_iterator() : a(Q_NULLPTR), i(0) { } + inline const_iterator() : a(nullptr), i(0) { } explicit inline const_iterator(const QJsonArray *array, int index) : a(array), i(index) { } #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) inline const_iterator(const const_iterator &o) : a(o.a), i(o.i) {} // ### Qt 6: Removed so class can be trivially-copyable diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp index 6469412054..9794bca60d 100644 --- a/src/corelib/json/qjsondocument.cpp +++ b/src/corelib/json/qjsondocument.cpp @@ -332,7 +332,7 @@ QVariant QJsonDocument::toVariant() const \sa fromJson() */ -#ifndef QT_JSON_READONLY +#if !defined(QT_JSON_READONLY) || defined(Q_CLANG_QDOC) QByteArray QJsonDocument::toJson() const { return toJson(Indented); @@ -369,7 +369,7 @@ QByteArray QJsonDocument::toJson() const \sa fromJson(), JsonFormat */ -#ifndef QT_JSON_READONLY +#if !defined(QT_JSON_READONLY) || defined(Q_CLANG_QDOC) QByteArray QJsonDocument::toJson(JsonFormat format) const { QByteArray json; diff --git a/src/corelib/json/qjsondocument.h b/src/corelib/json/qjsondocument.h index 4e76af21e2..b784890c54 100644 --- a/src/corelib/json/qjsondocument.h +++ b/src/corelib/json/qjsondocument.h @@ -129,11 +129,9 @@ public: Compact }; - static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = Q_NULLPTR); + static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = nullptr); -#ifdef Q_QDOC - QByteArray toJson(JsonFormat format = Indented) const; -#elif !defined(QT_JSON_READONLY) +#if !defined(QT_JSON_READONLY) || defined(Q_CLANG_QDOC) QByteArray toJson() const; //### Merge in Qt6 QByteArray toJson(JsonFormat format) const; #endif diff --git a/src/corelib/json/qjsonobject.h b/src/corelib/json/qjsonobject.h index c77e2164a8..610bce694c 100644 --- a/src/corelib/json/qjsonobject.h +++ b/src/corelib/json/qjsonobject.h @@ -135,7 +135,7 @@ public: typedef QJsonValueRef reference; typedef QJsonValuePtr pointer; - Q_DECL_CONSTEXPR inline iterator() : o(Q_NULLPTR), i(0) {} + Q_DECL_CONSTEXPR inline iterator() : o(nullptr), i(0) {} Q_DECL_CONSTEXPR inline iterator(QJsonObject *obj, int index) : o(obj), i(index) {} inline QString key() const { return o->keyAt(i); } @@ -178,7 +178,7 @@ public: typedef QJsonValue reference; typedef QJsonValuePtr pointer; - Q_DECL_CONSTEXPR inline const_iterator() : o(Q_NULLPTR), i(0) {} + Q_DECL_CONSTEXPR inline const_iterator() : o(nullptr), i(0) {} Q_DECL_CONSTEXPR inline const_iterator(const QJsonObject *obj, int index) : o(obj), i(index) {} inline const_iterator(const iterator &other) diff --git a/src/corelib/json/qjsonvalue.h b/src/corelib/json/qjsonvalue.h index 5d5ec72605..96538ebbf9 100644 --- a/src/corelib/json/qjsonvalue.h +++ b/src/corelib/json/qjsonvalue.h @@ -82,7 +82,7 @@ public: QJsonValue(QLatin1String s); #ifndef QT_NO_CAST_FROM_ASCII inline QT_ASCII_CAST_WARN QJsonValue(const char *s) - : d(Q_NULLPTR), t(String) { stringDataFromQStringHelper(QString::fromUtf8(s)); } + : d(nullptr), t(String) { stringDataFromQStringHelper(QString::fromUtf8(s)); } #endif QJsonValue(const QJsonArray &a); QJsonValue(const QJsonObject &o); diff --git a/src/corelib/kernel/qabstracteventdispatcher.h b/src/corelib/kernel/qabstracteventdispatcher.h index 3a530cf1de..b84e047f3f 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.h +++ b/src/corelib/kernel/qabstracteventdispatcher.h @@ -70,10 +70,10 @@ public: { } }; - explicit QAbstractEventDispatcher(QObject *parent = Q_NULLPTR); + explicit QAbstractEventDispatcher(QObject *parent = nullptr); ~QAbstractEventDispatcher(); - static QAbstractEventDispatcher *instance(QThread *thread = Q_NULLPTR); + static QAbstractEventDispatcher *instance(QThread *thread = nullptr); virtual bool processEvents(QEventLoop::ProcessEventsFlags flags) = 0; virtual bool hasPendingEvents() = 0; // ### Qt6: remove, mark final or make protected @@ -112,7 +112,7 @@ public: bool filterNativeEvent(const QByteArray &eventType, void *message, long *result); #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED bool filterEvent(void *message) - { return filterNativeEvent("", message, Q_NULLPTR); } + { return filterNativeEvent("", message, nullptr); } #endif Q_SIGNALS: diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 3b0da136ca..eb98cbef8f 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -130,7 +130,7 @@ int qt_safe_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout if (!timeout_ts) { // no timeout -> block forever int ret; - EINTR_LOOP(ret, qt_ppoll(fds, nfds, Q_NULLPTR)); + EINTR_LOOP(ret, qt_ppoll(fds, nfds, nullptr)); return ret; } diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index f78d2b9f24..e538a7e22b 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -362,7 +362,7 @@ Q_CORE_EXPORT int qt_safe_poll(struct pollfd *fds, nfds_t nfds, const struct tim static inline int qt_poll_msecs(struct pollfd *fds, nfds_t nfds, int timeout) { - timespec ts, *pts = Q_NULLPTR; + timespec ts, *pts = nullptr; if (timeout >= 0) { ts.tv_sec = timeout / 1000; diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 609e52d9d2..d1640bdc49 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -449,7 +449,7 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint , argv(aargv) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) , origArgc(0) - , origArgv(Q_NULLPTR) + , origArgv(nullptr) #endif , application_type(QCoreApplicationPrivate::Tty) #ifndef QT_NO_QOBJECT diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index 6555733c4e..a886c9d1d2 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -123,7 +123,7 @@ public: static bool sendEvent(QObject *receiver, QEvent *event); static void postEvent(QObject *receiver, QEvent *event, int priority = Qt::NormalEventPriority); - static void sendPostedEvents(QObject *receiver = Q_NULLPTR, int event_type = 0); + static void sendPostedEvents(QObject *receiver = nullptr, int event_type = 0); static void removePostedEvents(QObject *receiver, int eventType = 0); |