diff --git a/bin/syncqt.pl b/bin/syncqt.pl
index e741f22f655..02e55d847eb 100755
--- a/bin/syncqt.pl
+++ b/bin/syncqt.pl
@@ -1037,7 +1037,8 @@ foreach my $lib (@modules_to_sync) {
my $clean_header;
my $requires;
- my $iheader = $subdir . "/" . $header;
+ my $iheader_src = $subdir . "/" . $header;
+ my $iheader = $iheader_src;
$iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow);
if ($check_includes) {
# We need both $public_header and $private_header because QPA headers count as neither
@@ -1079,7 +1080,7 @@ foreach my $lib (@modules_to_sync) {
}
$header_copies++ if (!$shadow && syncHeader($lib, $oheader, $iheader, $copy_headers, $ts));
- my $pri_install_iheader = fixPaths($iheader, $dir);
+ my $pri_install_iheader = fixPaths($iheader_src, $dir);
my $injection = "";
if ($public_header) {
foreach my $class (@classes) {
diff --git a/config_help.txt b/config_help.txt
index ae0bb245204..08c2e7627f8 100644
--- a/config_help.txt
+++ b/config_help.txt
@@ -9,6 +9,12 @@ ICU_PREFIX=/opt/icu42 ICU_LIBS="-licui18n -licuuc -licudata".
It is also possible to manipulate any QMAKE_* variable, to amend the values
from the mkspec for the build of Qt itself, e.g., QMAKE_CXXFLAGS+=-g3.
+Note that the *_LIBS* and QMAKE_* assignments manipulate lists, so items
+containing meta characters (spaces in particular) need to be quoted according
+to qmake rules. On top of that, the assignments as a whole need to be quoted
+according to shell rules. It is recommended to use single quotes for the inner
+quoting and double quotes for the outer quoting.
+
Top-level installation directories:
-prefix
...... The deployment directory, as seen on the target device.
[/usr/local/Qt-$QT_VERSION, $PWD if -developer-build]
@@ -60,8 +66,10 @@ Configure meta:
-redo ................ Re-configure with previously used options.
Additional options may be passed, but will not be
saved for later use by -redo.
- -recheck ............. Discard cached negative configure test results.
+ -recheck [test,...] .. Discard cached negative configure test results.
Use this after installing missing dependencies.
+ Alternatively, if tests are specified, only their
+ results are discarded.
-recheck-all ......... Discard all cached configure test results.
-feature- ... Enable
diff --git a/configure.json b/configure.json
index 50d426594a1..a7b81494694 100644
--- a/configure.json
+++ b/configure.json
@@ -753,7 +753,7 @@
"sanitizer": {
"label": "Sanitizers",
"condition": "features.sanitize_address || features.sanitize_thread || features.sanitize_memory || features.sanitize_undefined",
- "output": [ "publicConfig" ]
+ "output": [ "sanitizer", "publicConfig" ]
},
"GNUmake": {
"label": "GNU make",
diff --git a/configure.pri b/configure.pri
index 8ce4aea9ca7..a67860fba02 100644
--- a/configure.pri
+++ b/configure.pri
@@ -580,7 +580,7 @@ defineTest(qtConfOutput_prepareOptions) {
else: \
qtConfFatalError("Cannot detect the Android host." \
"Please use -android-ndk-host option to specify one.")
- qtConfAddNotice("Available Android host does not match host architecture.")
+ qtConfAddNote("Available Android host does not match host architecture.")
}
} else {
!exists($$ndk_tc_pfx/$$ndk_host/*): \
@@ -899,6 +899,19 @@ defineTest(qtConfOutput_shared) {
export(CONFIG)
}
+defineTest(qtConfOutput_sanitizer) {
+ !$${2}: return()
+
+ # Export this here, so that WebEngine can access it at configure time.
+ CONFIG += sanitizer
+ $$qtConfEvaluate("features.sanitize_address"): CONFIG += sanitize_address
+ $$qtConfEvaluate("features.sanitize_thread"): CONFIG += sanitize_thread
+ $$qtConfEvaluate("features.sanitize_memory"): CONFIG += sanitize_memory
+ $$qtConfEvaluate("features.sanitize_undefined"): CONFIG += sanitize_undefined
+
+ export(CONFIG)
+}
+
defineTest(qtConfOutput_architecture) {
arch = $$qtConfEvaluate("tests.architecture.arch")
buildabi = $$qtConfEvaluate("tests.architecture.buildabi")
diff --git a/dist/changes-5.10.0 b/dist/changes-5.10.0
new file mode 100644
index 00000000000..002b58d3b4a
--- /dev/null
+++ b/dist/changes-5.10.0
@@ -0,0 +1,576 @@
+Qt 5.10 introduces many new features and improvements as well as bugfixes
+over the 5.9.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.10 series is binary compatible with the 5.9.x series.
+Applications compiled for 5.9 will continue to run with 5.10.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Important Behavior Changes *
+****************************************************************************
+
+ - [QTBUG-60857] The names of the roles returned by
+ QSqlQueryModel::roleNames now only include a name for the
+ Qt::DisplayRole. Previously all the roles names of QSqlQueryModel were
+ returned.
+ - QFileInfo on empty strings now behaves like the default-constructed
+ QFileInfo. Notably, path() will now be the empty string too, instead of
+ ".", which means absoluteFilePath() is no longer the current working
+ directory.
+
+ - QTemporaryFile:
+ * rename() no longer attempts to do block copying, as that usually
+ indicates a mistake in the user's code. Instead, either create the
+ temporary file in the same directory as the new name to be, or use
+ QSaveFile.
+ * On Linux, QTemporaryFile will attempt to create unnamed temporary
+ files. If that succeeds, open() will return true but exists() will be
+ false. If you call fileName() or any function that calls it,
+ QTemporaryFile will give the file a name, so most applications will
+ not see a difference.
+
+ - Windows:
+ * [QTBUG-62662] On Windows, a drag & drop operation of local file URIs,
+ like QListView items backed by a QFileSystemModel, will result in the
+ attachment or opening of the files by the target application, instead
+ of the creation of hyperlinks.
+
+****************************************************************************
+* General Notes *
+****************************************************************************
+
+Deprecation Notice
+------------------
+
+ - Starting with Qt 5.10, IPv6 support is mandatory for all platforms.
+ Systems without proper IPv6 support, such as the getaddrinfo() function
+ or the proper socket address structures, will not be able to build
+ QtNetwork anymore.
+
+ - QSignalMapper is now marked as deprecated.
+
+Potentially Source-Incompatible Changes
+---------------------------------------
+
+ - QByteArray:
+ * qbytearray.h no longer includes qstring.h. In particular, this means
+ that in order to use QStringBuilder with QByteArray, you need to
+ include both qbytearray.h and qstring.h now (or and
+ , resp.).
+
+ - QStaticText:
+ * The QStaticText(const QString &) constructor is now explicit.
+
+Third-Party Code
+----------------
+
+ - PCRE2 has been updated to version 10.30.
+ - Replaced bundled libjpeg by libjpeg-turbo 1.5.2
+ - Improve documentation about Freetype 2 licenses.
+ - Sqlite was updated to version 3.20.1
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+QtCore
+------
+
+ - Added qHash(QStringView).
+ - [QTBUG-37253] Added QMetaObject::invokeMethod() overloads for function
+ pointers.
+ - [QTBUG-41006] Added qEnvironmentVariable, which returns the value of an
+ environment variable in a QString, while qgetenv continues to be used to
+ return it in a QByteArray. For Unix, since most environment variables
+ seem to contain path names, qEnvironmentVariable will do the same as
+ QFile::decodeName, which means NFC/NFD conversion on Apple OSes.
+ - [QTBUG-62915] qAddPostRoutine() and qRemovePostRoutine() are now
+ thread-safe.
+
+ - Containers:
+ * Added an STL-like iterator to go through QHash/QMap returning both the
+ key and the value of the element pointed to. That lets QHash/QMap
+ interoperate better with stl's algorithms like std::set_union.
+
+ - JSON:
+ * QJsonArray, QJsonDocument, QJsonObject and QJsonValue now have move
+ operations and a swap() member function.
+
+ - Logging:
+ * If you set QT_FATAL_WARNINGS to a number n > 1, Qt will stop the
+ application on that n-th warning, instead of on the first. For the
+ sake of compatibility with previous versions, if the variable is set
+ to any non-empty and non-numeric value, Qt will understand it as "stop
+ on first warning".
+
+ - QByteArray:
+ * Added shrink_to_fit() for compatibility with the Standard Library. This
+ function does the same as squeeze().
+
+ - QChar:
+ * Added constructors from char16_t and, on Windows, wchar_t.
+
+ - QCoreApplication:
+ * [QTBUG-57095] Calling QCoreApplication::translate() is now
+ thread-safe.
+
+ - QCryptographicHash:
+ * [QTBUG-59770] In order to preserve compatibility with earlier versions
+ of Qt, QCryptographicHash is now able to calculate Keccak message
+ digests. Please see the release notes for Qt 5.9.2 for more details.
+
+ - QDate/QTime/QDateTime:
+ * Added toString() overloads taking the format as a QStringView.
+ * [QTBUG-22833] Added support for parsing of time-zones.
+
+ - QDebug:
+ * Added streaming of QStringViews.
+
+ - QFile:
+ * [QTBUG-984] Added fileTime() and setFileTime().
+
+ - QFileInfo:
+ * [QTBUG-984] Added fileTime().
+ * Deprecated created() because it could return one of three different
+ file times depending on the OS and filesystem type, without the
+ ability to determine which one is which. It is replaced by
+ metadataChangeTime() and birthTime().
+ * Added QFileInfo::metadataChangeTime(), which returns the time the
+ file's metadata was last changed, if it is known, and falling back to
+ the same value as lastModified() otherwise. On Unix systems, this
+ corresponds to the file's ctime.
+ * Added QFileInfo::birthTime(), which returns the file's birth time if
+ it is known, an invalid QDateTime otherwise. This function is
+ supported on Windows and on some Unix systems.
+
+ - QIODevice:
+ * Added skip() method to improve performance in read operations.
+
+ - QLatin1String:
+ * Added isEmpty(), isNull().
+ * Added iterators, {c,}{r,}{begin,end}().
+ * Added chopped(), chop(), truncate().
+ * Added startsWith(), endsWith().
+ * Added a constructor taking two pointers, complementing the constructor
+ that takes a pointer and a length.
+ * Added trimmed() function.
+
+ - QLocale:
+ * Added toString(QDate/QTime/QDateTime) overloads taking the format
+ string as a QStringView.
+ * Added QLocale::formattedDataSize() for formatting quantities of bytes
+ as kB, MB, GB etc.
+
+ - QLockFile:
+ * Fixed a bug that would cause QLockFile to mis-identify valid lock
+ files as stale if the application name was set with
+ QCoreApplication::setApplicationName().
+
+ - QMimeType:
+ * Add Q_GADGET, so that QML applications can make use of QMimeType's
+ properties and methods.
+
+ - QObject:
+ * [QTBUG-60339] Added connect() support for move-only function objects.
+
+ - QProcess:
+ * [QTBUG-2058][QTBUG-2284][QTBUG-37656][QTBUG-52405][QTBUG-57687] Added
+ non-static QProcess::startDetached to support more features for
+ detached processes.
+ * [QTBUG-2284] Added the ability to set a custom process environment for
+ detached processes.
+ * [QTBUG-52405] Added the ability to specify native arguments for
+ detached processes on Windows.
+ * [QTBUG-2058][QTBUG-37656] Added support for standard channel
+ redirection using setStandard{Input|Output|Error}File to
+ QProcess::startDetached.
+
+ - QSaveFile:
+ * [QTBUG-47379] Saving to Alternate Data Streams on NTFS on Windows is
+ now possible, but requires setDirectWriteFallback(true).
+
+ - QSemaphore:
+ * Added a new RAII class, QSemaphoreReleaser, to reliably perform
+ release() calls.
+
+ - QSettings:
+ * [QTBUG-47379] Added setAtomicSyncRequired(), which allows one to use
+ QSettings with config files in unwriteable directories or in Alternate
+ Data Streams on NTFS on Windows. This used to work before Qt 5.4, but
+ remains a non-default behavior due to the potential of data
+ corruption.
+
+ - QSortFilterProxyModel:
+ * QSortFilterProxyModel now does not emit an unnecessary layoutChanged()
+ following a model reset.
+
+ - QStandardPaths:
+ * On Windows, QStandardPaths now also looks into
+ "/data/" for non-generic paths.
+
+ - QString:
+ * Added arg(QStringView), arg(QLatin1String) overloads.
+ * Added shrink_to_fit(), for compatibility with the Standard
+ Library. This function does the same as squeeze().
+
+ - QString/QStringRef:
+ * Added startsWith(), endsWith() overloads taking QStringView.
+
+ - QString/QStringRef/QByteArray:
+ * Added chopped(n), a const version of chop(n).
+
+ - QString/QStringRef/QByteArray/QLatin1String:
+ * Added front() and back() for STL compatibility.
+
+ - QStringBuilder:
+ * Added support for (non-const) char*.
+
+ - QStringList:
+ * Added contains(QLatin1String) overload.
+
+ - QStringRef:
+ * trimmed() now returns an empty string-ref for an empty input. Before,
+ it would return a null one.
+
+ - QStringView:
+ * New class, superseding const QString and QStringRef as function
+ parameters, accepting a wide variety of UTF-16 string data sources,
+ e.g. u"string", std::u16string{,_view}, and, on Windows, L"string",
+ std::wstring{,_view} without converting to QString first.
+
+ - QTemporaryDir:
+ * The class now supports the "XXXXXX" replacement token anywhere in the
+ template, not just at the end. This behavior is similar to what
+ QTemporaryFile supports.
+
+ - QTextCodec:
+ * Added fromUnicode() and canEncode() overloads taking QStringView.
+
+ - QTextEncoder:
+ * Added fromUnicode() overload taking QStringView.
+
+ - QThread:
+ * Added the QThread::create() function.
+ * An exception escaping from QThread::run() will now result in immediate
+ and abnormal program termination. The same applies if an exception
+ leaves a slot connected directly to the QThread::started() or
+ QThread::finished() signals.
+
+ - QUuid:
+ * Added fromString(QStringView/QLatin1String).
+
+ - QVariant:
+ * QVariants containing pointers will now return true on isNull() if the
+ contained pointer is null.
+
+ - QVarLengthArray:
+ * Added shrink_to_fit(), for compatibility with the Standard Library.
+
+ - QVector:
+ * Added shrink_to_fit(), for compatibility with the Standard Library.
+
+ - QVersionNumber:
+ * Added QStringView and QLatin1String overloads of fromString().
+
+ - QtGlobal:
+ * Q_ASSERT() and Q_ASSERT_X() now always expand to expressions of type
+ void that are usable in constexpr contexts. This makes them usable in
+ both C++11 and C++14 constexpr functions and in comma expressions.
+
+QtGui
+-----
+
+ - [QTBUG-55981] Added support for rendering to QWindow via the Vulkan
+ graphics API.
+ - [QTBUG-55981] Added QVulkanWindow, a convenience subclass of QWindow.
+ - Added support for the OpenGL ES 3.2 API in QOpenGLExtraFunctions
+ - [QTBUG-50987] Added support for requesting OpenGL windows with
+ sRGB-capable default framebuffers. While this is implicit on some
+ platforms, QSurfaceFormat now has the necessary flags to request such
+ windows in a cross-platform manner.
+ - High DPI variants of 9-patch images can now be loaded using the
+ following syntax: "foo@2x.9.png"
+ - It's now possible to retrieve the screen at a given point via
+ QGuiApplication::screenAt().
+
+ - Important Behvior Changes:
+ * [QTBUG-56848][QTCREATORBUG-17683] Changed CSS line-height property
+ with multiplier to follow CSS spec
+
+ - Tablet support:
+ * [QTBUG-44964] If the application attribute AA_CompressTabletEvents is
+ set in addition to AA_CompressHighFrequencyEvents, even the
+ QTabletEvents will be compressed (only on the X11 platform so far).
+ AA_CompressHighFrequencyEvents does not enable compression of tablet
+ events by itself, because paint applications typically need to process
+ all possible tablet events in order to draw the smoothest curves.
+
+ - QPA:
+ * [QTBUG-57608] QWindowSystemInterfacePrivate::handleGeometryChange no
+ longer takes the old geometry as an argument.
+
+ - QImage:
+ * QImages can now use more than 2GByte of pixel data.
+
+ - QCursor:
+ * Added equality operators.
+
+ - QImageWriter:
+ * Add QImageWriter::InvalidImageError to communicate invalid attempts to
+ write a bad QImage (for instance, a null QImage).
+
+ - QMovie:
+ * Added lastError and lastErrorString accessors, as a convenience over
+ connecting to the error() signal.
+
+ - QWindow:
+ * setMask() no longer requires the window to be created to have an
+ effect; it can be set at any time.
+
+ - Text:
+ * [QTBUG-56728] Added QFont::PreferNoShaping style strategy to support
+ improvements to performance at the expense of some cosmetic font
+ features.
+
+ - Windows:
+ * [QTBUG-55967] Native menus have been implemented.
+ * A native system tray icon is now available for SystemTrayIcon.
+
+QtNetwork
+---------
+
+ - [QTBUG-56102] QSslSocket can now use a temporary keychain on macOS.
+ - Fixed a proxy-authentication issue, after a wrong password has been used,
+ when supplying the right password.
+
+ - HTTP/2:
+ * [QTBUG-61397] In case of clear text HTTP/2 we now initiate a required
+ protocol upgrade procedure instead of 'H2Direct' connection.
+
+ - QHostInfo:
+ * Added swap() and move operator.
+
+ - QLocalServer:
+ * [QTBUG-55043] Added a function to retrieve the socket descriptor.
+
+ - QNetworkAccessManager:
+ * [QTBUG-63075] Added support for HTTP status 308.
+
+ - QNetworkInterface:
+ * [QTBUG-51922] Changed allAddresses() to not include addresses found in
+ inactive interfaces, matching the user expectations of this function.
+ If those addresses are needed for some purpose, the application can
+ call allInterfaces() and obtain the addresses in each interface.
+
+ - QNetworkProxy:
+ * [QTBUG-45495] Setting of network proxies is now supported on UWP.
+ * [QTBUG-45495] UWP now supports proxies using SOCKS5.
+ * The functions related to QNetworkConfiguration are deprecated. They've
+ performed no action since Qt 5.0, so code using them can safely stop
+ doing so.
+
+ - QSslSocket:
+ * [QTBUG-52905] Added OpenSSL 1.1 backend.
+
+QtSql
+-----
+
+ - QSqlError:
+ * Added swap().
+
+ - SQLite:
+ * Named placeholder can now be used. If compiling Qt by hand and using
+ system libraries, this feature requires at least SQLite 3.3.11.
+ * [QTBUG-18084] Added QSQLITE_ENABLE_REGEXP connect option for the SQLite
+ backend. If set, a Qt based regexp() implementation is provided
+ allowing use of REGEXP in SQL statements.
+
+QtTest
+------
+
+ - [QTBUG-53381] Added keySequence() function.
+
+ - QCOMPARE:
+ * Can now be used for mixed-type comparisons.
+ * Now outputs contents of QPair and std::pair on failure.
+ * Now supports printing QStringViews in case of test failures.
+
+QtWidgets
+---------
+
+ - The windowsxp style is no longer available as a separate style, because
+ it did not (and cannot) actually provide an XP-style appearance on
+ currently supported Qt platforms.
+ - Added AA_DisableWindowContextHelpButton attribute. Setting this
+ attribute globally prevents the automatic "What's this" button on
+ dialogs on Windows (WindowsContextHelpButtonHint).
+ - [QTBUG-56860] Fixed widget losing focus after showing menu second time.
+ - [QTBUG-47185][QTBUG-61280] QOpenGLWidget is now able to render and
+ return its content via grabFramebuffer(), QWidget::grab() or
+ QWidget::render() even when the widget has not been made visible.
+ - [QTBUG-10907] When tabbing to a widget with focus proxy, focus will now
+ be given to the proxy rather than just being ignored.
+
+ - ItemViews:
+ * Made it easier to drop above and below items.
+
+ - QAbstractItemView/QTreeWidget/QTableWidget/QListWidget:
+ * [QTBUG-61139] Added isPersistentEditorOpen().
+
+ - QDockWidget:
+ * When QMainWindow::GrouppedDragging and QMainWindow::AllowNestedDocks
+ are both enabled, floating dock widgets now have the ability to be
+ dropped together side by side.
+ * [QTBUG-63526] Fixed an issue in QDockWidgets where the widget would
+ not resize despite showing a resize cursor.
+
+ - QFusionStyle:
+ * The default palette used by the platform-agnostic Fusion style has
+ been desaturated. Previously the window background color, and other
+ colors derived from it, were brown shades. Now these colors are
+ neutral gray that fit better on any desktop.
+
+ - QInputDialog:
+ * [QTBUG-17547] Added setDoubleStep to enable changing of the step
+ amount for getDouble().
+
+ - QLineEdit:
+ * Added selectionEnd(), selectionLength(), complementing
+ selectionStart().
+
+ - QOpenGLWidget:
+ * [QTBUG-50987] Added support for specifying custom internal texture
+ formats in QOpenGLWidget in order to make it possible to have the
+ widget backed by an sRGB-capable framebuffer.
+
+ - QSplashScreen:
+ * All constructors now implicitly set Qt::FramelessWindowHint, not just
+ the (pixmap, flags) one.
+
+ - QWidget:
+ * [QTBUG-10907] QWidget::setTabOrder() will now preserve the local tab
+ order inside a widget if it has a focus proxy set to an inner child.
+
+ - Styles:
+ * Added SH_Widget_Animation_Duration style hint which supersedes
+ SH_Widget_Animate, which is now deprecated.
+
+ - Text:
+ * Introduced tabStopDistance property in QTextOption, QTextEdit and
+ QPlainTextEdit as replacement for the inconsistently named tabStop and
+ tabStopWidth properties. QTextOption::tabStop, QTextEdit::tabStopWidth
+ and QPlainTextEdit::tabStopWidth are now deprecated.
+
+****************************************************************************
+* Platform-specific Changes *
+****************************************************************************
+
+ - [QTBUG-60268] Input context is now supported with the offscreen platform.
+
+Android
+-------
+
+ - QtLoader: Enabled loading shared libraries from /system/lib or a custom
+ path specified with the android.app.system_libs_prefix metadata variable in
+ AndroidManifest.xml. This supports deploying Qt apps as Android system
+ apps.
+ - [QTBUG-58060] Android dialogs now have more appropriate button layouts,
+ with affirmative actions on the right.
+ - [QTBUG-59175] QWidget::createWindowContainer() is now supported on
+ Android for embedding OpenGL-based QWindows into widget UIs.
+
+iOS
+---
+
+ - [QTBUG-59403] Support added for using the input panel as a trackpad
+ using two-finger swipe.
+ - The minimum deployment target for applications is now iOS 10.0.
+
+Linux
+-----
+
+ - Qt uses the statx(2) system call for obtaining file information on
+ kernels 4.12 and later. Some older container systems install system call
+ protection rules that do not include this system call. If you experience
+ problems running Qt applications inside containers (such as the report of
+ a file not existing when it does), ensure the statx(2) is allowed in the
+ container configuration.
+
+ - Linux/XCB:
+ * Added screen product information from EDID.
+
+ - eglfs/KMS:
+ * Screen modes, including current and preferred ones, are now listed.
+ * Added screen product information from EDID.
+
+Windows
+-------
+
+ - Accessibility:
+ * MinGW builds now support IAccessible2.
+
+ - Fonts:
+ * [QTBUG-62176] Some key fonts, such as Calibri, were being detected as
+ bitmap fonts and not rendered correctly in Qt Quick. This has now been
+ fixed.
+
+X11
+---
+
+ - Native painting (instead of software rasterization) has been experimentally
+ re-introduced. Enabled by the configure option -xcb-native-painting.
+ - XInput device property changes are now detected at runtime (no
+ application restart required).
+ - [QTBUG-60513][QTBUG-29278][QTBUG-43768][QTBUG-18380] The _NET_WORKAREA
+ atom is used for calculating QScreen::availableGeometry() only on systems
+ with one monitor. In all other cases QScreen::availableGeometry() is
+ equal to QScreen::geometry(). To restore the legacy behavior with
+ untrustworthy values in QScreen::availableGeometry() set
+ QT_RELY_ON_NET_WORKAREA_ATOM=1 in the environment.
+ - The QT_XCB_NO_XI2_MOUSE environment variable is deprecated and will be
+ removed in Qt 6. If your application relies on behavior set by
+ QT_XCB_NO_XI2_MOUSE, it should be updated accordingly.
+
+ - Pointer event delivery on X11 is now done starting from XInput version
+ 2.0 (when available) instead of 2.2. XInput support can be disabled by
+ setting QT_XCB_NO_XI2=1 in the environment; note that doing so will also
+ disable tablet and touch support.
+
+****************************************************************************
+* Tools *
+****************************************************************************
+
+moc
+---
+
+ - moc now supports NOTIFY signals of parent classes in Q_PROPERTY
+
+qmake
+-----
+
+ - [QTBUG-1581] Introduced the variable OBJECTIVE_HEADERS.
+ - [QTBUG-11117][nmake] Added support for precompiled header also for
+ plain C files.
+ - Added versionAtLeast() and versionAtMost() test functions.
+ - If you use CONFIG+=qmltestcase with no SOURCES, 'make check' will now
+ run qmltestrunner for you.
+ - [Darwin] Added support for Info.plist in non-bundle apps and libs.
+
+uic
+---
+
+ - [QTBUG-51602] Added the no-stringliteral option, to be used for building
+ shared objects which are meant to be unloadable.
+ - Old images embedded in ui files, imported from Qt 3, are now ignored.
+ uic will now behave consistently with Qt Designer - both will ignore
+ them.
diff --git a/doc/global/manifest-meta.qdocconf b/doc/global/manifest-meta.qdocconf
index 3b67049182a..3db67a3131c 100644
--- a/doc/global/manifest-meta.qdocconf
+++ b/doc/global/manifest-meta.qdocconf
@@ -30,26 +30,6 @@
manifestmeta.filters = highlighted android thumbnail ios
-manifestmeta.highlighted.names = "QtQuick/Qt Quick Demo - Same Game" \
- "QtQuick/Qt Quick Demo - Photo Surface" \
- "QtQuick/Qt Quick Demo - Tweet Search" \
- "QtQuick/Qt Quick Demo - Calqlatr" \
- "QtQuick/Qt Quick Demo - StocQt" \
- "QtQuick/Qt Quick Demo - Clocks" \
- "QtQuick/Qt Quick Examples - Shader Effects" \
- "QtQuickExtras/Qt Quick Extras - Dashboard" \
- "QtQuickExtras/Qt Quick Extras - Flat" \
- "QtQuickExtras/Qt Quick Extras - Gallery" \
- "QtQuickDialogs/Qt Quick System Dialog Examples" \
- "QtWinExtras/Quick Player" \
- "QtMultimedia/QML Video Shader Effects Example" \
- "QtCanvas3D/Interactive Mobile Phone Example" \
- "QtLocation/Map Viewer (QML)" \
- "QtBluetooth/Bluetooth Low Energy Heart Rate Game" \
- "QtCharts/Chart Themes Example" \
- "QtDataVisualization/Bars Example" \
- "QtDataVisualization/Surface Example"
-
manifestmeta.highlighted.attributes = isHighlighted:true
manifestmeta.android.names = "QtQuick/Qt Quick Demo - Calqlatr" \
diff --git a/doc/src/images/draggabletext-example.png b/doc/src/images/draggabletext-example.png
index f9b22816e64..8fe5ae4b10d 100644
Binary files a/doc/src/images/draggabletext-example.png and b/doc/src/images/draggabletext-example.png differ
diff --git a/doc/src/images/easing-example.png b/doc/src/images/easing-example.png
index de486670ce7..eefae8a6d01 100644
Binary files a/doc/src/images/easing-example.png and b/doc/src/images/easing-example.png differ
diff --git a/examples/network/multicastreceiver/receiver.cpp b/examples/network/multicastreceiver/receiver.cpp
index 8985ad1d827..d793242ad00 100644
--- a/examples/network/multicastreceiver/receiver.cpp
+++ b/examples/network/multicastreceiver/receiver.cpp
@@ -55,9 +55,10 @@
Receiver::Receiver(QWidget *parent)
: QDialog(parent),
- groupAddress(QStringLiteral("239.255.43.21"))
+ groupAddress4(QStringLiteral("239.255.43.21")),
+ groupAddress6(QStringLiteral("ff12::2115"))
{
- statusLabel = new QLabel(tr("Listening for multicasted messages"));
+ statusLabel = new QLabel(tr("Listening for multicast messages on both IPv4 and IPv6"));
auto quitButton = new QPushButton(tr("&Quit"));
auto buttonLayout = new QHBoxLayout;
@@ -72,21 +73,37 @@ Receiver::Receiver(QWidget *parent)
setWindowTitle(tr("Multicast Receiver"));
- udpSocket.bind(QHostAddress::AnyIPv4, 45454, QUdpSocket::ShareAddress);
- udpSocket.joinMulticastGroup(groupAddress);
+ udpSocket4.bind(QHostAddress::AnyIPv4, 45454, QUdpSocket::ShareAddress);
+ udpSocket4.joinMulticastGroup(groupAddress4);
- connect(&udpSocket, SIGNAL(readyRead()),
+ if (!udpSocket6.bind(QHostAddress::AnyIPv6, 45454, QUdpSocket::ShareAddress) ||
+ !udpSocket6.joinMulticastGroup(groupAddress6))
+ statusLabel->setText(tr("Listening for multicast messages on IPv4 only"));
+
+ connect(&udpSocket4, SIGNAL(readyRead()),
this, SLOT(processPendingDatagrams()));
+ connect(&udpSocket6, &QUdpSocket::readyRead, this, &Receiver::processPendingDatagrams);
connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
}
void Receiver::processPendingDatagrams()
{
QByteArray datagram;
- while (udpSocket.hasPendingDatagrams()) {
- datagram.resize(int(udpSocket.pendingDatagramSize()));
- udpSocket.readDatagram(datagram.data(), datagram.size());
- statusLabel->setText(tr("Received datagram: \"%1\"")
+
+ // using QUdpSocket::readDatagram (API since Qt 4)
+ while (udpSocket4.hasPendingDatagrams()) {
+ datagram.resize(int(udpSocket4.pendingDatagramSize()));
+ udpSocket4.readDatagram(datagram.data(), datagram.size());
+ statusLabel->setText(tr("Received IPv4 datagram: \"%1\"")
.arg(datagram.constData()));
}
+
+ // using QUdpSocket::receiveDatagram (API since Qt 5.8)
+ while (udpSocket6.hasPendingDatagrams()) {
+ QNetworkDatagram dgram = udpSocket6.receiveDatagram();
+ statusLabel->setText(statusLabel->text() +
+ tr("\nReceived IPv6 datagram from [%2]:%3: \"%1\"")
+ .arg(dgram.data().constData(), dgram.senderAddress().toString())
+ .arg(dgram.senderPort()));
+ }
}
diff --git a/examples/network/multicastreceiver/receiver.h b/examples/network/multicastreceiver/receiver.h
index 54927fdd634..0325d861df3 100644
--- a/examples/network/multicastreceiver/receiver.h
+++ b/examples/network/multicastreceiver/receiver.h
@@ -71,8 +71,10 @@ private slots:
private:
QLabel *statusLabel = nullptr;
- QUdpSocket udpSocket;
- QHostAddress groupAddress;
+ QUdpSocket udpSocket4;
+ QUdpSocket udpSocket6;
+ QHostAddress groupAddress4;
+ QHostAddress groupAddress6;
};
#endif
diff --git a/examples/network/multicastsender/sender.cpp b/examples/network/multicastsender/sender.cpp
index cb4bf456726..a542a2528f4 100644
--- a/examples/network/multicastsender/sender.cpp
+++ b/examples/network/multicastsender/sender.cpp
@@ -52,11 +52,21 @@
Sender::Sender(QWidget *parent)
: QDialog(parent),
- groupAddress(QStringLiteral("239.255.43.21"))
+ groupAddress4(QStringLiteral("239.255.43.21")),
+ groupAddress6(QStringLiteral("ff12::2115"))
{
- statusLabel = new QLabel(tr("Ready to multicast datagrams to group %1 on port 45454").arg(groupAddress.toString()));
+ // force binding to their respective families
+ udpSocket4.bind(QHostAddress(QHostAddress::AnyIPv4), 0);
+ udpSocket6.bind(QHostAddress(QHostAddress::AnyIPv6), udpSocket4.localPort());
- auto ttlLabel = new QLabel(tr("TTL for multicast datagrams:"));
+ QString msg = tr("Ready to multicast datagrams to groups %1 and [%2] on port 45454").arg(groupAddress4.toString());
+ if (udpSocket6.state() != QAbstractSocket::BoundState)
+ msg = tr("IPv6 failed. Ready to multicast datagrams to group %1 on port 45454").arg(groupAddress4.toString());
+ else
+ msg = msg.arg(groupAddress6.toString());
+ statusLabel = new QLabel(msg);
+
+ auto ttlLabel = new QLabel(tr("TTL for IPv4 multicast datagrams:"));
auto ttlSpinBox = new QSpinBox;
ttlSpinBox->setRange(0, 255);
@@ -88,7 +98,8 @@ Sender::Sender(QWidget *parent)
void Sender::ttlChanged(int newTtl)
{
- udpSocket.setSocketOption(QAbstractSocket::MulticastTtlOption, newTtl);
+ // we only set the TTL on the IPv4 socket, as that changes the multicast scope
+ udpSocket4.setSocketOption(QAbstractSocket::MulticastTtlOption, newTtl);
}
void Sender::startSending()
@@ -101,6 +112,8 @@ void Sender::sendDatagram()
{
statusLabel->setText(tr("Now sending datagram %1").arg(messageNo));
QByteArray datagram = "Multicast message " + QByteArray::number(messageNo);
- udpSocket.writeDatagram(datagram, groupAddress, 45454);
+ udpSocket4.writeDatagram(datagram, groupAddress4, 45454);
+ if (udpSocket6.state() == QAbstractSocket::BoundState)
+ udpSocket6.writeDatagram(datagram, groupAddress6, 45454);
++messageNo;
}
diff --git a/examples/network/multicastsender/sender.h b/examples/network/multicastsender/sender.h
index 5d8769790e4..0af6f9aaeca 100644
--- a/examples/network/multicastsender/sender.h
+++ b/examples/network/multicastsender/sender.h
@@ -70,9 +70,11 @@ private slots:
private:
QLabel *statusLabel = nullptr;
QPushButton *startButton = nullptr;
- QUdpSocket udpSocket;
+ QUdpSocket udpSocket4;
+ QUdpSocket udpSocket6;
QTimer timer;
- QHostAddress groupAddress;
+ QHostAddress groupAddress4;
+ QHostAddress groupAddress6;
int messageNo = 1;
};
diff --git a/examples/widgets/animation/easing/images/qt-logo.png b/examples/widgets/animation/easing/images/qt-logo.png
index 6b72d5fb72c..d10bd0bdf92 100644
Binary files a/examples/widgets/animation/easing/images/qt-logo.png and b/examples/widgets/animation/easing/images/qt-logo.png differ
diff --git a/examples/widgets/dialogs/configdialog/configdialog.cpp b/examples/widgets/dialogs/configdialog/configdialog.cpp
deleted file mode 100644
index 5a0fb1c3bc5..00000000000
--- a/examples/widgets/dialogs/configdialog/configdialog.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include
-
-#include "configdialog.h"
-#include "pages.h"
-
-ConfigDialog::ConfigDialog()
-{
- contentsWidget = new QListWidget;
- contentsWidget->setViewMode(QListView::IconMode);
- contentsWidget->setIconSize(QSize(96, 84));
- contentsWidget->setMovement(QListView::Static);
- contentsWidget->setMaximumWidth(128);
- contentsWidget->setSpacing(12);
-
- pagesWidget = new QStackedWidget;
- pagesWidget->addWidget(new ConfigurationPage);
- pagesWidget->addWidget(new UpdatePage);
- pagesWidget->addWidget(new QueryPage);
-
- QPushButton *closeButton = new QPushButton(tr("Close"));
-
- createIcons();
- contentsWidget->setCurrentRow(0);
-
- connect(closeButton, &QAbstractButton::clicked, this, &QWidget::close);
-
- QHBoxLayout *horizontalLayout = new QHBoxLayout;
- horizontalLayout->addWidget(contentsWidget);
- horizontalLayout->addWidget(pagesWidget, 1);
-
- QHBoxLayout *buttonsLayout = new QHBoxLayout;
- buttonsLayout->addStretch(1);
- buttonsLayout->addWidget(closeButton);
-
- QVBoxLayout *mainLayout = new QVBoxLayout;
- mainLayout->addLayout(horizontalLayout);
- mainLayout->addStretch(1);
- mainLayout->addSpacing(12);
- mainLayout->addLayout(buttonsLayout);
- setLayout(mainLayout);
-
- setWindowTitle(tr("Config Dialog"));
-}
-
-void ConfigDialog::createIcons()
-{
- QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
- configButton->setIcon(QIcon(":/images/config.png"));
- configButton->setText(tr("Configuration"));
- configButton->setTextAlignment(Qt::AlignHCenter);
- configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-
- QListWidgetItem *updateButton = new QListWidgetItem(contentsWidget);
- updateButton->setIcon(QIcon(":/images/update.png"));
- updateButton->setText(tr("Update"));
- updateButton->setTextAlignment(Qt::AlignHCenter);
- updateButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-
- QListWidgetItem *queryButton = new QListWidgetItem(contentsWidget);
- queryButton->setIcon(QIcon(":/images/query.png"));
- queryButton->setText(tr("Query"));
- queryButton->setTextAlignment(Qt::AlignHCenter);
- queryButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-
- connect(contentsWidget, &QListWidget::currentItemChanged, this, &ConfigDialog::changePage);
-}
-
-void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
-{
- if (!current)
- current = previous;
-
- pagesWidget->setCurrentIndex(contentsWidget->row(current));
-}
diff --git a/examples/widgets/dialogs/configdialog/configdialog.pro b/examples/widgets/dialogs/configdialog/configdialog.pro
deleted file mode 100644
index 8ba55becadd..00000000000
--- a/examples/widgets/dialogs/configdialog/configdialog.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-QT += widgets
-
-HEADERS = configdialog.h \
- pages.h
-SOURCES = configdialog.cpp \
- main.cpp \
- pages.cpp
-RESOURCES += configdialog.qrc
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/configdialog
-INSTALLS += target
diff --git a/examples/widgets/dialogs/configdialog/configdialog.qrc b/examples/widgets/dialogs/configdialog/configdialog.qrc
deleted file mode 100644
index 31d0d49666b..00000000000
--- a/examples/widgets/dialogs/configdialog/configdialog.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- images/config.png
- images/query.png
- images/update.png
-
-
diff --git a/examples/widgets/dialogs/configdialog/images/config.png b/examples/widgets/dialogs/configdialog/images/config.png
deleted file mode 100644
index 5c14d5f4707..00000000000
Binary files a/examples/widgets/dialogs/configdialog/images/config.png and /dev/null differ
diff --git a/examples/widgets/dialogs/configdialog/images/query.png b/examples/widgets/dialogs/configdialog/images/query.png
deleted file mode 100644
index ea9e291eeb5..00000000000
Binary files a/examples/widgets/dialogs/configdialog/images/query.png and /dev/null differ
diff --git a/examples/widgets/dialogs/configdialog/images/update.png b/examples/widgets/dialogs/configdialog/images/update.png
deleted file mode 100644
index 3cb8ba6c77f..00000000000
Binary files a/examples/widgets/dialogs/configdialog/images/update.png and /dev/null differ
diff --git a/examples/widgets/dialogs/configdialog/pages.cpp b/examples/widgets/dialogs/configdialog/pages.cpp
deleted file mode 100644
index 0c7762f029e..00000000000
--- a/examples/widgets/dialogs/configdialog/pages.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include
-
-#include "pages.h"
-
-ConfigurationPage::ConfigurationPage(QWidget *parent)
- : QWidget(parent)
-{
- QGroupBox *configGroup = new QGroupBox(tr("Server configuration"));
-
- QLabel *serverLabel = new QLabel(tr("Server:"));
- QComboBox *serverCombo = new QComboBox;
- serverCombo->addItem(tr("Qt (Australia)"));
- serverCombo->addItem(tr("Qt (Germany)"));
- serverCombo->addItem(tr("Qt (Norway)"));
- serverCombo->addItem(tr("Qt (People's Republic of China)"));
- serverCombo->addItem(tr("Qt (USA)"));
-
- QHBoxLayout *serverLayout = new QHBoxLayout;
- serverLayout->addWidget(serverLabel);
- serverLayout->addWidget(serverCombo);
-
- QVBoxLayout *configLayout = new QVBoxLayout;
- configLayout->addLayout(serverLayout);
- configGroup->setLayout(configLayout);
-
- QVBoxLayout *mainLayout = new QVBoxLayout;
- mainLayout->addWidget(configGroup);
- mainLayout->addStretch(1);
- setLayout(mainLayout);
-}
-
-UpdatePage::UpdatePage(QWidget *parent)
- : QWidget(parent)
-{
- QGroupBox *updateGroup = new QGroupBox(tr("Package selection"));
- QCheckBox *systemCheckBox = new QCheckBox(tr("Update system"));
- QCheckBox *appsCheckBox = new QCheckBox(tr("Update applications"));
- QCheckBox *docsCheckBox = new QCheckBox(tr("Update documentation"));
-
- QGroupBox *packageGroup = new QGroupBox(tr("Existing packages"));
-
- QListWidget *packageList = new QListWidget;
- QListWidgetItem *qtItem = new QListWidgetItem(packageList);
- qtItem->setText(tr("Qt"));
- QListWidgetItem *qsaItem = new QListWidgetItem(packageList);
- qsaItem->setText(tr("QSA"));
- QListWidgetItem *teamBuilderItem = new QListWidgetItem(packageList);
- teamBuilderItem->setText(tr("Teambuilder"));
-
- QPushButton *startUpdateButton = new QPushButton(tr("Start update"));
-
- QVBoxLayout *updateLayout = new QVBoxLayout;
- updateLayout->addWidget(systemCheckBox);
- updateLayout->addWidget(appsCheckBox);
- updateLayout->addWidget(docsCheckBox);
- updateGroup->setLayout(updateLayout);
-
- QVBoxLayout *packageLayout = new QVBoxLayout;
- packageLayout->addWidget(packageList);
- packageGroup->setLayout(packageLayout);
-
- QVBoxLayout *mainLayout = new QVBoxLayout;
- mainLayout->addWidget(updateGroup);
- mainLayout->addWidget(packageGroup);
- mainLayout->addSpacing(12);
- mainLayout->addWidget(startUpdateButton);
- mainLayout->addStretch(1);
- setLayout(mainLayout);
-}
-
-QueryPage::QueryPage(QWidget *parent)
- : QWidget(parent)
-{
- QGroupBox *packagesGroup = new QGroupBox(tr("Look for packages"));
-
- QLabel *nameLabel = new QLabel(tr("Name:"));
- QLineEdit *nameEdit = new QLineEdit;
-
- QLabel *dateLabel = new QLabel(tr("Released after:"));
- QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate());
-
- QCheckBox *releasesCheckBox = new QCheckBox(tr("Releases"));
- QCheckBox *upgradesCheckBox = new QCheckBox(tr("Upgrades"));
-
- QSpinBox *hitsSpinBox = new QSpinBox;
- hitsSpinBox->setPrefix(tr("Return up to "));
- hitsSpinBox->setSuffix(tr(" results"));
- hitsSpinBox->setSpecialValueText(tr("Return only the first result"));
- hitsSpinBox->setMinimum(1);
- hitsSpinBox->setMaximum(100);
- hitsSpinBox->setSingleStep(10);
-
- QPushButton *startQueryButton = new QPushButton(tr("Start query"));
-
- QGridLayout *packagesLayout = new QGridLayout;
- packagesLayout->addWidget(nameLabel, 0, 0);
- packagesLayout->addWidget(nameEdit, 0, 1);
- packagesLayout->addWidget(dateLabel, 1, 0);
- packagesLayout->addWidget(dateEdit, 1, 1);
- packagesLayout->addWidget(releasesCheckBox, 2, 0);
- packagesLayout->addWidget(upgradesCheckBox, 3, 0);
- packagesLayout->addWidget(hitsSpinBox, 4, 0, 1, 2);
- packagesGroup->setLayout(packagesLayout);
-
- QVBoxLayout *mainLayout = new QVBoxLayout;
- mainLayout->addWidget(packagesGroup);
- mainLayout->addSpacing(12);
- mainLayout->addWidget(startQueryButton);
- mainLayout->addStretch(1);
- setLayout(mainLayout);
-}
diff --git a/examples/widgets/dialogs/configdialog/pages.h b/examples/widgets/dialogs/configdialog/pages.h
deleted file mode 100644
index beb7f86ae02..00000000000
--- a/examples/widgets/dialogs/configdialog/pages.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PAGES_H
-#define PAGES_H
-
-#include
-
-class ConfigurationPage : public QWidget
-{
-public:
- ConfigurationPage(QWidget *parent = 0);
-};
-
-class QueryPage : public QWidget
-{
-public:
- QueryPage(QWidget *parent = 0);
-};
-
-class UpdatePage : public QWidget
-{
-public:
- UpdatePage(QWidget *parent = 0);
-};
-
-#endif
diff --git a/examples/widgets/dialogs/dialogs.pro b/examples/widgets/dialogs/dialogs.pro
index a29903938e4..753308fc557 100644
--- a/examples/widgets/dialogs/dialogs.pro
+++ b/examples/widgets/dialogs/dialogs.pro
@@ -2,7 +2,6 @@ QT_FOR_CONFIG += widgets
TEMPLATE = subdirs
SUBDIRS = classwizard \
- configdialog \
extension \
findfiles \
licensewizard \
diff --git a/examples/widgets/dialogs/findfiles/window.cpp b/examples/widgets/dialogs/findfiles/window.cpp
index f2ce853d993..1b16cdcd350 100644
--- a/examples/widgets/dialogs/findfiles/window.cpp
+++ b/examples/widgets/dialogs/findfiles/window.cpp
@@ -74,6 +74,7 @@ static inline void openFile(const QString &fileName)
Window::Window(QWidget *parent)
: QWidget(parent)
{
+ setWindowTitle(tr("Find Files"));
QPushButton *browseButton = new QPushButton(tr("&Browse..."), this);
connect(browseButton, &QAbstractButton::clicked, this, &Window::browse);
findButton = new QPushButton(tr("&Find"), this);
@@ -92,9 +93,7 @@ Window::Window(QWidget *parent)
filesFoundLabel = new QLabel;
createFilesTable();
-//! [0]
-//! [1]
QGridLayout *mainLayout = new QGridLayout(this);
mainLayout->addWidget(new QLabel(tr("Named:")), 0, 0);
mainLayout->addWidget(fileComboBox, 0, 1, 1, 2);
@@ -106,12 +105,13 @@ Window::Window(QWidget *parent)
mainLayout->addWidget(filesTable, 3, 0, 1, 3);
mainLayout->addWidget(filesFoundLabel, 4, 0, 1, 2);
mainLayout->addWidget(findButton, 4, 2);
+//! [0]
- setWindowTitle(tr("Find Files"));
- const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
- resize(screenGeometry.width() / 2, screenGeometry.height() / 3);
-}
//! [1]
+ connect(new QShortcut(QKeySequence::Quit, this), &QShortcut::activated,
+ qApp, &QApplication::quit);
+//! [1]
+}
//! [2]
void Window::browse()
@@ -133,21 +133,7 @@ static void updateComboBox(QComboBox *comboBox)
comboBox->addItem(comboBox->currentText());
}
-//! [13]
-
-static void findRecursion(const QString &path, const QString &pattern, QStringList *result)
-{
- QDir currentDir(path);
- const QString prefix = path + QLatin1Char('/');
- foreach (const QString &match, currentDir.entryList(QStringList(pattern), QDir::Files | QDir::NoSymLinks))
- result->append(prefix + match);
- foreach (const QString &dir, currentDir.entryList(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot))
- findRecursion(prefix + dir, pattern, result);
-}
-
-//! [13]
//! [3]
-
void Window::find()
{
filesTable->setRowCount(0);
@@ -155,6 +141,7 @@ void Window::find()
QString fileName = fileComboBox->currentText();
QString text = textComboBox->currentText();
QString path = QDir::cleanPath(directoryComboBox->currentText());
+ currentDir = QDir(path);
//! [3]
updateComboBox(fileComboBox);
@@ -162,12 +149,16 @@ void Window::find()
updateComboBox(directoryComboBox);
//! [4]
-
- currentDir = QDir(path);
+ QStringList filter;
+ if (!fileName.isEmpty())
+ filter << fileName;
+ QDirIterator it(path, filter, QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
QStringList files;
- findRecursion(path, fileName.isEmpty() ? QStringLiteral("*") : fileName, &files);
+ while (it.hasNext())
+ files << it.next();
if (!text.isEmpty())
files = findFiles(files, text);
+ files.sort();
showFiles(files);
}
//! [4]
@@ -225,20 +216,18 @@ QStringList Window::findFiles(const QStringList &files, const QString &text)
//! [7]
//! [8]
-void Window::showFiles(const QStringList &files)
+void Window::showFiles(const QStringList &paths)
{
- for (int i = 0; i < files.size(); ++i) {
- const QString &fileName = files.at(i);
- const QString toolTip = QDir::toNativeSeparators(fileName);
- const QString relativePath = QDir::toNativeSeparators(currentDir.relativeFilePath(fileName));
- const qint64 size = QFileInfo(fileName).size();
+ for (const QString &filePath : paths) {
+ const QString toolTip = QDir::toNativeSeparators(filePath);
+ const QString relativePath = QDir::toNativeSeparators(currentDir.relativeFilePath(filePath));
+ const qint64 size = QFileInfo(filePath).size();
QTableWidgetItem *fileNameItem = new QTableWidgetItem(relativePath);
- fileNameItem->setData(absoluteFileNameRole, QVariant(fileName));
+ fileNameItem->setData(absoluteFileNameRole, QVariant(filePath));
fileNameItem->setToolTip(toolTip);
fileNameItem->setFlags(fileNameItem->flags() ^ Qt::ItemIsEditable);
- QTableWidgetItem *sizeItem = new QTableWidgetItem(tr("%1 KB")
- .arg(int((size + 1023) / 1024)));
- sizeItem->setData(absoluteFileNameRole, QVariant(fileName));
+ QTableWidgetItem *sizeItem = new QTableWidgetItem(QLocale().formattedDataSize(size));
+ sizeItem->setData(absoluteFileNameRole, QVariant(filePath));
sizeItem->setToolTip(toolTip);
sizeItem->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
sizeItem->setFlags(sizeItem->flags() ^ Qt::ItemIsEditable);
@@ -248,7 +237,7 @@ void Window::showFiles(const QStringList &files)
filesTable->setItem(row, 0, fileNameItem);
filesTable->setItem(row, 1, sizeItem);
}
- filesFoundLabel->setText(tr("%n file(s) found (Double click on a file to open it)", 0, files.size()));
+ filesFoundLabel->setText(tr("%n file(s) found (Double click on a file to open it)", 0, paths.size()));
filesFoundLabel->setWordWrap(true);
}
//! [8]
diff --git a/examples/widgets/dialogs/findfiles/window.h b/examples/widgets/dialogs/findfiles/window.h
index fe217381e2f..949df704bb8 100644
--- a/examples/widgets/dialogs/findfiles/window.h
+++ b/examples/widgets/dialogs/findfiles/window.h
@@ -79,7 +79,7 @@ private slots:
private:
QStringList findFiles(const QStringList &files, const QString &text);
- void showFiles(const QStringList &files);
+ void showFiles(const QStringList &paths);
QComboBox *createComboBox(const QString &text = QString());
void createFilesTable();
diff --git a/examples/widgets/doc/images/graphicssimpleanchorlayout-example.png b/examples/widgets/doc/images/graphicssimpleanchorlayout-example.png
index 543670e05c8..e4bed44edf6 100644
Binary files a/examples/widgets/doc/images/graphicssimpleanchorlayout-example.png and b/examples/widgets/doc/images/graphicssimpleanchorlayout-example.png differ
diff --git a/examples/widgets/doc/images/notepad.png b/examples/widgets/doc/images/notepad.png
new file mode 100644
index 00000000000..40d13269b90
Binary files /dev/null and b/examples/widgets/doc/images/notepad.png differ
diff --git a/examples/widgets/doc/images/notepad1.png b/examples/widgets/doc/images/notepad1.png
new file mode 100644
index 00000000000..40d13269b90
Binary files /dev/null and b/examples/widgets/doc/images/notepad1.png differ
diff --git a/examples/widgets/doc/images/notepad2.png b/examples/widgets/doc/images/notepad2.png
new file mode 100644
index 00000000000..9cec1f9a581
Binary files /dev/null and b/examples/widgets/doc/images/notepad2.png differ
diff --git a/examples/widgets/doc/images/notepad3.png b/examples/widgets/doc/images/notepad3.png
new file mode 100644
index 00000000000..426861ab068
Binary files /dev/null and b/examples/widgets/doc/images/notepad3.png differ
diff --git a/examples/widgets/doc/images/notepad4.png b/examples/widgets/doc/images/notepad4.png
new file mode 100644
index 00000000000..fc08eab204e
Binary files /dev/null and b/examples/widgets/doc/images/notepad4.png differ
diff --git a/examples/widgets/doc/images/notepad_menu.png b/examples/widgets/doc/images/notepad_menu.png
new file mode 100644
index 00000000000..2dd771111a7
Binary files /dev/null and b/examples/widgets/doc/images/notepad_menu.png differ
diff --git a/examples/widgets/doc/src/configdialog.qdoc b/examples/widgets/doc/src/configdialog.qdoc
deleted file mode 100644
index 9f2cc21adbc..00000000000
--- a/examples/widgets/doc/src/configdialog.qdoc
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example dialogs/configdialog
- \title Config Dialog Example
- \ingroup examples-dialogs
-
- \brief The Config Dialog examples shows how a configuration dialog can be created by
- using an icon view with a stacked widget.
-
- \image configdialog-example.png
-*/
diff --git a/examples/widgets/doc/src/draggabletext.qdoc b/examples/widgets/doc/src/draggabletext.qdoc
index c4a694028b9..97b2f036bde 100644
--- a/examples/widgets/doc/src/draggabletext.qdoc
+++ b/examples/widgets/doc/src/draggabletext.qdoc
@@ -28,6 +28,7 @@
/*!
\example draganddrop/draggabletext
\title Draggable Text Example
+ \brief Illustrates how to drag and drop text between widgets
\brief The Draggable Text example shows how to drag and drop textual data between widgets
in the same application, and between different applications.
diff --git a/examples/widgets/doc/src/easing.qdoc b/examples/widgets/doc/src/easing.qdoc
index 3a9727d3933..807dd72e933 100644
--- a/examples/widgets/doc/src/easing.qdoc
+++ b/examples/widgets/doc/src/easing.qdoc
@@ -34,4 +34,7 @@
\image easing-example.png
+ See \l QEasingCurve for a detailed description on how to use the class's
+ functionalities.
+
*/
diff --git a/examples/widgets/doc/src/findfiles.qdoc b/examples/widgets/doc/src/findfiles.qdoc
index b8363dc698e..a2eb326519b 100644
--- a/examples/widgets/doc/src/findfiles.qdoc
+++ b/examples/widgets/doc/src/findfiles.qdoc
@@ -74,19 +74,23 @@
\snippet dialogs/findfiles/window.cpp 0
- We create the application's buttons using the private \c
- createButton() function. Then we create the comboboxes associated
- with the search specifications, using the private \c
- createComboBox() function. We also create the application's labels
- before we use the private \c createFilesTable() function to create
- the table displaying the search results.
+ We create the widgets to build up the UI, and we add them to a main layout
+ using QGridLayout. We have, however, put the \c Find and \c Quit buttons
+ and a stretchable space in a separate \l QHBoxLayout first, to make the
+ buttons appear in the \c Window widget's bottom right corner.
+
+ Alternatively, we could have used Qt Designer to construct a UI file,
+ and \l {uic} to generate this code.
\snippet dialogs/findfiles/window.cpp 1
- Then we add all the widgets to a main layout using QGridLayout. We
- have, however, put the \c Find and \c Quit buttons and a
- stretchable space in a separate QHBoxLayout first, to make the
- buttons appear in the \c Window widget's bottom right corner.
+ We did not create a \l QMenuBar with a \uicontrol Quit menu item; but we
+ would still like to have a keyboard shortcut for quitting. Since we
+ construct a \l QShortcut with \l QKeySequence::Quit, and connect it to
+ \l QApplication::quit(), on most platforms it will be possible to press
+ Control-Q to quit (or whichever standard Quit key is configured on that platform).
+ (On \macos, this is redundant, because every application gets a
+ \uicontrol Quit menu item automatically; but it helps to make the application portable.)
\snippet dialogs/findfiles/window.cpp 2
@@ -122,18 +126,16 @@
We use the directory's path to create a QDir; the QDir class
provides access to directory structures and their contents.
- \snippet dialogs/findfiles/window.cpp 13
-
- We recursively create a list of the files (contained in the newl
- created QDir) that match the specified file name.
+ We use QDirIterator to iterate over the files that match the
+ specified file name and build a QStringList of paths.
Then we search through all the files in the list, using the private
- \c findFiles() function, eliminating the ones that don't contain
- the specified text. And finally, we display the results using the
- private \c showFiles() function.
+ \c findFiles() function, eliminating the ones that don't contain the
+ specified text. We sort them (because QDirIterator did not). And finally,
+ we display the results using the private \c showFiles() function.
If the user didn't specify any text, there is no reason to search
- through the files, and we display the results immediately.
+ through the files, so we sort and display the results immediately.
\image findfiles_progress_dialog.png Screenshot of the Progress Dialog
@@ -196,7 +198,8 @@
the \c find() slot. In the \c showFiles() function we run through
the provided list of file names, adding each relative file name to the
first column in the table widget and retrieving the file's size using
- QFileInfo for the second column. For later use, we set
+ QFileInfo for the second column. We use \l QLocale::formattedDataSize()
+ to format the file size in a human-readable form. For later use, we set
the absolute path as a data on the QTableWidget using the
the role absoluteFileNameRole defined to be Qt::UserRole + 1.
diff --git a/examples/widgets/doc/src/graphicsview-simpleanchorlayout.qdoc b/examples/widgets/doc/src/graphicsview-simpleanchorlayout.qdoc
index 866dac442b7..fd0427fdc03 100644
--- a/examples/widgets/doc/src/graphicsview-simpleanchorlayout.qdoc
+++ b/examples/widgets/doc/src/graphicsview-simpleanchorlayout.qdoc
@@ -35,4 +35,50 @@
QGraphicsAnchorLayout class.
\image graphicssimpleanchorlayout-example.png
+
+ The example starts by creating a QGraphicsScene (\c scene), 3 widgets
+ (\c a, \c b, and \c c), and a QGraphicsAnchorlayout (\c layout).
+
+ \quotefromfile graphicsview/simpleanchorlayout/main.cpp
+ \skipto QGraphicsScene
+ \printuntil QGraphicsAnchorLayout
+
+ First it anchors the top left corner of item \c a to the top left
+ corner of \c layout. This can be done in two steps:
+
+ \skipto layout->addAnchor(a
+ \printto adding
+
+ Or in one step:
+
+ \skipuntil [adding a corner anchor]
+ \printline layout->addCornerAnchors(a, Qt::T
+
+ Then the right anchor of \c a is anchored to the left anchor of
+ \c b, and the top of item \c b is anchored to the bottom of \c a.
+
+ \skipuntil [adding anchors]
+ \printto adding anchors
+
+ Place a third widget \c c under widget \c b:
+
+ \skipuntil third widget
+ \printline AnchorBottom
+
+ Items \c b and \c c are anchored to each other horizontally:
+
+ \skipto Qt::Horizontal
+ \printline Qt::Horizontal
+
+ Item c is anchored to the bottom right point of \c layout
+
+ \skipuntil corner of the layout
+ \printline Qt::BottomRightCorner
+
+ Finally, QGraphicsWidget \c w is displayed in QGraphicsView \c view.
+
+ \skipto QGraphicsWidget
+ \printuntil app.exec()
+
+ \sa {Anchor Layout Example}
*/
diff --git a/examples/widgets/tutorials/gettingstartedqt.qdoc b/examples/widgets/tutorials/gettingstartedqt.qdoc
new file mode 100644
index 00000000000..921dd7a32d4
--- /dev/null
+++ b/examples/widgets/tutorials/gettingstartedqt.qdoc
@@ -0,0 +1,559 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example tutorials/notepad
+ \title Getting Started Programming with Qt Widgets
+ \brief A tutorial for Qt Widgets based on a notepad application
+
+ In this topic, we teach basic Qt knowledge by implementing a simple
+ Notepad application using C++ and the \l{Qt Widgets} module. The
+ application is a small text editor which allows you to create a text
+ file, save it, print it,
+ or reopen and edit it again. You can also set the font to be used.
+
+ \image notepad1.png "Notepad application"
+
+ You can find the final Notepad source files in the qtdoc repository
+ in the tutorials/notepad directory. You can either fetch
+ the Qt 5 sources from Qt Project or install them as part of Qt 5.
+ The application is also available in the example list of Qt Creator's
+ Welcome mode.
+
+ \section1 Creating the Notepad Project
+
+ Setting up a new project in Qt Creator is aided by a wizard that
+ guides you step-by-step through the project creation process. The
+ wizard prompts you to enter the settings needed for that particular
+ type of project and creates the project for you.
+
+ \image notepad2.png "Qt Creator New File or Project dialog"
+
+ To create the Notepad project, select \b File > \b{New File or
+ Project} > \b Applications > \b {Qt Widgets Application} > \b Choose,
+ and follow the instructions of the wizard. In the
+ \b{Class Information}
+ dialog, type \b Notepad as the class name and select \b QMainWindow
+ as the base class.
+
+ \image notepad3.png "Class Information Dialog"
+
+ The \b {Qt Widgets Application} wizard creates a project that contains
+ a main source file and a set of files that specify a user interface
+ (Notepad widget):
+
+ \list
+ \li notepad.pro - the project file.
+ \li main.cpp - the main source file for the application.
+ \li notepad.cpp - the source file of the notepad class of the
+ Notepad widget.
+ \li notepad.h - the header file of the notepad class for the
+ Notepad widget.
+ \li notepad.ui - the UI form for the Notepad widget.
+ \endlist
+
+ The .cpp, .h, and .ui files come with the necessary boiler plate code
+ for you to be able to build and run the project. The .pro file is
+ complete.
+ We will take a closer look at the file contents in the following
+ sections.
+
+ \b{Learn More}
+
+ \table
+ \header
+ \li About
+ \li Here
+ \row
+ \li Using Qt Creator
+ \li \l{Qt Creator Manual}{Qt Creator}
+ \row
+ \li Creating other kind of applications with Qt Creator
+ \li \l{Qt Creator: Tutorials}{Qt Creator Tutorials}
+ \endtable
+
+
+ \section1 Main Source File
+
+ The wizard generates the following code in the main.cpp file:
+
+ \quotefromfile tutorials/notepad/main.cpp
+ \skipto "notepad.h"
+ \printuntil EditorApp.exec()
+ \printuntil }
+
+ We will go through the code line by line. The following lines include
+ the header files for the Notepad widget and QApplication. All Qt classes
+ have a header file named after them.
+
+ \quotefromfile tutorials/notepad/main.cpp
+ \skipto notepad.h
+ \printuntil QApplication
+
+ The following line defines the main function that is the entry point
+ for all C and C++ based applications:
+
+ \printline main
+
+ The following line creates a QApplication object. This object manages
+ application-wide resources and is necessary to run any Qt program
+ that uses Qt Widgets. It constructs an application object with \c argc
+ command line arguments run in \c argv. (For GUI applications that
+ do not use Qt Widgets, you can use QGuiApplication instead.)
+
+ \skipuntil {
+ \printuntil QApplication
+
+ The following line creates the Notepad object. This is the object for
+ which the wizard created the class and the UI file. The user interface
+ contains visual elements that are called \c widgets in Qt. Examples
+ of widgets are text edits, scroll bars, labels, and radio buttons. A
+ widget can also be a container for other widgets; a dialog or a main
+ application window, for example.
+
+ \printline Notepad
+
+ The following line shows the Notepad widget on the screen in its own
+ window. Widgets can also function as containers. An example of this
+ is QMainWindow which often contains several types of widgets. Widgets
+ are not visible by default; the function \l{QWidget::}{show()} makes
+ the widget visible.
+
+ \printline Editor.show
+
+ The following line makes the QApplication enter its event loop. When
+ a Qt application is running, events are generated and sent to the
+ widgets of the application. Examples of events are mouse presses
+ and key strokes.
+
+ \printline EditorApp.exec
+
+ \b{Learn More}
+
+ \table
+ \header
+ \li About
+ \li Here
+ \row
+ \li Widgets and Window Geometry
+ \li \l{Window and Dialog Widgets}
+ \row
+ \li Events and event handling
+ \li \l{The Event System}
+ \endtable
+
+ \section1 Designing a UI
+
+ The wizard generates a user interface definition in XML format: notepad.ui.
+ When you open the notepad.ui file in Qt Creator, it automatically
+ opens in the integrated Qt Designer.
+
+ When you build the application, Qt Creator launches the Qt
+ \l{User Interface Compiler (uic)} that reads the .ui file and creates
+ a corresponding C++ header file, ui_notepad.h.
+
+ \section2 Using Qt Designer
+
+ The wizard creates an application that uses a QMainWindow. It has
+ its own layout to which you can add a menu bar, dock widgets, toolbars,
+ and a status bar. The center area can be occupied by any kind of widget.
+ The wizard places the Notepad widget there.
+
+ To add widgets in Qt Designer:
+
+ \list 1
+ \li In the Qt Creator \b Editor mode, double-click the notepad.ui
+ file in the \b Projects view to launch the file in the integrated
+ Qt Designer.
+ \li Drag and drop widgets Text Edit (QTextEdit) to the form.
+ \li Press \b {Ctrl+A} (or \b {Cmd+A}) to select the widgets and click
+ \b {Lay out Vertically} (or press \b {Ctrl+L}) to apply a vertical
+ layout (QVBoxLayout).
+ \li Press \b {Ctrl+S} (or \b {Cmd+S}) to save your changes.
+ \endlist
+
+ The UI now looks as follows in Qt Designer:
+
+ \image notepad4.png
+
+ You can view the generated XML file in the code editor:
+
+ \quotefromfile tutorials/notepad/notepad.ui
+
+ \printuntil QMenuBar
+ \dots
+
+ The following line contains the XML declaration, which specifies the
+ XML version and character encoding used in the document:
+
+ \code
+
+ \endcode
+
+ The rest of the file specifies an \c ui element that defines a
+ Notepad widget:
+
+ \code
+
+ \endcode
+
+ The UI file is used together with the header and source file of the
+ Notepad class. We will look at the rest of the UI file in the later
+ sections.
+
+ \section2 Notepad Header File
+
+ The wizard generated a header file for the Notepad class that has the
+ necessary #includes, a constructor, a destructor, and the Ui object.
+ The file looks as follows:
+
+ \snippet tutorials/notepad/notepad.h all
+
+ The following line includes QMainWindow that provides a main application
+ window:
+
+ \snippet tutorials/notepad/notepad.h 1
+
+ The following lines declare the Notepad class in the Ui namespace,
+ which is the standard namespace for the UI classes generated from
+ .ui files by the \c uic tool:
+
+ \snippet tutorials/notepad/notepad.h 2
+
+ The class declaration contains the \c Q_OBJECT macro. It must come
+ first in the class definition, and declares our class as a QObject.
+ Naturally, it must also inherit from QObject. A QObject adds several
+ abilities to a normal C++ class. Notably, the class name and slot
+ names can be queried at runtime. It is also possible to query a slot's
+ parameter types and invoke it.
+
+ \snippet tutorials/notepad/notepad.h 3
+
+ The following lines declare a constructor that has a default argument
+ called \c parent.
+ The value 0 indicates that the widget has no parent (it is a top-level
+ widget).
+
+ \snippet tutorials/notepad/notepad.h 4
+
+ The following line declares a virtual destructor to free the resources
+ that were acquired by the object during its life-cycle. According to
+ the C++ naming convention, destructors have the same name as the class
+ they are associated with, prefixed with a tilde (~). In QObject,
+ destructors are virtual to ensure that the destructors of derived
+ classes are invoked properly when an object is deleted through a
+ pointer-to-base-class.
+
+ \snippet tutorials/notepad/notepad.h 5
+
+ The following lines declare a member variable which is a pointer to
+ the Notepad UI class. A member variable is associated with a specific
+ class, and accessible for all its methods.
+
+ \snippet tutorials/notepad/notepad.h 6
+
+ \section2 Notepad Source File
+
+ The source file that the wizard generated for the Notepad class looks
+ as follows:
+
+ \quotefromfile tutorials/notepad/notepad.cpp
+ \skipto notepad.h
+ \printuntil ui->textEdit->setFont(font)
+ \printuntil }
+
+ The following lines include the Notepad class header file that was
+ generated by the wizard and the UI header file that was generated
+ by the \c uic tool:
+
+ \quotefromfile tutorials/notepad/notepad.cpp
+ \skipto notepad.h
+ \printuntil ui_notepad
+
+ The following line defines the \c {Notepad} constructor:
+
+ \skipto Notepad::Notepad
+ \printline Notepad::Notepad
+
+ The following line calls the QMainWindow constructor, which is
+ the base class for the Notepad class:
+
+ \printline QMainWindow
+
+ The following line creates the UI class instance and assigns it to
+ the \c ui member:
+
+ \printline ui(new
+
+ The following line sets up the UI:
+
+ \quotefromfile tutorials/notepad/notepad.cpp
+ \skipto ui->setupUi
+ \printline ui->setupUi(this)
+
+ In the destructor, we delete the \c ui:
+
+ \skipto Notepad::~Notepad
+ \printuntil }
+
+ In order to have the text edit field occupy the whole screen, we add
+ \c setCentralWidget to the main window.
+
+ \quotefromfile tutorials/notepad/notepad.cpp
+ \skipto Notepad::Notepad(QWidget *parent)
+ \printuntil }
+
+ \section2 Project File
+
+ The wizard generates the following project file, \c {notepad.pro}, for
+ us:
+
+ \quotefile tutorials/notepad/notepad.pro
+
+ The project file specifies the application name and the \c qmake
+ template to use for generating the project, as well as the source,
+ header, and UI files included in the project.
+
+ You could also use \c qmake's \c -project option to generate the \.pro
+ file. Although, in that case, you have to remember to add the line
+ \c{QT += widgets} to the generated file in order to link against the
+ Qt Widgets Module.
+
+ \b{Learn More}
+
+ \table
+ \header
+ \li About
+ \li Here
+ \row
+ \li Using Qt Designer
+ \li \l{Qt Designer Manual}
+ \row
+ \li Layouts
+ \li \l{Layout Management},
+ \l{Widgets and Layouts},
+ \l{Layout Examples}
+ \row
+ \li The widgets that come with Qt
+ \li \l{Qt Widget Gallery}
+ \row
+ \li Main windows and main window classes
+ \li \l{Application Main Window},
+ \l{Main Window Examples}
+ \row
+ \li QObjects and the Qt Object model (This is essential to
+ understand Qt)
+ \li \l{Object Model}
+ \row
+ \li qmake and the Qt build system
+ \li \l{qmake Manual}
+ \endtable
+
+ \section1 Adding User Interaction
+
+
+ To add functionality to the editor, we start by adding menu items
+ and buttons on a toolbar.
+
+ Click on "Type Here", and add the options New, Open, Save, Save as,
+ Print and Exit. This creates 5 lines in the Action Editor below.
+ To connect the actions to slots, right-click an action and select
+ Go to slot > triggered(), and complete the code for that given slot.
+
+ If we also want to add the actions to a toolbar, we can assign an
+ icon to each QAction, and then drag the QAction to the toolbar. You
+ assign an icon by entering an icon name in the Icon property of the
+ action concerned. When the QAction has been dragged to the toolbar,
+ clicking the icon will launch the associated slot.
+
+ Complete the method \c on_actionNew_triggered():
+
+ \quotefromfile tutorials/notepad/notepad.cpp
+ \skipto on_actionNew_triggered()
+ \printuntil }
+
+ \c current_file is a global variable containing the file presently
+ being edited.
+ It is defined in the private part of notepad.h:
+
+ \quotefromfile tutorials/notepad/notepad.h
+ \skipto private:
+ \printuntil currentFile;
+
+ \c clear() clears the text buffer.
+
+ \section2 Opening a file
+
+ In \c notepad.ui, right click on \c actionOpen and select \c {Go to
+ slot}
+
+ Complete method \c on_actionOpen_triggered().
+
+ \quotefromfile tutorials/notepad/notepad.cpp
+ \skipto on_actionOpen_triggered()
+ \printuntil file.close
+ \printuntil }
+
+
+ \c QFileDialog::getOpenFileName opens a dialog enabling you to select
+ a file. QFile object \c myfile has the selected \c file_name as
+ parameter. We store the selected file also into the global variable
+ \c current_file for later purposes. We open the file with \c file.open
+ as a readonly text file. If it cannot be opened, a warning is issued,
+ and the program stops.
+
+ We define a QTextStream \c instream for parameter \c myfile.
+ The contents of file \c myfile is copied into QString \a text.
+ \c setText(text) fille the buffer of our editor with \c text.
+
+ \c section2 Saving a file
+
+ We create the method for saving a file in the same way as for
+ \l {Opening a file}, by right clicking on \c actionSave, and
+ selecting \c {Go to Slot}.
+
+ \skipto Notepad::on_actionSave_triggered
+ \printuntil file.close
+ \printuntil }
+
+ QFile object \c myfile is linked to global variable \c current_file,
+ the variable that contains the file we were working with.
+ If we cannot open \c myfile, an error message is issued and the
+ method stops. We create a QTextStream \c outstream. The contents
+ of the editor buffer is converted to plain text, and then written
+ to \c outstream.
+
+ \section2 Saving a file with \c {Save as}
+
+ \skipto Notepad::on_actionSave_as_triggered
+ \printuntil file.close
+ \printuntil }
+
+ This is the same procedure as for \c {Saving a file}, the only
+ difference being that here you need to enter a new file name for
+ the file to be created.
+
+
+ \section2 Print a File
+
+ If you want to use print functionalities, you need to add
+ \c printsupport to the project file:
+
+ \badcode
+ QT += printsupport
+ \endcode
+
+ We declare a QPrinter object called \c printer.
+ We launch a printer dialog box and store the selected printer in
+ object \c printer. If we clicked on \c Cancel and did not select
+ a printer, the methods returns. The actual printer command is given
+ with \a ui->textEdit->print with our QPrinter object as parameter.
+
+ \section2 Select a Font
+
+ \skipto Notepad::on_actionFont_triggered
+ \printuntil ui->textEdit->setFont
+ \printline }
+
+ We declare a boolean indicating if we did select a font with
+ QFontDialog. If so, we set the font with \c ui->textEdit->setFont(myfont).
+
+ \section2 Copy, Cut, Paste, Undo, and Redo
+
+ If you select some text, and want to copy it to the clipboard,
+ you call the appropriate method of ui->textEdit. The same counts
+ for cut, paste, undo, and redo.
+
+ This table shows the method name to use.
+
+ \table
+ \header
+ \li Task
+ \li Method called
+ \row
+ \li Copy
+ \li ui->textEdit->copy()
+ \row
+ \li Cut
+ \li ui->textEdit->cut()
+ \row
+ \li Paste
+ \li ui->textEdit->paste()
+ \row
+ \li Undo
+ \li ui->textEdit->undo()
+ \row
+ \li Redo
+ \li ui->textEdit->redo()
+ \endtable
+
+ \b{Learn More}
+
+ \table
+ \header
+ \li About
+ \li Here
+ \row
+ \li MDI applications
+ \li QMdiArea,
+ \l{MDI Example}
+ \row
+ \li Files and I/O devices
+ \li QFile, QIODevice
+ \row
+ \li tr() and internationalization
+ \li \l{Qt Linguist Manual},
+ \l{Writing Source Code for Translation},
+ \l{Internationalization with Qt}
+ \endtable
+
+ \section1 Building and Running Notepad
+
+ Now that you have all the necessary files, select \b Build >
+ \b {Build Project Notepad} to build and run the application. Qt
+ Creator uses \c qmake and \c make to create an executable in the
+ directory specified in the build settings of the project and runs
+ it.
+
+ \section2 Building and Running from the Command Line
+
+ To build the application from the command line, switch to the
+ directory in which you have the \c .cpp file of the application
+ and add the project file (suffixed .pro) described earlier. The
+ following shell commands then build the application:
+
+ \badcode
+ qmake
+ make (or nmake on Windows)
+ \endcode
+
+ The commands create an executable in the project directory. The
+ \c qmake tool reads the project file and produces a \c Makefile
+ with instructions on how to build the application.
+ The \c make tool (or the \c nmake tool) then reads the \c Makefile
+ and produces the executable binary.
+*/
diff --git a/examples/widgets/tutorials/notepad/images/copy.png b/examples/widgets/tutorials/notepad/images/copy.png
new file mode 100644
index 00000000000..cb3442c04c8
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/copy.png differ
diff --git a/examples/widgets/tutorials/notepad/images/create.png b/examples/widgets/tutorials/notepad/images/create.png
new file mode 100644
index 00000000000..fdfd4b438ac
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/create.png differ
diff --git a/examples/widgets/tutorials/notepad/images/cut.png b/examples/widgets/tutorials/notepad/images/cut.png
new file mode 100644
index 00000000000..74b15301ff1
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/cut.png differ
diff --git a/examples/widgets/tutorials/notepad/images/edit_redo.png b/examples/widgets/tutorials/notepad/images/edit_redo.png
new file mode 100644
index 00000000000..8a7725463cc
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/edit_redo.png differ
diff --git a/examples/widgets/tutorials/notepad/images/edit_undo.png b/examples/widgets/tutorials/notepad/images/edit_undo.png
new file mode 100644
index 00000000000..852f5e3b298
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/edit_undo.png differ
diff --git a/examples/widgets/tutorials/notepad/images/exit.png b/examples/widgets/tutorials/notepad/images/exit.png
new file mode 100644
index 00000000000..677d4deef20
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/exit.png differ
diff --git a/examples/widgets/tutorials/notepad/images/font.png b/examples/widgets/tutorials/notepad/images/font.png
new file mode 100644
index 00000000000..925e501c03d
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/font.png differ
diff --git a/examples/widgets/tutorials/notepad/images/info.png b/examples/widgets/tutorials/notepad/images/info.png
new file mode 100644
index 00000000000..9731212c4fb
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/info.png differ
diff --git a/examples/widgets/tutorials/notepad/images/new.png b/examples/widgets/tutorials/notepad/images/new.png
new file mode 100644
index 00000000000..b24edc5d0cf
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/new.png differ
diff --git a/examples/widgets/tutorials/notepad/images/open.png b/examples/widgets/tutorials/notepad/images/open.png
new file mode 100644
index 00000000000..7b052edf5a5
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/open.png differ
diff --git a/examples/widgets/tutorials/notepad/images/paste.png b/examples/widgets/tutorials/notepad/images/paste.png
new file mode 100644
index 00000000000..c50dbd95b2b
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/paste.png differ
diff --git a/examples/widgets/tutorials/notepad/images/pencil.png b/examples/widgets/tutorials/notepad/images/pencil.png
new file mode 100644
index 00000000000..a9c5e5482ab
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/pencil.png differ
diff --git a/examples/widgets/tutorials/notepad/images/print.png b/examples/widgets/tutorials/notepad/images/print.png
new file mode 100644
index 00000000000..0cd3f28bd82
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/print.png differ
diff --git a/examples/widgets/tutorials/notepad/images/save.png b/examples/widgets/tutorials/notepad/images/save.png
new file mode 100644
index 00000000000..e65a29d5f17
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/save.png differ
diff --git a/examples/widgets/tutorials/notepad/images/save_as.png b/examples/widgets/tutorials/notepad/images/save_as.png
new file mode 100644
index 00000000000..60405743223
Binary files /dev/null and b/examples/widgets/tutorials/notepad/images/save_as.png differ
diff --git a/examples/widgets/dialogs/configdialog/main.cpp b/examples/widgets/tutorials/notepad/main.cpp
similarity index 89%
rename from examples/widgets/dialogs/configdialog/main.cpp
rename to examples/widgets/tutorials/notepad/main.cpp
index e73474b8662..20bcdaa7df9 100644
--- a/examples/widgets/dialogs/configdialog/main.cpp
+++ b/examples/widgets/tutorials/notepad/main.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the examples of the Qt Toolkit.
+** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
@@ -48,16 +48,14 @@
**
****************************************************************************/
+#include "notepad.h"
#include
-#include "configdialog.h"
-
int main(int argc, char *argv[])
{
- Q_INIT_RESOURCE(configdialog);
+ QApplication EditorApp(argc, argv);
+ Notepad Editor;
+ Editor.show();
- QApplication app(argc, argv);
- app.setApplicationDisplayName("Qt Example");
- ConfigDialog dialog;
- return dialog.exec();
+ return EditorApp.exec();
}
diff --git a/examples/widgets/tutorials/notepad/notepad.cpp b/examples/widgets/tutorials/notepad/notepad.cpp
new file mode 100644
index 00000000000..b4f6cf7f8f7
--- /dev/null
+++ b/examples/widgets/tutorials/notepad/notepad.cpp
@@ -0,0 +1,182 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "notepad.h"
+#include "ui_notepad.h"
+
+Notepad::Notepad(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::Notepad)
+{
+ ui->setupUi(this);
+ this->setCentralWidget(ui->textEdit);
+}
+
+Notepad::~Notepad()
+{
+ delete ui;
+}
+
+void Notepad::on_actionNew_triggered()
+{
+ currentFile.clear();
+ ui->textEdit->setText(QString());
+}
+
+void Notepad::on_actionOpen_triggered()
+{
+ QString fileName = QFileDialog::getOpenFileName(this, "Open the file");
+ QFile file(fileName);
+ currentFile = fileName;
+ if (!file.open(QIODevice::ReadOnly | QFile::Text)) {
+ QMessageBox::warning(this, "Warning", "Cannot open file: " + file.errorString());
+ return;
+ }
+ setWindowTitle(fileName);
+ QTextStream in(&file);
+ QString text = in.readAll();
+ ui->textEdit->setText(text);
+ file.close();
+}
+
+void Notepad::on_actionSave_triggered()
+{
+ QString fileName;
+ // If we don't have a filename from before, get one.
+ if (currentFile.isEmpty()) {
+ fileName = QFileDialog::getSaveFileName(this, "Save");
+ currentFile = fileName;
+ } else {
+ fileName = currentFile;
+ }
+ QFile file(fileName);
+ if (!file.open(QIODevice::WriteOnly | QFile::Text)) {
+ QMessageBox::warning(this, "Warning", "Cannot save file: " + file.errorString());
+ return;
+ }
+ setWindowTitle(fileName);
+ QTextStream out(&file);
+ QString text = ui->textEdit->toPlainText();
+ out << text;
+ file.close();
+}
+
+void Notepad::on_actionSave_as_triggered()
+{
+ QString fileName = QFileDialog::getSaveFileName(this, "Save as");
+ QFile file(fileName);
+
+ if (!file.open(QFile::WriteOnly | QFile::Text)) {
+ QMessageBox::warning(this, "Warning", "Cannot save file: " + file.errorString());
+ return;
+ }
+ currentFile = fileName;
+ setWindowTitle(fileName);
+ QTextStream out(&file);
+ QString text = ui->textEdit->toPlainText();
+ out << text;
+ file.close();
+}
+
+void Notepad::on_actionPrint_triggered()
+{
+ QPrinter printDev;
+ QPrintDialog dialog(&printDev, this);
+ if (dialog.exec() == QDialog::Rejected)
+ return;
+ ui->textEdit->print(&printDev);
+}
+
+void Notepad::on_actionExit_triggered()
+{
+ QCoreApplication::quit();
+}
+
+void Notepad::on_actionCopy_triggered()
+{
+ ui->textEdit->copy();
+}
+
+void Notepad::on_actionCut_triggered()
+{
+ ui->textEdit->cut();
+}
+
+void Notepad::on_actionPaste_triggered()
+{
+ ui->textEdit->paste();
+}
+
+void Notepad::on_actionUndo_triggered()
+{
+ ui->textEdit->undo();
+}
+
+void Notepad::on_actionRedo_triggered()
+{
+ ui->textEdit->redo();
+}
+
+void Notepad::on_actionFont_triggered()
+{
+ bool fontSelected;
+ QFont font = QFontDialog::getFont(&fontSelected, this);
+ if (fontSelected)
+ ui->textEdit->setFont(font);
+}
diff --git a/examples/widgets/dialogs/configdialog/configdialog.h b/examples/widgets/tutorials/notepad/notepad.h
similarity index 72%
rename from examples/widgets/dialogs/configdialog/configdialog.h
rename to examples/widgets/tutorials/notepad/notepad.h
index c2edd204e66..f688df45ac9 100644
--- a/examples/widgets/dialogs/configdialog/configdialog.h
+++ b/examples/widgets/tutorials/notepad/notepad.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the examples of the Qt Toolkit.
+** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
@@ -48,32 +48,67 @@
**
****************************************************************************/
-#ifndef CONFIGDIALOG_H
-#define CONFIGDIALOG_H
+#ifndef NOTEPAD_H
+#define NOTEPAD_H
-#include
+//! [all]
+//! [1]
+#include
+//! [1]
+//! [2]
QT_BEGIN_NAMESPACE
-class QListWidget;
-class QListWidgetItem;
-class QStackedWidget;
+namespace Ui {
+class Notepad;
+}
QT_END_NAMESPACE
+//! [2]
-class ConfigDialog : public QDialog
+//! [3]
+class Notepad : public QMainWindow
{
Q_OBJECT
+//! [3]
+//! [4]
public:
- ConfigDialog();
+ explicit Notepad(QWidget *parent = 0);
+//! [4]
+//! [5]
+ ~Notepad();
+//! [5]
-public slots:
- void changePage(QListWidgetItem *current, QListWidgetItem *previous);
+private slots:
+ void on_actionNew_triggered();
+ void on_actionOpen_triggered();
+
+ void on_actionSave_triggered();
+
+ void on_actionSave_as_triggered();
+
+ void on_actionPrint_triggered();
+
+ void on_actionExit_triggered();
+
+ void on_actionCopy_triggered();
+
+ void on_actionCut_triggered();
+
+ void on_actionPaste_triggered();
+
+ void on_actionUndo_triggered();
+
+ void on_actionRedo_triggered();
+
+ void on_actionFont_triggered();
+
+//! [6]
private:
- void createIcons();
-
- QListWidget *contentsWidget;
- QStackedWidget *pagesWidget;
+ Ui::Notepad *ui;
+ QString currentFile;
+//! [6]
};
+//! [all]
-#endif
+#endif // NOTEPAD_H
diff --git a/examples/widgets/tutorials/notepad/notepad.pro b/examples/widgets/tutorials/notepad/notepad.pro
new file mode 100644
index 00000000000..7369dbc9915
--- /dev/null
+++ b/examples/widgets/tutorials/notepad/notepad.pro
@@ -0,0 +1,20 @@
+TEMPLATE = app
+TARGET = notepad
+
+QT += printsupport
+
+SOURCES += \
+ main.cpp\
+ notepad.cpp
+
+HEADERS += notepad.h
+
+FORMS += notepad.ui
+
+RESOURCES += \
+ notepad.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/notepad
+INSTALLS += target
+
diff --git a/examples/widgets/tutorials/notepad/notepad.qrc b/examples/widgets/tutorials/notepad/notepad.qrc
new file mode 100644
index 00000000000..ec11679f133
--- /dev/null
+++ b/examples/widgets/tutorials/notepad/notepad.qrc
@@ -0,0 +1,19 @@
+
+
+ images/copy.png
+ images/create.png
+ images/cut.png
+ images/edit_redo.png
+ images/edit_undo.png
+ images/exit.png
+ images/font.png
+ images/info.png
+ images/new.png
+ images/open.png
+ images/paste.png
+ images/pencil.png
+ images/print.png
+ images/save.png
+ images/save_as.png
+
+
diff --git a/examples/widgets/tutorials/notepad/notepad.ui b/examples/widgets/tutorials/notepad/notepad.ui
new file mode 100644
index 00000000000..d197a95fe7f
--- /dev/null
+++ b/examples/widgets/tutorials/notepad/notepad.ui
@@ -0,0 +1,196 @@
+
+
+ Notepad
+
+
+
+ 0
+ 0
+ 524
+ 300
+
+
+
+ Notepad
+
+
+
+ -
+
+
+
+
+
+
+
+ TopToolBarArea
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ :/images/new.png:/images/new.png
+
+
+ New
+
+
+
+
+
+ :/images/open.png:/images/open.png
+
+
+ Open
+
+
+
+
+
+ :/images/save.png:/images/save.png
+
+
+ Save
+
+
+
+
+
+ :/images/save_as.png:/images/save_as.png
+
+
+ Save as
+
+
+
+
+
+ :/images/print.png:/images/print.png
+
+
+ Print
+
+
+
+
+
+ :/images/exit.png:/images/exit.png
+
+
+ Exit
+
+
+
+
+
+ :/images/copy.png:/images/copy.png
+
+
+ Copy
+
+
+
+
+
+ :/images/cut.png:/images/cut.png
+
+
+ Cut
+
+
+
+
+
+ :/images/paste.png:/images/paste.png
+
+
+ Paste
+
+
+
+
+
+ :/images/edit_undo.png:/images/edit_undo.png
+
+
+ Undo
+
+
+
+
+
+ :/images/edit_redo.png:/images/edit_redo.png
+
+
+ Redo
+
+
+
+
+
+ :/images/font.png:/images/font.png
+
+
+ Font
+
+
+
+
+
+
+
+
+
diff --git a/examples/widgets/tutorials/tutorials.pro b/examples/widgets/tutorials/tutorials.pro
index 2eb87cdbd58..0aaa119d8f9 100644
--- a/examples/widgets/tutorials/tutorials.pro
+++ b/examples/widgets/tutorials/tutorials.pro
@@ -1,2 +1,2 @@
TEMPLATE = subdirs
-SUBDIRS += addressbook widgets modelview gettingStarted
+SUBDIRS += addressbook widgets modelview gettingStarted notepad
diff --git a/mkspecs/common/msvc-desktop.conf b/mkspecs/common/msvc-desktop.conf
index f7f7e54d266..1a38f70205c 100644
--- a/mkspecs/common/msvc-desktop.conf
+++ b/mkspecs/common/msvc-desktop.conf
@@ -1,17 +1,21 @@
#
-# qmake configuration for Microsoft Visual Studio C/C++ Compiler
-# This mkspec is used by the win32-msvc and win32-clang-msvc specs
+# This file is used as a basis for the following compilers:
#
-
+# - Microsoft C/C++ Optimizing Compiler (all desktop versions)
+# - Intel C++ Compiler on Windows
+# - Clang-cl
+#
+# Baseline:
+#
+# - Visual Studio 2005 (8.0), VC++ 14.0
#
-# Baseline: Visual Studio 2005 (8.0), VC++ 14.0
# Version-specific settings go in msvc-version.conf (loaded by default_pre)
#
MAKEFILE_GENERATOR = MSVC.NET
QMAKE_PLATFORM = win32
QMAKE_COMPILER = msvc
-CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe
+CONFIG += incremental flat debug_and_release debug_and_release_target precompile_header autogen_precompile_source embed_manifest_dll embed_manifest_exe
DEFINES += UNICODE _UNICODE WIN32
QMAKE_COMPILER_DEFINES += _WIN32
contains(QMAKE_TARGET.arch, x86_64) {
@@ -31,7 +35,7 @@ QMAKE_CFLAGS = -nologo -Zc:wchar_t
QMAKE_CFLAGS_WARN_ON = -W3
QMAKE_CFLAGS_WARN_OFF = -W0
QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_OPTIMIZE -MD
-QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -MD -Zi
+QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -Zi -MD
QMAKE_CFLAGS_DEBUG = -Zi -MDd
QMAKE_CFLAGS_YACC =
QMAKE_CFLAGS_LTCG = -GL
@@ -96,7 +100,6 @@ QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2 = gdi32.lib user32.lib
QMAKE_LIBS_OPENGL_ES2_DEBUG = gdi32.lib user32.lib
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
-
QMAKE_LIBS_QT_ENTRY = -lqtmain
QMAKE_IDL = midl /NOLOGO
diff --git a/mkspecs/devices/integrity-armv8-msm8996au/qmake.conf b/mkspecs/devices/integrity-armv8-msm8996au/qmake.conf
new file mode 100644
index 00000000000..90299bf3e9a
--- /dev/null
+++ b/mkspecs/devices/integrity-armv8-msm8996au/qmake.conf
@@ -0,0 +1,57 @@
+#
+# qmake configuration for INTEGRITY Qualcomm s820 Snapdragon MSM8996AU
+#
+
+load(device_config)
+
+include(../../common/ghs-integrity-armv8.conf)
+
+QT_QPA_DEFAULT_PLATFORM = eglfs
+EGLFS_DEVICE_INTEGRATION = eglfs_openwfd
+
+bsp_name = $$(INTEGRITY_BSP)
+isEmpty(bsp_name): \
+ error("This qmakespec requires $INTEGRITY_BSP to be set")
+
+os_directory = $$(INTEGRITY_DIR)
+isEmpty(os_directory): \
+ error("This qmakespec requires $INTEGRITY_DIR to be set")
+
+qclibs_directory = $$(QCLIBS_DIR)
+isEmpty(qclibs_directory): \
+ error("This qmakespec requires $QCLIBS_DIR to be set")
+
+qc_multimedia_inc_directory = $$(QC_MULTIMEDIA_INC_DIR)
+isEmpty(qc_multimedia_inc_directory): \
+ error("This qmakespec requires $QC_MULTIMEDIA_INC_DIR to be set")
+
+gl_inc_directory = $$(GL_INC_DIR)
+isEmpty(gl_inc_directory): \
+ error("This qmakespec requires $GL_INC_DIR to be set")
+
+gl_lib_directory = $$(GL_LIB_DIR)
+isEmpty(gl_lib_directory): \
+ error("This qmakespec requires $GL_LIB_DIR to be set")
+
+QMAKE_LIBDIR += $$(QCLIBS_DIR)/base
+QMAKE_LIBDIR += $$(QCLIBS_DIR)/multimedia/display
+
+QMAKE_INCDIR += $$(QC_MULTIMEDIA_INC_DIR)
+
+QMAKE_LIBS_EGL += -lESXEGL_Adreno -lESXGLESv2_Adreno -ladreno_utils -lGSLUser -lOSUser -lpanel -livfs -lposix -lpmem -ltzbsp -lpaged_alloc -lglnext-llvm -lopenwfd
+QMAKE_LIBS_OPENGL_ES2 += $${QMAKE_LIBS_EGL}
+
+QMAKE_CFLAGS += -DINTEGRITY
+QMAKE_CXXFLAGS += -DINTEGRITY
+
+QMAKE_CFLAGS += -bigswitch
+QMAKE_CXXFLAGS += -bigswitch
+QMAKE_LFLAGS += -bigswitch
+
+# OpenGL libraries have a dependency on libEGL
+QMAKE_INCDIR_EGL = $$(GL_INC_DIR)
+QMAKE_LIBDIR_EGL = $$(GL_LIB_DIR)
+QMAKE_INCDIR_OPENGL_ES2 = $$(GL_INC_DIR)
+QMAKE_LIBDIR_OPENGL_ES2 = $$(GL_LIB_DIR)
+
+load(qt_config)
diff --git a/mkspecs/devices/integrity-armv8-msm8996au/qplatformdefs.h b/mkspecs/devices/integrity-armv8-msm8996au/qplatformdefs.h
new file mode 100644
index 00000000000..c8361113a09
--- /dev/null
+++ b/mkspecs/devices/integrity-armv8-msm8996au/qplatformdefs.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMDEFS_H
+#define QPLATFORMDEFS_H
+
+#include "../../common/integrity/qplatformdefs.h"
+
+#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/features/data/configure.json b/mkspecs/features/data/configure.json
index 38623d46a4d..167c502e829 100644
--- a/mkspecs/features/data/configure.json
+++ b/mkspecs/features/data/configure.json
@@ -9,7 +9,7 @@
"continue": "void",
- "recheck": { "type": "void", "name": "cache_use", "value": "positive" },
+ "recheck": { "type": "optionalString", "name": "cache_recheck" },
"recheck-all": { "type": "void", "name": "cache_use", "value": "none" },
"redo": { "type": "redo" },
diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf
index 2d525251906..07a9b1c4014 100644
--- a/mkspecs/features/default_pre.prf
+++ b/mkspecs/features/default_pre.prf
@@ -2,6 +2,9 @@
# Note that evaluating variable assignments from the command line
# still happens in between these two steps.
+# In early configure setup; nothing useful to be done here.
+isEmpty(QMAKE_CXX): return()
+
load(exclusive_builds)
CONFIG = \
lex yacc debug exceptions depend_includepath \
diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf
index 1ba96767beb..d5dcda22ac5 100644
--- a/mkspecs/features/qt_configure.prf
+++ b/mkspecs/features/qt_configure.prf
@@ -499,30 +499,37 @@ defineTest(qtConfLibrary_inline) {
# to make them recognize the same input variables.
input = $$eval($${2}.alias)
- # direct libs. overwrites inline libs.
- defined(config.input.$${input}.libs, var) {
- $${1}.libs = $$eval(config.input.$${input}.libs)
- export($${1}.libs)
- }
-
# build-specific direct libs. overwrites inline libs.
vars =
any = false
all = true
- for (b, $${1}.builds._KEYS_) {
+ for (b, $$list(debug release)) {
iv = $${input}.libs.$${b}
vars += $$eval(config.commandline.rev_assignments.$${iv})
defined(config.input.$${iv}, var) {
- $${1}.builds.$${b}.libs = $$eval(config.input.$${iv})
- export($${1}.builds.$${b}.libs)
+ $${1}.builds.$${b} = $$eval(config.input.$${iv})
+ export($${1}.builds.$${b})
+ $${1}.builds._KEYS_ *= $${b}
any = true
} else {
all = false
}
}
- $$any:!$$all {
- qtConfAddError("Either none or all of $$join(vars, ", ", [, ]) must be specified.")
- return(false)
+ $$any {
+ !$$all {
+ qtConfAddError("Either none or all of $$join(vars, ", ", [, ]) must be specified.")
+ return(false)
+ }
+ export($${1}.builds._KEYS_)
+ # we also reset the generic libs, to avoid surprises.
+ $${1}.libs =
+ export($${1}.libs)
+ }
+
+ # direct libs. overwrites inline libs.
+ defined(config.input.$${input}.libs, var) {
+ $${1}.libs = $$eval(config.input.$${input}.libs)
+ export($${1}.libs)
}
# prefix. prepends to (possibly overwritten) inline libs.
@@ -670,9 +677,10 @@ defineTest(qtConfExportLibrary) {
NAME = $$upper($$name)
# LIBS is emitted even if empty, as this allows the library to be "seen".
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs)
- for (b, $${spfx}.builds._KEYS_): \
- qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), \
- $$eval($${spfx}.builds.$${b}))
+ for (b, $${spfx}.builds._KEYS_) {
+ eval(blibs = $$eval($${spfx}.builds.$${b}))
+ qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), $$blibs)
+ }
!isEmpty(defines): qtConfOutputVar(assign, $$output, QMAKE_DEFINES_$$NAME, $$defines)
!isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes)
!isEmpty($${currentConfig}.module): \
@@ -1044,8 +1052,13 @@ defineTest(qtConfSaveResult) {
return()
keys = result $$eval($${1}.cache)
cont = "cache.$${2}._KEYS_ = $$keys"
- for (k, keys): \
+ cache.$${2}._KEYS_ = $$keys
+ export(cache.$${2}._KEYS_)
+ for (k, keys) {
cont += "cache.$${2}.$${k} = $$val_escape($${1}.$${k})"
+ cache.$${2}.$${k} = $$eval($${1}.$${k})
+ export(cache.$${2}.$${k})
+ }
write_file($$QMAKE_CONFIG_CACHE, cont, append)|error()
}
@@ -2033,14 +2046,28 @@ qtConfCheckErrors()
QMAKE_CONFIG_CACHE = $$OUT_PWD/config.cache
QMAKE_CONFIG_CACHE_USE = $$eval(config.input.cache_use)
+cache_recheck = $$eval(config.input.cache_recheck)
+equals(cache_recheck, yes) {
+ QMAKE_CONFIG_CACHE_USE = positive
+ cache_recheck =
+}
isEmpty(QMAKE_CONFIG_CACHE_USE): \
QMAKE_CONFIG_CACHE_USE = all
!equals(QMAKE_CONFIG_CACHE_USE, none) {
include($$QMAKE_CONFIG_CACHE, , true)
# this crudely determines when to discard the cache. this also catches the case
# of no cache being there in the first place.
- !equals(cache.platform, $$[QMAKE_SPEC])|!equals(cache.xplatform, $$[QMAKE_XSPEC]): \
+ !equals(cache.platform, $$[QMAKE_SPEC])|!equals(cache.xplatform, $$[QMAKE_XSPEC]) {
QMAKE_CONFIG_CACHE_USE = none
+ } else: !isEmpty(cache_recheck) {
+ for (cr, $$list($$split(cache_recheck, ","))) {
+ !isEmpty(cache.$${cr}._KEYS_) {
+ cache.$${cr}._KEYS_ =
+ } else {
+ qtConfAddWarning("Attempting to discard non-cached result '$$cr'.")
+ }
+ }
+ }
}
equals(QMAKE_CONFIG_CACHE_USE, none) {
cont = \
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index a5c40a7899c..c0a8dcc251d 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -135,18 +135,12 @@ lib_bundle {
!build_all| \
if(if(!debug_and_release|CONFIG(release, debug|release))) {
FRAMEWORK_HEADERS.version = Versions
- FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
- # Non-existing paths (yet, they will be generated) are used verbatim.
- for (injected_header, SYNCQT.INJECTED_HEADER_FILES): \
- FRAMEWORK_HEADERS.files += \
- $$relative_path($$absolute_path($$injected_header, $$_PRO_FILE_PWD_), $$OUT_PWD)
-
+ FRAMEWORK_HEADERS.files = \
+ $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES $$SYNCQT.INJECTED_HEADER_FILES
FRAMEWORK_HEADERS.path = Headers
FRAMEWORK_PRIVATE_HEADERS.version = Versions
- FRAMEWORK_PRIVATE_HEADERS.files = $$SYNCQT.PRIVATE_HEADER_FILES
- for (injected_header, SYNCQT.INJECTED_PRIVATE_HEADER_FILES): \
- FRAMEWORK_PRIVATE_HEADERS.files += \
- $$relative_path($$absolute_path($$injected_header, $$_PRO_FILE_PWD_), $$OUT_PWD)
+ FRAMEWORK_PRIVATE_HEADERS.files = \
+ $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.INJECTED_PRIVATE_HEADER_FILES
FRAMEWORK_PRIVATE_HEADERS.path = Headers/$$VERSION/$$MODULE_INCNAME/private
FRAMEWORK_QPA_HEADERS.version = Versions
FRAMEWORK_QPA_HEADERS.files = $$SYNCQT.QPA_HEADER_FILES
diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf
index 9676244cc2a..bf90adcf1eb 100644
--- a/mkspecs/features/qt_plugin.prf
+++ b/mkspecs/features/qt_plugin.prf
@@ -48,7 +48,7 @@ CONFIG(static, static|shared)|prefix_build {
!build_pass {
qt_plugin_deps = $$QT $$QT_PRIVATE
- qt_plugin_deps = s,-private$,_private,g
+ qt_plugin_deps ~= s,-private$,_private,g
MODULE_PRI_CONT = \
"QT_PLUGIN.$${MODULE}.TYPE = $$PLUGIN_TYPE" \
diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf
index ba41598be14..fdf3d1cdd35 100644
--- a/mkspecs/features/toolchain.prf
+++ b/mkspecs/features/toolchain.prf
@@ -1,7 +1,4 @@
-# In early configure setup; nothing useful to be done here.
-isEmpty(QMAKE_CXX): return()
-
defineReplace(qtMakeExpand) {
out = "$$1"
for(ever) {
@@ -19,7 +16,13 @@ defineTest(qtCompilerErrror) {
what = " host"
else: \
what = " target"
- error("Cannot run$$what compiler '$$1'. Maybe you forgot to setup the environment?")
+ msg = \
+ "Cannot run$$what compiler '$$1'. Output:" \
+ "===================" \
+ $$2 \
+ "===================" \
+ "Maybe you forgot to setup the environment?"
+ error($$join(msg, $$escape_expand(\\n)))
}
cross_compile:host_build: \
@@ -64,7 +67,7 @@ isEmpty($${target_prefix}.INCDIRS) {
cxx_flags += -E -v
output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec)
- !equals(ec, 0): qtCompilerErrror($$QMAKE_CXX)
+ !equals(ec, 0): qtCompilerErrror($$QMAKE_CXX, $$output)
rim_qcc {
for (line, output) {
@@ -124,7 +127,7 @@ isEmpty($${target_prefix}.INCDIRS) {
# What's more, -print-search-dirs can't be used on clang on Apple because it
# won't print all the library paths (only the clang-internal ones).
output = $$system("$$cmd_prefix $$QMAKE_CXX -print-search-dirs", lines, ec)
- !equals(ec, 0): qtCompilerErrror($$QMAKE_CXX)
+ !equals(ec, 0): qtCompilerErrror($$QMAKE_CXX, $$output)
for (line, output) {
contains(line, "^libraries: .*") {
@@ -166,14 +169,14 @@ isEmpty($${target_prefix}.INCDIRS) {
defineReplace(qtVariablesFromMSVC) {
ret = $$system("$$1 -nologo -E $$2 $$system_quote($$PWD/data/macros.cpp) NUL", lines, ec)
- !equals(ec, 0): qtCompilerErrror($$1)
+ !equals(ec, 0): qtCompilerErrror($$1, $$ret)
return($$ret)
}
defineReplace(qtVariablesFromGCC) {
ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) \
<$$QMAKE_SYSTEM_NULL_DEVICE 2>$$QMAKE_SYSTEM_NULL_DEVICE", lines, ec)
- !equals(ec, 0): qtCompilerErrror($$1)
+ !equals(ec, 0): qtCompilerErrror($$1, $$ret)
return($$ret)
}
diff --git a/mkspecs/features/uikit/xcodebuild.mk b/mkspecs/features/uikit/xcodebuild.mk
index 435b9dbdf28..0c8d99f4b86 100644
--- a/mkspecs/features/uikit/xcodebuild.mk
+++ b/mkspecs/features/uikit/xcodebuild.mk
@@ -90,7 +90,7 @@ DESTINATION_MESSAGE = "Running $(call tolower,$(CONFIGURATION)) $(ACTION) \
xcodebuild-%:
@$(if $(DESTINATION_NAME), echo $(DESTINATION_MESSAGE),)
- xcodebuild $(ACTION) $(XCODEBUILD_FLAGS) -project $(TARGET).xcodeproj -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) $(if $(INSTALL_ROOT), DSTROOT=$(INSTALL_ROOT),)
+ xcodebuild $(ACTION) $(XCODEBUILD_FLAGS) -project $(TARGET).xcodeproj -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) $(if $(DESTINATION_ID),, ENABLE_ONLY_ACTIVE_RESOURCES=NO) $(if $(INSTALL_ROOT), DSTROOT=$(INSTALL_ROOT),)
xcodebuild-check-device_%: DESTINATION_ID=$(lastword $(subst _, ,$@))
diff --git a/mkspecs/integrity-armv8-rcar/qmake.conf b/mkspecs/integrity-armv8-rcar/qmake.conf
new file mode 100644
index 00000000000..46091f6a913
--- /dev/null
+++ b/mkspecs/integrity-armv8-rcar/qmake.conf
@@ -0,0 +1,33 @@
+#
+# qmake configuration for INTEGRITY armv7 targets
+#
+
+# armv7 common includes work for armv8-A as well
+include(../common/ghs-integrity-armv7.conf)
+
+DEFINES += INTEGRITY
+
+# This define is used because the RCar INTEGRITY EGL library expects same
+# parameter types as Symbian. The parameter types are defined in eglplatform.h.
+DEFINES += __WINSCW__
+
+QTPLUGIN.platforms += qeglfs
+QT_QPA_DEFAULT_PLATFORM = eglfs
+
+QMAKE_LIBS_EGL += -lEGL -lIMGegl -lsrv_um -lsrv_init -lpvrWSEGL_WM -lncg_usr.a -lmmgr_usr -lwm_usr -lprr_usr
+QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lIMGegl -lglslcompiler -lusc -lsrv_um -lsrv_init -lpvrWSEGL_WM -lncg_usr.a -lmmgr_usr -lwm_usr -lprr_usr
+QMAKE_LIBS_GUI = -lmmgr_usr -lwm_usr -lprr_usr
+
+QMAKE_CFLAGS += -bigswitch
+QMAKE_CXXFLAGS += -bigswitch
+QMAKE_LFLAGS += -bigswitch
+
+EGLFS_DEVICE_INTEGRATION = eglfs_rcar
+
+# OpenGL libraries have a dependency on libEGL
+dirs = $$(GL_INC_DIR)
+QMAKE_INCDIR_EGL = $$split(dirs, $$QMAKE_DIRLIST_SEP)
+QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_EGL
+dirs = $$(GL_LIB_DIR)
+QMAKE_LIBDIR_EGL = $$split(dirs, $$QMAKE_DIRLIST_SEP)
+QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_EGL
diff --git a/mkspecs/integrity-armv8-rcar/qplatformdefs.h b/mkspecs/integrity-armv8-rcar/qplatformdefs.h
new file mode 100644
index 00000000000..55afd0c3c7b
--- /dev/null
+++ b/mkspecs/integrity-armv8-rcar/qplatformdefs.h
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Green Hills Software. All rights reserved.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMDEFS_H
+#define QPLATFORMDEFS_H
+
+#include "../common/integrity/qplatformdefs.h"
+
+#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf
index 884286ea30b..d7280477655 100644
--- a/mkspecs/win32-g++/qmake.conf
+++ b/mkspecs/win32-g++/qmake.conf
@@ -1,25 +1,24 @@
#
# qmake configuration for win32-g++
#
-# Written for MinGW / gcc 4.6 or higher
+# Written for MinGW-w64 / gcc 5.3 or higher
#
# Cross compile example for i686-w64-mingw32-g++:
# configure -xplatform win32-g++ -device-option CROSS_COMPILE=i686-w64-mingw32-
#
load(device_config)
+include(../common/gcc-base.conf)
include(../common/g++-base.conf)
+# modifications to gcc-base.conf and g++-base.conf
+
MAKEFILE_GENERATOR = MINGW
QMAKE_PLATFORM = win32 mingw
CONFIG += debug_and_release debug_and_release_target precompile_header
DEFINES += UNICODE _UNICODE
QMAKE_COMPILER_DEFINES += __GNUC__ WIN32
-QMAKE_EXT_OBJ = .o
-QMAKE_EXT_RES = _res.o
-
-
QMAKE_CC = $${CROSS_COMPILE}gcc
QMAKE_LEX = flex
QMAKE_LEXFLAGS =
@@ -27,12 +26,12 @@ QMAKE_YACC = bison -y
QMAKE_YACCFLAGS = -d
QMAKE_CFLAGS += -fno-keep-inline-dllexport
QMAKE_CFLAGS_WARN_ON += -Wextra
+
QMAKE_CFLAGS_SSE2 += -mstackrealign
QMAKE_CFLAGS_AESNI = -maes
QMAKE_CFLAGS_SHANI = -msha
QMAKE_CXX = $${CROSS_COMPILE}g++
-QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
QMAKE_CXXFLAGS_RTTI_ON = -frtti
QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti
QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads
@@ -56,6 +55,8 @@ equals(QMAKE_HOST.os, Windows) {
QMAKE_LINK_OBJECT_MAX = 10
QMAKE_LINK_OBJECT_SCRIPT = object_script
}
+QMAKE_EXT_OBJ = .o
+QMAKE_EXT_RES = _res.o
QMAKE_PREFIX_SHLIB =
QMAKE_EXTENSION_SHLIB = dll
QMAKE_PREFIX_STATICLIB = lib
diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf
index 863fd77ea93..a539bfba726 100644
--- a/mkspecs/win32-icc/qmake.conf
+++ b/mkspecs/win32-icc/qmake.conf
@@ -1,24 +1,26 @@
#
# qmake configuration for win32-icc
#
-# Written for Intel C++
+# Written for Intel C++ Compiler on Windows / icl 16.0 or higher
#
-# Use the Visual Studio configuration
+# Use the Microsoft (R) C/C++ Optimizing Compiler configuration,
+# since ICC on Windows pretends to be MSVC
include(../common/msvc-desktop.conf)
-# Now override with the Intel compiler settings
+# modifications to msvc-desktop.conf
-QMAKE_COMPILER += intel_icl # icl pretends to be msvc
+QMAKE_COMPILER += intel_icl
QMAKE_CC = icl
QMAKE_CFLAGS = -nologo -Zm200 /Qprec /Qwd1744,1738,809,3373
QMAKE_CFLAGS_WARN_ON = -W3 /Qwd673
QMAKE_CFLAGS_WARN_OFF = -W0 /Qwd673
-QMAKE_CFLAGS_DEBUG = -Zi -MDd -Od
+QMAKE_CFLAGS_DEBUG = -Od -Zi -MDd
QMAKE_CFLAGS_LTCG = -Qipo
QMAKE_CFLAGS_DISABLE_LTCG = -Qno-ipo
+
QMAKE_CFLAGS_SSE2 = -QxSSE2
QMAKE_CFLAGS_SSE3 = -QxSSE3
QMAKE_CFLAGS_SSSE3 = -QxSSSE3
@@ -49,16 +51,10 @@ QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
QMAKE_CXXFLAGS_DISABLE_LTCG = $$QMAKE_CFLAGS_DISABLE_LTCG
QMAKE_LINK = xilink
-QMAKE_LFLAGS = /NOLOGO
-QMAKE_LFLAGS_RELEASE =
-QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO =
-QMAKE_LFLAGS_DEBUG = /DEBUG
QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
QMAKE_LIB = xilib /NOLOGO
-DSP_EXTENSION = .dsp
-
include(../common/angle.conf)
include(../common/windows-vulkan.conf)
diff --git a/mkspecs/win32-msvc/qmake.conf b/mkspecs/win32-msvc/qmake.conf
index 1d8b8f0e97f..5c38330add4 100644
--- a/mkspecs/win32-msvc/qmake.conf
+++ b/mkspecs/win32-msvc/qmake.conf
@@ -1,7 +1,7 @@
#
# qmake configuration for win32-msvc
#
-# Written for Microsoft Visual C++ (all desktop versions)
+# Written for Microsoft C/C++ Optimizing Compiler (all desktop versions)
#
include(../common/msvc-desktop.conf)
diff --git a/qmake/Makefile.unix.mingw b/qmake/Makefile.unix.mingw
index 2c52c07dca1..6480171c692 100644
--- a/qmake/Makefile.unix.mingw
+++ b/qmake/Makefile.unix.mingw
@@ -9,7 +9,7 @@
# sh-compatible shell. This is not a problem, because configure.bat
# will not do that.
ifeq ($(SHELL), sh.exe)
- ifeq ($(wildcard $(CURDIR)/sh.exe), )
+ ifeq ($(wildcard ./sh.exe), )
SH = 0
else
SH = 1
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 63926e7ef0c..0622ace71b1 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -280,8 +280,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
QMap settings;
settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO"));
- if(as_release)
- settings.insert("GCC_GENERATE_DEBUGGING_SYMBOLS", "NO");
if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK"))
settings.insert("SDKROOT", project->first("QMAKE_MAC_SDK").toQString());
{
@@ -1499,7 +1497,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
settings.insert("APPLICATION_EXTENSION_API_ONLY", project->isActiveConfig("app_extension_api_only") ? "YES" : "NO");
// required for tvOS (and watchos), optional on iOS (deployment target >= iOS 6.0)
settings.insert("ENABLE_BITCODE", project->isActiveConfig("bitcode") ? "YES" : "NO");
- settings.insert("GCC_GENERATE_DEBUGGING_SYMBOLS", as_release ? "NO" : "YES");
if(!as_release)
settings.insert("GCC_OPTIMIZATION_LEVEL", "0");
if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK"))
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index a1f3352aa35..82573347b6e 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -2164,9 +2164,9 @@ MakefileGenerator::writeExtraVariables(QTextStream &t)
ProStringList outlist;
const ProValueMap &vars = project->variables();
const ProStringList &exports = project->values("QMAKE_EXTRA_VARIABLES");
- for (ProValueMap::ConstIterator it = vars.begin(); it != vars.end(); ++it) {
- for (ProStringList::ConstIterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) {
- QRegExp rx((*exp_it).toQString(), Qt::CaseInsensitive, QRegExp::Wildcard);
+ for (ProStringList::ConstIterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) {
+ QRegExp rx((*exp_it).toQString(), Qt::CaseInsensitive, QRegExp::Wildcard);
+ for (ProValueMap::ConstIterator it = vars.begin(); it != vars.end(); ++it) {
if (rx.exactMatch(it.key().toQString()))
outlist << ("EXPORT_" + it.key() + " = " + it.value().join(' '));
}
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 0173311bc69..5118bdbe9c1 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -2645,7 +2645,7 @@ bool Renderer11::getShareHandleSupport() const
if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_WARP)
{
-#if !defined(ANGLE_ENABLE_WINDOWS_STORE) && !defined(__GNUC__)
+#ifndef ANGLE_ENABLE_WINDOWS_STORE
if (!IsWindows8OrGreater())
{
// WARP on Windows 7 doesn't support shared handles
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
index 785a83cd770..42c336c8cf3 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
@@ -707,15 +707,15 @@ EGLint SwapChain11::copyOffscreenToBackbuffer(EGLint x, EGLint y, EGLint width,
d3d11::PositionTexCoordVertex *vertices = static_cast(mappedResource.pData);
// Create a quad in homogeneous coordinates
- float x1 = (x / float(mWidth)) * 2.0f - 1.0f;
- float y1 = (y / float(mHeight)) * 2.0f - 1.0f;
- float x2 = ((x + width) / float(mWidth)) * 2.0f - 1.0f;
- float y2 = ((y + height) / float(mHeight)) * 2.0f - 1.0f;
+ float x1 = (x / float(width)) * 2.0f - 1.0f;
+ float y1 = (y / float(height)) * 2.0f - 1.0f;
+ float x2 = ((x + width) / float(width)) * 2.0f - 1.0f;
+ float y2 = ((y + height) / float(height)) * 2.0f - 1.0f;
- float u1 = x / float(mWidth);
- float v1 = y / float(mHeight);
- float u2 = (x + width) / float(mWidth);
- float v2 = (y + height) / float(mHeight);
+ float u1 = x / float(width);
+ float v1 = y / float(height);
+ float u2 = (x + width) / float(width);
+ float v2 = (y + height) / float(height);
// Invert the quad vertices depending on the surface orientation.
if ((mOrientation & EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE) != 0)
@@ -760,8 +760,8 @@ EGLint SwapChain11::copyOffscreenToBackbuffer(EGLint x, EGLint y, EGLint width,
D3D11_VIEWPORT viewport;
viewport.TopLeftX = 0;
viewport.TopLeftY = 0;
- viewport.Width = static_cast(mWidth);
- viewport.Height = static_cast(mHeight);
+ viewport.Width = static_cast(width);
+ viewport.Height = static_cast(height);
viewport.MinDepth = 0.0f;
viewport.MaxDepth = 1.0f;
deviceContext->RSSetViewports(1, &viewport);
diff --git a/src/3rdparty/freetype/qt_attribution.json b/src/3rdparty/freetype/qt_attribution.json
index e00f2062b04..4be86e92b6d 100644
--- a/src/3rdparty/freetype/qt_attribution.json
+++ b/src/3rdparty/freetype/qt_attribution.json
@@ -9,7 +9,7 @@
"Homepage": "http://www.freetype.org",
"License": "Freetype Project License or GNU General Public License v2.0 only",
"LicenseId": "FTL OR GPL-2.0",
- "LicenseFile": "LICENSE.TXT",
+ "LicenseFile": "LICENSE.txt",
"Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg."
},
{
@@ -22,7 +22,7 @@
"Homepage": "http://www.freetype.org",
"License": "zlib License",
"LicenseId": "Zlib",
- "LicenseFile": "ZLIB-LICENSE.TXT",
+ "LicenseFile": "ZLIB-LICENSE.txt",
"Copyright": "Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler"
},
{
@@ -35,7 +35,7 @@
"Homepage": "http://www.freetype.org",
"License": "MIT License",
"LicenseId": "MIT",
- "LicenseFile": "BDF-LICENSE.TXT",
+ "LicenseFile": "BDF-LICENSE.txt",
"Copyright": "Copyright (C) 2001-2002 by Francesco Zappa Nardelli
Copyright 2000 Computing Research Labs, New Mexico State University
Copyright 2001-2002, 2011 Francesco Zappa Nardelli"
@@ -50,7 +50,7 @@ Copyright 2001-2002, 2011 Francesco Zappa Nardelli"
"Homepage": "http://www.freetype.org",
"License": "MIT License",
"LicenseId": "MIT",
- "LicenseFile": "PCF-LICENSE.TXT",
+ "LicenseFile": "PCF-LICENSE.txt",
"Copyright": "Copyright (C) 2000 by Francesco Zappa Nardelli"
}
]
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
index 84d5adf8560..0e28b964e89 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -1156,7 +1156,7 @@ public class QtActivityDelegate
return false;
m_metaState = MetaKeyKeyListener.handleKeyDown(m_metaState, keyCode, event);
- int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(m_metaState));
+ int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(m_metaState) | event.getMetaState());
int lc = c;
m_metaState = MetaKeyKeyListener.adjustMetaAfterKeypress(m_metaState);
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
index f15c7f3a970..1cf3bca5f75 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
@@ -500,15 +500,16 @@ public class QtNative
}
}
- static public void sendGenericMotionEvent(MotionEvent event, int id)
+ static public boolean sendGenericMotionEvent(MotionEvent event, int id)
{
if (event.getActionMasked() != MotionEvent.ACTION_SCROLL
|| (event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != InputDevice.SOURCE_CLASS_POINTER) {
- return;
+ return false;
}
mouseWheel(id, (int) event.getX(), (int) event.getY(),
event.getAxisValue(MotionEvent.AXIS_HSCROLL), event.getAxisValue(MotionEvent.AXIS_VSCROLL));
+ return true;
}
public static Context getContext() {
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
index e994002dd35..08b5a80f7e8 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
@@ -116,7 +116,6 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback
@Override
public boolean onGenericMotionEvent(MotionEvent event)
{
- QtNative.sendGenericMotionEvent(event, getId());
- return true;
+ return QtNative.sendGenericMotionEvent(event, getId());
}
}
diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
index 99c4ecca074..6e92e640281 100644
--- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
+++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
@@ -569,7 +569,8 @@ public abstract class QtLoader {
boolean bundlingQtLibs = false;
if (m_contextInfo.metaData.containsKey("android.app.bundle_local_qt_libs")
&& m_contextInfo.metaData.getInt("android.app.bundle_local_qt_libs") == 1) {
- localPrefix = m_context.getApplicationInfo().dataDir + "/";
+ File dataDir = new File(m_context.getApplicationInfo().dataDir);
+ localPrefix = dataDir.getCanonicalPath() + "/";
pluginsPrefix = localPrefix + "qt-reserved-files/";
if (libsDir == null)
diff --git a/src/angle/patches/0002-ANGLE-Fix-compilation-with-MinGW.patch b/src/angle/patches/0002-ANGLE-Fix-compilation-with-MinGW.patch
index dc091b0497b..f42ff2141b4 100644
--- a/src/angle/patches/0002-ANGLE-Fix-compilation-with-MinGW.patch
+++ b/src/angle/patches/0002-ANGLE-Fix-compilation-with-MinGW.patch
@@ -405,15 +405,6 @@ index ea84783..62badcc 100644
if (mD3d11Module)
{
-@@ -2618,7 +2642,7 @@ bool Renderer11::getShareHandleSupport() const
-
- if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_WARP)
- {
--#ifndef ANGLE_ENABLE_WINDOWS_STORE
-+#if !defined(ANGLE_ENABLE_WINDOWS_STORE) && !defined(__GNUC__)
- if (!IsWindows8OrGreater())
- {
- // WARP on Windows 7 doesn't support shared handles
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
index 62e9816..b4e7761 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
diff --git a/src/angle/patches/0016-ANGLE-Fix-resizing-of-windows.patch b/src/angle/patches/0016-ANGLE-Fix-resizing-of-windows.patch
new file mode 100644
index 00000000000..7ba92052f27
--- /dev/null
+++ b/src/angle/patches/0016-ANGLE-Fix-resizing-of-windows.patch
@@ -0,0 +1,57 @@
+From 55821d34b2208e7858dbba5648760b83c66b58a5 Mon Sep 17 00:00:00 2001
+From: Oliver Wolff
+Date: Mon, 29 Aug 2016 09:48:28 +0200
+Subject: [PATCH] ANGLE: Fix resizing of windows
+
+Use the correct height/width values when calculating
+the vector for resizing the window content and the
+new size as viewport size.
+
+Task-number: QTBUG-62475
+Change-Id: I33a8dc1379a908e991b04bc31dfc6254a6d005c9
+---
+ .../libANGLE/renderer/d3d/d3d11/SwapChain11.cpp | 35 +++++++++++-----------
+ 1 file changed, 17 insertions(+), 18 deletions(-)
+
+diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
+index 785a83cd77..fe72bc935d 100644
+--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
+@@ -707,15 +706,15 @@ EGLint SwapChain11::copyOffscreenToBackbuffer(EGLint x, EGLint y, EGLint width,
+ d3d11::PositionTexCoordVertex *vertices = static_cast(mappedResource.pData);
+
+ // Create a quad in homogeneous coordinates
+- float x1 = (x / float(mWidth)) * 2.0f - 1.0f;
+- float y1 = (y / float(mHeight)) * 2.0f - 1.0f;
+- float x2 = ((x + width) / float(mWidth)) * 2.0f - 1.0f;
+- float y2 = ((y + height) / float(mHeight)) * 2.0f - 1.0f;
++ float x1 = (x / float(width)) * 2.0f - 1.0f;
++ float y1 = (y / float(height)) * 2.0f - 1.0f;
++ float x2 = ((x + width) / float(width)) * 2.0f - 1.0f;
++ float y2 = ((y + height) / float(height)) * 2.0f - 1.0f;
+
+- float u1 = x / float(mWidth);
+- float v1 = y / float(mHeight);
+- float u2 = (x + width) / float(mWidth);
+- float v2 = (y + height) / float(mHeight);
++ float u1 = x / float(width);
++ float v1 = y / float(height);
++ float u2 = (x + width) / float(width);
++ float v2 = (y + height) / float(height);
+
+ // Invert the quad vertices depending on the surface orientation.
+ if ((mOrientation & EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE) != 0)
+@@ -760,8 +759,8 @@ EGLint SwapChain11::copyOffscreenToBackbuffer(EGLint x, EGLint y, EGLint width,
+ D3D11_VIEWPORT viewport;
+ viewport.TopLeftX = 0;
+ viewport.TopLeftY = 0;
+- viewport.Width = static_cast(mWidth);
+- viewport.Height = static_cast(mHeight);
++ viewport.Width = static_cast(width);
++ viewport.Height = static_cast(height);
+ viewport.MinDepth = 0.0f;
+ viewport.MaxDepth = 1.0f;
+ deviceContext->RSSetViewports(1, &viewport);
+--
+2.15.0.windows.1
+
diff --git a/src/concurrent/doc/qtconcurrent.qdocconf b/src/concurrent/doc/qtconcurrent.qdocconf
index d8ee963ef5c..356d602a7c4 100644
--- a/src/concurrent/doc/qtconcurrent.qdocconf
+++ b/src/concurrent/doc/qtconcurrent.qdocconf
@@ -36,6 +36,8 @@ exampledirs += ../../../examples/qtconcurrent \
../ \
snippets
+manifestmeta.highlighted.names = "QtConcurrent/QtConcurrent Progress Dialog Example"
+
excludedirs += ../../../examples/widgets/doc
imagedirs += images
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 2041b8816e4..e445037efb2 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -299,13 +299,13 @@ void QUnifiedTimer::stopAnimationDriver()
driver->stop();
}
-void QUnifiedTimer::updateAnimationTimers(qint64)
+void QUnifiedTimer::updateAnimationTimers(qint64 currentTick)
{
//setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations
if(insideTick)
return;
- qint64 totalElapsed = elapsed();
+ qint64 totalElapsed = currentTick > 0 ? currentTick : elapsed();
// ignore consistentTiming in case the pause timer is active
qint64 delta = (consistentTiming && !pauseTimer.isActive()) ?
diff --git a/src/corelib/configure.json b/src/corelib/configure.json
index 8067ca70f13..8cd73d6ce49 100644
--- a/src/corelib/configure.json
+++ b/src/corelib/configure.json
@@ -178,7 +178,7 @@
"slog2": {
"label": "slog2",
"test": {
- "include": "slog2.h",
+ "include": "sys/slog2.h",
"main": "slog2_set_default_buffer((slog2_buffer_t)-1);"
},
"export": "",
@@ -349,6 +349,15 @@
"qmake": "linux: LIBS += -lpthread -lrt"
}
},
+ "linkat": {
+ "label": "linkat()",
+ "type": "compile",
+ "test": {
+ "head": "#define _ATFILE_SOURCE 1",
+ "include": [ "fcntl.h", "unistd.h" ],
+ "main": "linkat(AT_FDCWD, \"foo\", AT_FDCWD, \"bar\", AT_SYMLINK_FOLLOW);"
+ }
+ },
"ppoll": {
"label": "ppoll()",
"type": "compile",
@@ -540,6 +549,12 @@
"condition": "libs.journald",
"output": [ "privateFeature" ]
},
+ "linkat": {
+ "label": "linkat()",
+ "autoDetect": "config.linux",
+ "condition": "tests.linkat",
+ "output": [ "privateFeature" ]
+ },
"std-atomic64": {
"label": "64 bit atomic operations",
"condition": "libs.libatomic",
@@ -593,7 +608,7 @@
"label": "PPS",
"emitIf": "config.qnx",
"condition": "libs.pps",
- "output": [ "privateConfig" ]
+ "output": [ "privateFeature" ]
},
"qeventtransition": {
"label": "QEventTransition class",
diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf
index 3d64708def4..5a42e21845e 100644
--- a/src/corelib/doc/qtcore.qdocconf
+++ b/src/corelib/doc/qtcore.qdocconf
@@ -45,5 +45,8 @@ excludedirs += snippets
excludefiles += ../../../examples/widgets/tools/customcompleter/doc/src/customcompleter.qdoc \
../../../examples/widgets/tools/codecs/doc/src/codecs.qdoc
+manifestmeta.highlighted.names = "QtCore/JSON Save Game Example" \
+ "QtCore/Local Fortune*"
+
navigation.landingpage = "Qt Core"
navigation.cppclassespage = "Qt Core C++ Classes"
diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp
index 3d09e3618e7..b936f0c057e 100644
--- a/src/corelib/doc/snippets/qstring/main.cpp
+++ b/src/corelib/doc/snippets/qstring/main.cpp
@@ -750,7 +750,6 @@ void Widget::sizeFunction()
int n = str.size(); // n == 5
str.data()[0]; // returns 'W'
str.data()[4]; // returns 'd'
- str.data()[5]; // returns '\0'
//! [58]
}
@@ -810,6 +809,18 @@ void Widget::splitCaseSensitiveFunction()
QStringList list2 = str.split(',', QString::SkipEmptyParts);
// list2: [ "a", "b", "c" ]
//! [62]
+
+ //! [62-empty]
+ QString str = "abc";
+ auto parts = str.split("");
+ // parts: {"", "a", "b", "c", ""}
+ //! [62-empty]
+
+ //! [62-slashes]
+ QString str = "/a/b/c/";
+ auto parts = str.split('/');
+ // parts: {"", "a", "b", "c", ""}
+ //! [62-slashes]
}
void Widget::sprintfFunction()
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index a878a83bcba..2b4fd6d661b 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -63,7 +63,10 @@ unset(f16c_cxx)
VERSIONTAGGING_SOURCES = global/qversiontagging.cpp
darwin: SOURCES += global/qoperatingsystemversion_darwin.mm
-win32: SOURCES += global/qoperatingsystemversion_win.cpp
+win32 {
+ SOURCES += global/qoperatingsystemversion_win.cpp
+ HEADERS += global/qoperatingsystemversion_win_p.h
+}
# qlibraryinfo.cpp includes qconfig.cpp
INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global
diff --git a/src/corelib/global/minimum-linux_p.h b/src/corelib/global/minimum-linux_p.h
index 324744b856d..bad2488b4de 100644
--- a/src/corelib/global/minimum-linux_p.h
+++ b/src/corelib/global/minimum-linux_p.h
@@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE
* - inotify_init1 before 2.6.12-rc12
* - futex(2) before 2.6.12-rc12
* - FUTEX_WAKE_OP 2.6.14 FUTEX_OP
- * - linkat(2) 2.6.17 O_TMPFILE
+ * - linkat(2) 2.6.17 O_TMPFILE && QT_CONFIG(linkat)
* - FUTEX_PRIVATE_FLAG 2.6.22
* - O_CLOEXEC 2.6.23
* - eventfd 2.6.23
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
index eb56d2d0cd8..0df593941d3 100644
--- a/src/corelib/global/qconfig-bootstrapped.h
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -87,6 +87,11 @@
#define QT_FEATURE_futimens -1
#define QT_FEATURE_futimes -1
#define QT_FEATURE_library -1
+#ifdef __linux__
+# define QT_FEATURE_linkat 1
+#else
+# define QT_FEATURE_linkat -1
+#endif
#define QT_NO_QOBJECT
#define QT_FEATURE_process -1
#define QT_FEATURE_regularexpression -1
diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp
index 129ab4ded24..3046a472928 100644
--- a/src/corelib/global/qfloat16.cpp
+++ b/src/corelib/global/qfloat16.cpp
@@ -129,8 +129,8 @@ extern "C" {
# define f16cextern extern
#endif
-f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qssize_t len) Q_DECL_NOTHROW;
-f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qssize_t len) Q_DECL_NOTHROW;
+f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW;
+f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW;
#undef f16cextern
}
@@ -141,20 +141,20 @@ static inline bool hasFastF16()
return true;
}
-static void qFloatToFloat16_fast(quint16 *out, const float *in, qssize_t len) Q_DECL_NOTHROW
+static void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
{
__fp16 *out_f16 = reinterpret_cast<__fp16 *>(out);
- qssize_t i = 0;
+ qsizetype i = 0;
for (; i < len - 3; i += 4)
vst1_f16(out_f16 + i, vcvt_f16_f32(vld1q_f32(in + i)));
SIMD_EPILOGUE(i, len, 3)
out_f16[i] = __fp16(in[i]);
}
-static void qFloatFromFloat16_fast(float *out, const quint16 *in, qssize_t len) Q_DECL_NOTHROW
+static void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW
{
const __fp16 *in_f16 = reinterpret_cast(in);
- qssize_t i = 0;
+ qsizetype i = 0;
for (; i < len - 3; i += 4)
vst1q_f32(out + i, vcvt_f32_f16(vld1_f16(in_f16 + i)));
SIMD_EPILOGUE(i, len, 3)
@@ -166,12 +166,12 @@ static inline bool hasFastF16()
return false;
}
-static void qFloatToFloat16_fast(quint16 *, const float *, qssize_t) Q_DECL_NOTHROW
+static void qFloatToFloat16_fast(quint16 *, const float *, qsizetype) Q_DECL_NOTHROW
{
Q_UNREACHABLE();
}
-static void qFloatFromFloat16_fast(float *, const quint16 *, qssize_t) Q_DECL_NOTHROW
+static void qFloatFromFloat16_fast(float *, const quint16 *, qsizetype) Q_DECL_NOTHROW
{
Q_UNREACHABLE();
}
@@ -182,12 +182,12 @@ static void qFloatFromFloat16_fast(float *, const quint16 *, qssize_t) Q_DECL_NO
Converts \a len floats from \a in to qfloat16 and stores them in \a out.
Both \a in and \a out must have \a len allocated entries.
*/
-Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qssize_t len) Q_DECL_NOTHROW
+Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
{
if (hasFastF16())
return qFloatToFloat16_fast(reinterpret_cast(out), in, len);
- for (qssize_t i = 0; i < len; ++i)
+ for (qsizetype i = 0; i < len; ++i)
out[i] = qfloat16(in[i]);
}
@@ -197,12 +197,12 @@ Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qssize_t len)
Converts \a len qfloat16 from \a in to floats and stores them in \a out.
Both \a in and \a out must have \a len allocated entries.
*/
-Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qssize_t len) Q_DECL_NOTHROW
+Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype len) Q_DECL_NOTHROW
{
if (hasFastF16())
return qFloatFromFloat16_fast(out, reinterpret_cast(in), len);
- for (qssize_t i = 0; i < len; ++i)
+ for (qsizetype i = 0; i < len; ++i)
out[i] = float(in[i]);
}
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h
index bf223bee0c5..a8befd7adb2 100644
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -88,8 +88,8 @@ private:
Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE);
-Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qssize_t length) Q_DECL_NOTHROW;
-Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qssize_t length) Q_DECL_NOTHROW;
+Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qsizetype length) Q_DECL_NOTHROW;
+Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length) Q_DECL_NOTHROW;
Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsInf(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
diff --git a/src/corelib/global/qfloat16_f16c.c b/src/corelib/global/qfloat16_f16c.c
index c88dbb6944e..31dff0b154f 100644
--- a/src/corelib/global/qfloat16_f16c.c
+++ b/src/corelib/global/qfloat16_f16c.c
@@ -54,9 +54,9 @@ extern "C" {
#endif
QT_FUNCTION_TARGET(F16C)
-void qFloatToFloat16_fast(quint16 *out, const float *in, qssize_t len) Q_DECL_NOTHROW
+void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
{
- qssize_t i = 0;
+ qsizetype i = 0;
for (; i < len - 7; i += 8)
_mm_storeu_si128((__m128i *)(out + i), _mm256_cvtps_ph(_mm256_loadu_ps(in + i), 0));
if (i < len - 3) {
@@ -69,9 +69,9 @@ void qFloatToFloat16_fast(quint16 *out, const float *in, qssize_t len) Q_DECL_NO
}
QT_FUNCTION_TARGET(F16C)
-void qFloatFromFloat16_fast(float *out, const quint16 *in, qssize_t len) Q_DECL_NOTHROW
+void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW
{
- qssize_t i = 0;
+ qsizetype i = 0;
for (; i < len - 7; i += 8)
_mm256_storeu_ps(out + i, _mm256_cvtph_ps(_mm_loadu_si128((const __m128i *)(in + i))));
if (i < len - 3) {
diff --git a/src/corelib/global/qfloat16_p.h b/src/corelib/global/qfloat16_p.h
index ae52e644351..f3fc96e1198 100644
--- a/src/corelib/global/qfloat16_p.h
+++ b/src/corelib/global/qfloat16_p.h
@@ -61,9 +61,9 @@ static inline bool qt_is_inf(qfloat16 d) Q_DECL_NOTHROW
bool is_inf;
uchar *ch = (uchar *)&d;
if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
- is_inf = (ch[0] & 0x7c) == 0x7c;
+ is_inf = (ch[0] & 0x7c) == 0x7c && (ch[0] & 0x02) == 0;
else
- is_inf = (ch[1] & 0x7c) == 0x7c;
+ is_inf = (ch[1] & 0x7c) == 0x7c && (ch[1] & 0x02) == 0;
return is_inf;
}
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index c3b074c59f0..a8fa7654ba7 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -46,6 +46,9 @@
#include "qdatetime.h"
#include "qoperatingsystemversion.h"
#include "qoperatingsystemversion_p.h"
+#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINRT)
+#include "qoperatingsystemversion_win_p.h"
+#endif
#include
#include
@@ -164,8 +167,8 @@ Q_STATIC_ASSERT_X(std::numeric_limits::radix == 2,
// not required by the definition of size_t, but we depend on this
Q_STATIC_ASSERT_X(sizeof(size_t) == sizeof(void *), "size_t and a pointer don't have the same size");
-Q_STATIC_ASSERT(sizeof(size_t) == sizeof(qssize_t)); // implied by the definition
-Q_STATIC_ASSERT((std::is_same::value));
+Q_STATIC_ASSERT(sizeof(size_t) == sizeof(qsizetype)); // implied by the definition
+Q_STATIC_ASSERT((std::is_same::value));
/*!
\class QFlag
@@ -827,7 +830,7 @@ Q_STATIC_ASSERT((std::is_same::value));
*/
/*!
- \typedef qssize_t
+ \typedef qsizetype
\relates
\since 5.10
@@ -836,7 +839,7 @@ Q_STATIC_ASSERT((std::is_same::value));
This type is guaranteed to be the same size as a \c size_t on all
platforms supported by Qt.
- Note that qssize_t is signed. Use \c size_t for unsigned values.
+ Note that qsizetype is signed. Use \c size_t for unsigned values.
\sa qptrdiff
*/
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index d439085dbc2..7873ab2b438 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -250,7 +250,7 @@ typedef quint64 qulonglong;
// In C++ mode, we define below using QIntegerForSize template
Q_STATIC_ASSERT_X(sizeof(ptrdiff_t) == sizeof(size_t), "Weird ptrdiff_t and size_t definitions");
typedef ptrdiff_t qptrdiff;
-typedef ptrdiff_t qssize_t;
+typedef ptrdiff_t qsizetype;
typedef ptrdiff_t qintptr;
typedef size_t quintptr;
#endif
@@ -475,7 +475,7 @@ namespace QtPrivate {
sizeof(void *) == sizeof(quintptr)
&& sizeof(void *) == sizeof(qptrdiff)
- size_t and qssize_t are not guaranteed to be the same size as a pointer, but
+ size_t and qsizetype are not guaranteed to be the same size as a pointer, but
they usually are.
*/
template struct QIntegerForSize;
@@ -492,7 +492,7 @@ typedef QIntegerForSize::Unsigned qregisteruint;
typedef QIntegerForSizeof::Unsigned quintptr;
typedef QIntegerForSizeof::Signed qptrdiff;
typedef qptrdiff qintptr;
-using qssize_t = QIntegerForSizeof::Signed;
+using qsizetype = QIntegerForSizeof::Signed;
/* moc compats (signals/slots) */
#ifndef QT_MOC_COMPAT
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 6602d53b089..0861763492b 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -61,7 +61,10 @@
#include
#endif
#if QT_CONFIG(slog2)
-#include
+#include
+#endif
+#if QT_HAS_INCLUDE()
+#include
#endif
#ifdef Q_OS_ANDROID
@@ -215,8 +218,11 @@ static bool willLogToConsole()
# ifdef Q_OS_WIN
return GetConsoleWindow();
# elif defined(Q_OS_UNIX)
+# ifndef _PATH_TTY
+# define _PATH_TTY "/dev/tty"
+# endif
// if /dev/tty exists, we can only open it if we have a controlling TTY
- int devtty = qt_safe_open("/dev/tty", O_RDONLY);
+ int devtty = qt_safe_open(_PATH_TTY, O_RDONLY);
if (devtty == -1 && (errno == ENOENT || errno == EPERM || errno == ENXIO)) {
// no /dev/tty, fall back to isatty on stderr
return isatty(STDERR_FILENO);
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 38f194afb50..2773992b471 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -477,6 +477,8 @@ public:
WA_TabletTracking = 129,
+ WA_ContentsMarginsRespectsSafeArea = 130,
+
// Add new attributes before this line
WA_AttributeCount
};
diff --git a/src/corelib/global/qoperatingsystemversion_win.cpp b/src/corelib/global/qoperatingsystemversion_win.cpp
index 060ca2f7da6..f3662ae1f90 100644
--- a/src/corelib/global/qoperatingsystemversion_win.cpp
+++ b/src/corelib/global/qoperatingsystemversion_win.cpp
@@ -37,7 +37,10 @@
**
****************************************************************************/
+#include "qoperatingsystemversion_win_p.h"
+
#include "qoperatingsystemversion_p.h"
+
#include
#include
diff --git a/src/corelib/global/qoperatingsystemversion_win_p.h b/src/corelib/global/qoperatingsystemversion_win_p.h
new file mode 100644
index 00000000000..446bd286fcd
--- /dev/null
+++ b/src/corelib/global/qoperatingsystemversion_win_p.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QOPERATINGSYSTEMVERSION_WIN_P_H
+#define QOPERATINGSYSTEMVERSION_WIN_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include
+#include
+
+QT_BEGIN_NAMESPACE
+
+OSVERSIONINFOEX qWindowsVersionInfo();
+
+QT_END_NAMESPACE
+
+#endif // QOPERATINGSYSTEMVERSION_WIN_P_H
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp
index 7da86188bbe..f5c01aeaa6e 100644
--- a/src/corelib/global/qrandom.cpp
+++ b/src/corelib/global/qrandom.cpp
@@ -93,7 +93,7 @@ DECLSPEC_IMPORT BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG Rando
QT_BEGIN_NAMESPACE
#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
-static qssize_t qt_random_cpu(void *buffer, qssize_t count) Q_DECL_NOTHROW;
+static qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW;
# ifdef Q_PROCESSOR_X86_64
# define _rdrandXX_step _rdrand64_step
@@ -101,7 +101,7 @@ static qssize_t qt_random_cpu(void *buffer, qssize_t count) Q_DECL_NOTHROW;
# define _rdrandXX_step _rdrand32_step
# endif
-static QT_FUNCTION_TARGET(RDRND) qssize_t qt_random_cpu(void *buffer, qssize_t count) Q_DECL_NOTHROW
+static QT_FUNCTION_TARGET(RDRND) qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW
{
unsigned *ptr = reinterpret_cast(buffer);
unsigned *end = ptr + count;
@@ -122,7 +122,7 @@ out:
return ptr - reinterpret_cast(buffer);
}
#else
-static qssize_t qt_random_cpu(void *, qssize_t)
+static qsizetype qt_random_cpu(void *, qsizetype)
{
return 0;
}
@@ -136,10 +136,10 @@ enum {
struct QRandomGenerator::SystemGenerator
{
#if QT_CONFIG(getentropy)
- static qssize_t fillBuffer(void *buffer, qssize_t count) Q_DECL_NOTHROW
+ static qsizetype fillBuffer(void *buffer, qsizetype count) Q_DECL_NOTHROW
{
// getentropy can read at most 256 bytes, so break the reading
- qssize_t read = 0;
+ qsizetype read = 0;
while (count - read > 256) {
// getentropy can't fail under normal circumstances
int ret = getentropy(reinterpret_cast(buffer) + read, 256);
@@ -195,24 +195,24 @@ struct QRandomGenerator::SystemGenerator
Q_DECL_CONSTEXPR SystemGenerator() : fdp1 Q_BASIC_ATOMIC_INITIALIZER(0) {}
- qssize_t fillBuffer(void *buffer, qssize_t count)
+ qsizetype fillBuffer(void *buffer, qsizetype count)
{
int fd = openDevice();
if (Q_UNLIKELY(fd < 0))
return 0;
qint64 n = qt_safe_read(fd, buffer, count);
- return qMax(n, 0); // ignore any errors
+ return qMax(n, 0); // ignore any errors
}
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
- qssize_t fillBuffer(void *buffer, qssize_t count) Q_DECL_NOTHROW
+ qsizetype fillBuffer(void *buffer, qsizetype count) Q_DECL_NOTHROW
{
auto RtlGenRandom = SystemFunction036;
return RtlGenRandom(buffer, ULONG(count)) ? count: 0;
}
#elif defined(Q_OS_WINRT)
- qssize_t fillBuffer(void *, qssize_t) Q_DECL_NOTHROW
+ qsizetype fillBuffer(void *, qsizetype) Q_DECL_NOTHROW
{
// always use the fallback
return 0;
@@ -243,7 +243,7 @@ struct QRandomGenerator::SystemGenerator
#if defined(Q_OS_WIN)
static void fallback_update_seed(unsigned) {}
-static void fallback_fill(quint32 *ptr, qssize_t left) Q_DECL_NOTHROW
+static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
{
// on Windows, rand_s is a high-quality random number generator
// and it requires no seeding
@@ -255,14 +255,14 @@ static void fallback_fill(quint32 *ptr, qssize_t left) Q_DECL_NOTHROW
}
#elif QT_CONFIG(getentropy)
static void fallback_update_seed(unsigned) {}
-static void fallback_fill(quint32 *, qssize_t) Q_DECL_NOTHROW
+static void fallback_fill(quint32 *, qsizetype) Q_DECL_NOTHROW
{
// no fallback necessary, getentropy cannot fail under normal circumstances
Q_UNREACHABLE();
}
#elif defined(Q_OS_BSD4)
static void fallback_update_seed(unsigned) {}
-static void fallback_fill(quint32 *ptr, qssize_t left) Q_DECL_NOTHROW
+static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
{
// BSDs have arc4random(4) and these work even in chroot(2)
arc4random_buf(ptr, left * sizeof(*ptr));
@@ -281,7 +281,7 @@ Q_NEVER_INLINE
#ifdef Q_CC_GNU
__attribute__((cold)) // this function is pretty big, so optimize for size
#endif
-static void fallback_fill(quint32 *ptr, qssize_t left) Q_DECL_NOTHROW
+static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
{
quint32 scratch[12]; // see element count below
quint32 *end = scratch;
@@ -358,7 +358,7 @@ Q_NEVER_INLINE void QRandomGenerator::SystemGenerator::generate(quint32 *begin,
Q_DECL_NOEXCEPT_EXPR(FillBufferNoexcept)
{
quint32 *buffer = begin;
- qssize_t count = end - begin;
+ qsizetype count = end - begin;
if (Q_UNLIKELY(uint(qt_randomdevice_control) & SetRandomData)) {
uint value = uint(qt_randomdevice_control) & RandomDataMask;
@@ -366,14 +366,14 @@ Q_NEVER_INLINE void QRandomGenerator::SystemGenerator::generate(quint32 *begin,
return;
}
- qssize_t filled = 0;
+ qsizetype filled = 0;
if (qt_has_hwrng() && (uint(qt_randomdevice_control) & SkipHWRNG) == 0)
filled += qt_random_cpu(buffer, count);
if (filled != count && (uint(qt_randomdevice_control) & SkipSystemRNG) == 0) {
- qssize_t bytesFilled =
- fillBuffer(buffer + filled, (count - filled) * qssize_t(sizeof(*buffer)));
- filled += bytesFilled / qssize_t(sizeof(*buffer));
+ qsizetype bytesFilled =
+ fillBuffer(buffer + filled, (count - filled) * qsizetype(sizeof(*buffer)));
+ filled += bytesFilled / qsizetype(sizeof(*buffer));
}
if (filled)
fallback_update_seed(*buffer);
@@ -655,6 +655,11 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\sa QRandomGenerator64, qrand()
*/
+/*!
+ \enum QRandomGenerator::System
+ \internal
+*/
+
/*!
\fn QRandomGenerator::QRandomGenerator(quint32 seedValue)
@@ -677,7 +682,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
*/
/*!
- \fn QRandomGenerator::QRandomGenerator(const quint32 *seedBuffer, qssize_t len)
+ \fn QRandomGenerator::QRandomGenerator(const quint32 *seedBuffer, qsizetype len)
\overload
Initializes this QRandomGenerator object with \a len values found in
@@ -694,7 +699,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
*/
/*!
- \fn QRandomGenerator::QRandomGenerator(const quint32 *begin, const quin32 *end)
+ \fn QRandomGenerator::QRandomGenerator(const quint32 *begin, const quint32 *end)
\overload
Initializes this QRandomGenerator object with the values found in the range
@@ -762,7 +767,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
A typedef to the type that operator()() returns. That is, quint32.
- \sa operator()()
+ \sa {QRandomGenerator::operator()}{operator()()}
*/
/*!
@@ -773,6 +778,22 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\sa generate(), generate64()
*/
+/*!
+ \fn quint32 QRandomGenerator::generate()
+
+ Generates a 32-bit random quantity and returns it.
+
+ \sa {QRandomGenerator::operator()}{operator()()}, generate64()
+ */
+
+/*!
+ \fn quint64 QRandomGenerator::generate64()
+
+ Generates a 64-bit random quantity and returns it.
+
+ \sa {QRandomGenerator::operator()}{operator()()}, generate()
+ */
+
/*!
\fn result_type QRandomGenerator::min()
@@ -800,7 +821,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\fn void QRandomGenerator::seed(std::seed_seq &seed)
\overload
- Reseeds this object using the seed sequence \a sseq as the seed.
+ Reseeds this object using the seed sequence \a seed as the seed.
*/
/*!
@@ -826,7 +847,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\endcode
This function complies with the requirements for the function
- \c{\l{http://en.cppreference.com/w/cpp/numeric/random/seed_seq/generate}{std::seed_seq::generate}},
+ \l{http://en.cppreference.com/w/cpp/numeric/random/seed_seq/generate}{\c std::seed_seq::generate},
which requires unsigned 32-bit integer values.
Note that if the [begin, end) range refers to an area that can store more
@@ -853,7 +874,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
*/
/*!
- \fn void QRandomGenerator::fillRange(UInt *buffer, qssize_t count)
+ \fn void QRandomGenerator::fillRange(UInt *buffer, qsizetype count)
Generates \a count 32- or 64-bit quantities (depending on the type \c UInt)
and stores them in the buffer pointed by \a buffer. This is the most
@@ -906,16 +927,16 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
\endcode
The same may also be obtained by using
- \c{\l{http://en.cppreference.com/w/cpp/numeric/random/uniform_real_distribution}{std::uniform_real_distribution}}
+ \l{http://en.cppreference.com/w/cpp/numeric/random/uniform_real_distribution}{\c std::uniform_real_distribution}
with parameters 0 and 1.
\sa generate(), generate64(), bounded()
*/
/*!
- \fn qreal QRandomGenerator::bounded(qreal highest)
+ \fn double QRandomGenerator::bounded(double highest)
- Generates one random qreal in the range between 0 (inclusive) and \a
+ Generates one random double in the range between 0 (inclusive) and \a
highest (exclusive). This function is equivalent to and is implemented as:
\code
@@ -931,7 +952,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
Generates one random 32-bit quantity in the range between 0 (inclusive) and
\a highest (exclusive). The same result may also be obtained by using
- \c{\l{http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution}{std::uniform_int_distribution}}
+ \l{http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution}{\c std::uniform_int_distribution}
with parameters 0 and \c{highest - 1}. That class can also be used to obtain
quantities larger than 32 bits.
@@ -969,7 +990,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
Generates one random 32-bit quantity in the range between \a lowest (inclusive)
and \a highest (exclusive). The same result may also be obtained by using
- \c{\l{http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution}{std::uniform_int_distribution}}
+ \l{http://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution}{\c std::uniform_int_distribution}
with parameters \a lowest and \c{\a highest - 1}. That class can also be used to
obtain quantities larger than 32 bits.
@@ -1098,7 +1119,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
A typedef to the type that operator()() returns. That is, quint64.
- \sa operator()()
+ \sa {QRandomGenerator64::operator()}{operator()()}
*/
/*!
@@ -1169,7 +1190,9 @@ QRandomGenerator64 QRandomGenerator64::securelySeeded()
return result;
}
-/// \internal
+/*!
+ \internal
+*/
inline QRandomGenerator::QRandomGenerator(System)
: type(SystemRNG)
{
diff --git a/src/corelib/global/qrandom.h b/src/corelib/global/qrandom.h
index bde64646a48..46d3e0e1526 100644
--- a/src/corelib/global/qrandom.h
+++ b/src/corelib/global/qrandom.h
@@ -44,6 +44,13 @@
#include // for std::generate
#include // for std::mt19937
+#ifdef min
+# undef min
+#endif
+#ifdef max
+# undef max
+#endif
+
QT_BEGIN_NAMESPACE
class QRandomGenerator
@@ -55,10 +62,10 @@ public:
QRandomGenerator(quint32 seedValue = 1)
: QRandomGenerator(&seedValue, 1)
{}
- template QRandomGenerator(const quint32 (&seedBuffer)[N])
+ template QRandomGenerator(const quint32 (&seedBuffer)[N])
: QRandomGenerator(seedBuffer, seedBuffer + N)
{}
- QRandomGenerator(const quint32 *seedBuffer, qssize_t len)
+ QRandomGenerator(const quint32 *seedBuffer, qsizetype len)
: QRandomGenerator(seedBuffer, seedBuffer + len)
{}
Q_CORE_EXPORT QRandomGenerator(std::seed_seq &sseq) Q_DECL_NOTHROW;
@@ -131,7 +138,7 @@ public:
}
template = true>
- void fillRange(UInt *buffer, qssize_t count)
+ void fillRange(UInt *buffer, qsizetype count)
{
_fillRange(buffer, buffer + count);
}
@@ -160,8 +167,8 @@ public:
void seed(quint32 s = 1) { *this = { s }; }
void seed(std::seed_seq &sseq) Q_DECL_NOTHROW { *this = { sseq }; }
Q_CORE_EXPORT void discard(unsigned long long z);
- static Q_DECL_CONSTEXPR result_type min() { return (std::numeric_limits::min)(); }
- static Q_DECL_CONSTEXPR result_type max() { return (std::numeric_limits::max)(); }
+ static Q_DECL_CONSTEXPR result_type min() { return std::numeric_limits::min(); }
+ static Q_DECL_CONSTEXPR result_type max() { return std::numeric_limits::max(); }
static inline Q_DECL_CONST_FUNCTION QRandomGenerator *system();
static inline Q_DECL_CONST_FUNCTION QRandomGenerator *global();
@@ -177,7 +184,8 @@ private:
friend class QRandomGenerator64;
struct SystemGenerator;
struct SystemAndGlobalGenerators;
- typedef std::mt19937 RandomEngine;
+ using RandomEngine = std::mersenne_twister_engine;
union Storage {
uint dummy;
@@ -214,10 +222,10 @@ public:
QRandomGenerator64(quint32 seedValue = 1)
: QRandomGenerator(seedValue)
{}
- template QRandomGenerator64(const quint32 (&seedBuffer)[N])
+ template QRandomGenerator64(const quint32 (&seedBuffer)[N])
: QRandomGenerator(seedBuffer)
{}
- QRandomGenerator64(const quint32 *seedBuffer, qssize_t len)
+ QRandomGenerator64(const quint32 *seedBuffer, qsizetype len)
: QRandomGenerator(seedBuffer, len)
{}
QRandomGenerator64(std::seed_seq &sseq) Q_DECL_NOTHROW
@@ -235,8 +243,8 @@ public:
QRandomGenerator::discard(z * 2);
}
- static Q_DECL_CONSTEXPR result_type min() { return (std::numeric_limits::min)(); }
- static Q_DECL_CONSTEXPR result_type max() { return (std::numeric_limits::max)(); }
+ static Q_DECL_CONSTEXPR result_type min() { return std::numeric_limits::min(); }
+ static Q_DECL_CONSTEXPR result_type max() { return std::numeric_limits::max(); }
static Q_DECL_CONST_FUNCTION Q_CORE_EXPORT QRandomGenerator64 *system();
static Q_DECL_CONST_FUNCTION Q_CORE_EXPORT QRandomGenerator64 *global();
static Q_CORE_EXPORT QRandomGenerator64 securelySeeded();
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index bac995ff25d..e4888e9523e 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -503,7 +503,8 @@ bool
QFile::remove()
{
Q_D(QFile);
- if (d->fileName.isEmpty()) {
+ if (d->fileName.isEmpty() &&
+ !static_cast(d->engine())->isUnnamedFile()) {
qWarning("QFile::remove: Empty or null file name");
return false;
}
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index d77cdc123cc..b974af80dcf 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -55,6 +55,13 @@
#include
#include
+#if QT_HAS_INCLUDE()
+# include
+#endif
+#ifndef _PATH_TMP // from
+# define _PATH_TMP "/tmp"
+#endif
+
#if defined(Q_OS_MAC)
# include
# include
@@ -102,8 +109,22 @@ static int statx(int dirfd, const char *pathname, int flag, unsigned mask, struc
# endif
#endif
+#ifndef STATX_BASIC_STATS
+struct statx { mode_t stx_mode; };
+#endif
+
QT_BEGIN_NAMESPACE
+enum {
+#ifdef Q_OS_ANDROID
+ // On Android, the link(2) system call has been observed to always fail
+ // with EACCES, regardless of whether there are permission problems or not.
+ SupportsHardlinking = false
+#else
+ SupportsHardlinking = true
+#endif
+};
+
#define emptyFileEntryWarning() emptyFileEntryWarning_(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC)
static void emptyFileEntryWarning_(const char *file, int line, const char *function)
{
@@ -202,6 +223,8 @@ static inline typename QtPrivate::QEnableIf<(&T::st_atimespec, &T::st_mtimespec,
modification->tv_usec = p->st_mtimespec.tv_nsec / 1000;
}
+# ifndef st_atimensec
+// if "st_atimensec" is defined, this would expand to invalid C++
template
static inline typename QtPrivate::QEnableIf<(&T::st_atimensec, &T::st_mtimensec, true)>::Type get(const T *p, struct timeval *access, struct timeval *modification)
{
@@ -211,6 +234,7 @@ static inline typename QtPrivate::QEnableIf<(&T::st_atimensec, &T::st_mtimensec,
modification->tv_sec = p->st_mtime;
modification->tv_usec = p->st_mtimensec / 1000;
}
+# endif
#endif
qint64 timespecToMSecs(const timespec &spec)
@@ -268,6 +292,7 @@ mtime(const T &statBuffer, int)
{ return timespecToMSecs(statBuffer.st_mtimespec); }
#endif
+#ifndef st_mtimensec
// Xtimensec
template
Q_DECL_UNUSED static typename std::enable_if<(&T::st_atimensec, true), qint64>::type
@@ -288,8 +313,9 @@ template
Q_DECL_UNUSED static typename std::enable_if<(&T::st_mtimensec, true), qint64>::type
mtime(const T &statBuffer, int)
{ return statBuffer.st_mtime * Q_INT64_C(1000) + statBuffer.st_mtimensec / 1000000; }
-}
-}
+#endif
+} // namespace GetFileTimes
+} // unnamed namespace
#ifdef STATX_BASIC_STATS
static int qt_real_statx(int fd, const char *pathname, int flags, struct statx *statxBuffer)
@@ -385,7 +411,6 @@ inline void QFileSystemMetaData::fillFromStatxBuf(const struct statx &statxBuffe
groupId_ = statxBuffer.stx_gid;
}
#else
-struct statx { mode_t stx_mode; };
static int qt_statx(const char *, struct statx *)
{ return -ENOSYS; }
@@ -918,7 +943,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
data.entryFlags &= ~what;
const QByteArray nativeFilePath = entry.nativeFilePath();
- bool entryExists = true; // innocent until proven otherwise
+ int entryErrno = 0; // innocent until proven otherwise
// first, we may try lstat(2). Possible outcomes:
// - success and is a symlink: filesystem entry exists, but we need stat(2)
@@ -968,7 +993,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
}
} else {
// it doesn't exist
- entryExists = false;
+ entryErrno = errno;
data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;
}
@@ -976,8 +1001,8 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
}
// second, we try a regular stat(2)
- if (statResult != 0 && (what & QFileSystemMetaData::PosixStatFlags)) {
- if (entryExists && statResult == -1) {
+ if (statResult == -1 && (what & QFileSystemMetaData::PosixStatFlags)) {
+ if (entryErrno == 0 && statResult == -1) {
data.entryFlags &= ~QFileSystemMetaData::PosixStatFlags;
statResult = qt_statx(nativeFilePath, &statxBuffer);
if (statResult == -ENOSYS) {
@@ -991,7 +1016,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
}
if (statResult != 0) {
- entryExists = false;
+ entryErrno = errno;
data.birthTime_ = 0;
data.metadataChangeTime_ = 0;
data.modificationTime_ = 0;
@@ -1010,13 +1035,13 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
if (what & (QFileSystemMetaData::UserPermissions | QFileSystemMetaData::ExistsAttribute)) {
// calculate user permissions
auto checkAccess = [&](QFileSystemMetaData::MetaDataFlag flag, int mode) {
- if (!entryExists || (what & flag) == 0)
+ if (entryErrno != 0 || (what & flag) == 0)
return;
if (QT_ACCESS(nativeFilePath, mode) == 0) {
// access ok (and file exists)
data.entryFlags |= flag | QFileSystemMetaData::ExistsAttribute;
} else if (errno != EACCES && errno != EROFS) {
- entryExists = false;
+ entryErrno = errno;
}
};
@@ -1025,9 +1050,10 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
checkAccess(QFileSystemMetaData::UserExecutePermission, X_OK);
// if we still haven't found out if the file exists, try F_OK
- if (entryExists && (data.entryFlags & QFileSystemMetaData::ExistsAttribute) == 0) {
- entryExists = QT_ACCESS(nativeFilePath, F_OK) == 0;
- if (entryExists)
+ if (entryErrno == 0 && (data.entryFlags & QFileSystemMetaData::ExistsAttribute) == 0) {
+ if (QT_ACCESS(nativeFilePath, F_OK) == -1)
+ entryErrno = errno;
+ else
data.entryFlags |= QFileSystemMetaData::ExistsAttribute;
}
@@ -1037,13 +1063,13 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
#if defined(Q_OS_DARWIN)
if (what & QFileSystemMetaData::AliasType) {
- if (entryExists && hasResourcePropertyFlag(data, entry, kCFURLIsAliasFileKey))
+ if (entryErrno == 0 && hasResourcePropertyFlag(data, entry, kCFURLIsAliasFileKey))
data.entryFlags |= QFileSystemMetaData::AliasType;
data.knownFlagsMask |= QFileSystemMetaData::AliasType;
}
if (what & QFileSystemMetaData::BundleType) {
- if (entryExists && isPackage(data, entry))
+ if (entryErrno == 0 && isPackage(data, entry))
data.entryFlags |= QFileSystemMetaData::BundleType;
data.knownFlagsMask |= QFileSystemMetaData::BundleType;
@@ -1055,19 +1081,19 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
QString fileName = entry.fileName();
if ((fileName.size() > 0 && fileName.at(0) == QLatin1Char('.'))
#if defined(Q_OS_DARWIN)
- || (entryExists && hasResourcePropertyFlag(data, entry, kCFURLIsHiddenKey))
+ || (entryErrno == 0 && hasResourcePropertyFlag(data, entry, kCFURLIsHiddenKey))
#endif
)
data.entryFlags |= QFileSystemMetaData::HiddenAttribute;
data.knownFlagsMask |= QFileSystemMetaData::HiddenAttribute;
}
- if (!entryExists) {
+ if (entryErrno != 0) {
what &= ~QFileSystemMetaData::LinkType; // don't clear link: could be broken symlink
data.clearFlags(what);
return false;
}
- return data.hasFlags(what);
+ return true;
}
// static
@@ -1278,7 +1304,7 @@ bool QFileSystemEngine::renameFile(const QFileSystemEntry &source, const QFileSy
}
#endif
- if (::link(srcPath, tgtPath) == 0) {
+ if (SupportsHardlinking && ::link(srcPath, tgtPath) == 0) {
if (::unlink(srcPath) == 0)
return true;
@@ -1292,6 +1318,11 @@ bool QFileSystemEngine::renameFile(const QFileSystemEntry &source, const QFileSy
error = QSystemError(savedErrno, QSystemError::StandardLibraryError);
return false;
+ } else if (!SupportsHardlinking) {
+ // man 2 link on Linux has:
+ // EPERM The filesystem containing oldpath and newpath does not
+ // support the creation of hard links.
+ errno = EPERM;
}
switch (errno) {
@@ -1483,14 +1514,13 @@ QString QFileSystemEngine::tempPath()
#else
QString temp = QFile::decodeName(qgetenv("TMPDIR"));
if (temp.isEmpty()) {
+ if (false) {
#if defined(Q_OS_DARWIN) && !defined(QT_BOOTSTRAPPED)
- if (NSString *nsPath = NSTemporaryDirectory()) {
+ } else if (NSString *nsPath = NSTemporaryDirectory()) {
temp = QString::fromCFString((CFStringRef)nsPath);
- } else {
-#else
- {
#endif
- temp = QLatin1String("/tmp");
+ } else {
+ temp = QLatin1String(_PATH_TMP);
}
}
return QDir::cleanPath(temp);
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
old mode 100644
new mode 100755
index 944ca232eec..fadc058110e
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -160,6 +160,7 @@ static TRUSTEE_W currentUserTrusteeW;
static TRUSTEE_W worldTrusteeW;
static PSID currentUserSID = 0;
static PSID worldSID = 0;
+static HANDLE currentUserImpersonatedToken = nullptr;
QT_BEGIN_NAMESPACE
@@ -180,6 +181,11 @@ GlobalSid::~GlobalSid()
::FreeSid(worldSID);
worldSID = 0;
}
+
+ if (currentUserImpersonatedToken) {
+ ::CloseHandle(currentUserImpersonatedToken);
+ currentUserImpersonatedToken = nullptr;
+ }
}
GlobalSid::GlobalSid()
@@ -210,6 +216,12 @@ GlobalSid::GlobalSid()
::CloseHandle(token);
}
+ token = nullptr;
+ if (::OpenProcessToken(hnd, TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_DUPLICATE | STANDARD_RIGHTS_READ, &token)) {
+ ::DuplicateToken(token, SecurityImpersonation, ¤tUserImpersonatedToken);
+ ::CloseHandle(token);
+ }
+
{
// Create TRUSTEE for Everyone (World)
SID_IDENTIFIER_AUTHORITY worldAuth = { SECURITY_WORLD_SID_AUTHORITY };
@@ -724,15 +736,49 @@ bool QFileSystemEngine::fillPermissions(const QFileSystemEntry &entry, QFileSyst
ACCESS_MASK access_mask;
TRUSTEE_W trustee;
if (what & QFileSystemMetaData::UserPermissions) { // user
- data.knownFlagsMask |= QFileSystemMetaData::UserPermissions;
- if (GetEffectiveRightsFromAcl(pDacl, ¤tUserTrusteeW, &access_mask) != ERROR_SUCCESS)
- access_mask = (ACCESS_MASK)-1;
- if(access_mask & ReadMask)
- data.entryFlags |= QFileSystemMetaData::UserReadPermission;
- if(access_mask & WriteMask)
- data.entryFlags|= QFileSystemMetaData::UserWritePermission;
- if(access_mask & ExecMask)
- data.entryFlags|= QFileSystemMetaData::UserExecutePermission;
+ // Using AccessCheck because GetEffectiveRightsFromAcl doesn't account for elevation
+ if (currentUserImpersonatedToken) {
+ GENERIC_MAPPING mapping = {FILE_GENERIC_READ, FILE_GENERIC_WRITE, FILE_GENERIC_EXECUTE, FILE_ALL_ACCESS};
+ PRIVILEGE_SET privileges;
+ DWORD grantedAccess;
+ BOOL result;
+
+ data.knownFlagsMask |= QFileSystemMetaData::UserPermissions;
+ DWORD genericAccessRights = GENERIC_READ;
+ ::MapGenericMask(&genericAccessRights, &mapping);
+
+ DWORD privilegesLength = sizeof(privileges);
+ if (::AccessCheck(pSD, currentUserImpersonatedToken, genericAccessRights,
+ &mapping, &privileges, &privilegesLength, &grantedAccess, &result) && result) {
+ data.entryFlags |= QFileSystemMetaData::UserReadPermission;
+ }
+
+ privilegesLength = sizeof(privileges);
+ genericAccessRights = GENERIC_WRITE;
+ ::MapGenericMask(&genericAccessRights, &mapping);
+ if (::AccessCheck(pSD, currentUserImpersonatedToken, genericAccessRights,
+ &mapping, &privileges, &privilegesLength, &grantedAccess, &result) && result) {
+ data.entryFlags |= QFileSystemMetaData::UserWritePermission;
+ }
+
+ privilegesLength = sizeof(privileges);
+ genericAccessRights = GENERIC_EXECUTE;
+ ::MapGenericMask(&genericAccessRights, &mapping);
+ if (::AccessCheck(pSD, currentUserImpersonatedToken, genericAccessRights,
+ &mapping, &privileges, &privilegesLength, &grantedAccess, &result) && result) {
+ data.entryFlags |= QFileSystemMetaData::UserExecutePermission;
+ }
+ } else { // fallback to GetEffectiveRightsFromAcl
+ data.knownFlagsMask |= QFileSystemMetaData::UserPermissions;
+ if (GetEffectiveRightsFromAclW(pDacl, ¤tUserTrusteeW, &access_mask) != ERROR_SUCCESS)
+ access_mask = ACCESS_MASK(-1);
+ if (access_mask & ReadMask)
+ data.entryFlags |= QFileSystemMetaData::UserReadPermission;
+ if (access_mask & WriteMask)
+ data.entryFlags|= QFileSystemMetaData::UserWritePermission;
+ if (access_mask & ExecMask)
+ data.entryFlags|= QFileSystemMetaData::UserExecutePermission;
+ }
}
if (what & QFileSystemMetaData::OwnerPermissions) { // owner
data.knownFlagsMask |= QFileSystemMetaData::OwnerPermissions;
diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h
index 55e44d52c73..4d2a5acb9b9 100644
--- a/src/corelib/io/qfilesystemmetadata_p.h
+++ b/src/corelib/io/qfilesystemmetadata_p.h
@@ -64,6 +64,10 @@
# endif
#endif
+#ifdef Q_OS_UNIX
+struct statx;
+#endif
+
QT_BEGIN_NAMESPACE
class QFileSystemEngine;
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index bf90995fddc..16ba161b754 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -112,6 +112,9 @@ public:
qint64 write(const char *data, qint64 len) override;
bool cloneTo(QAbstractFileEngine *target) override;
+ virtual bool isUnnamedFile() const
+ { return false; }
+
bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) override;
bool supportsExtension(Extension extension) const override;
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index 1bf61017f67..b5f8e30b803 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -255,7 +255,7 @@ void QLoggingSettingsParser::parseNextLine(QStringRef line)
QLoggingRegistry::QLoggingRegistry()
: categoryFilter(defaultCategoryFilter)
{
- initalizeRules(); // Init on first use
+ initializeRules(); // Init on first use
}
static bool qtLoggingDebug()
@@ -284,7 +284,7 @@ static QVector loadRulesFromFile(const QString &filePath)
Initializes the rules database by loading
$QT_LOGGING_CONF, $QT_LOGGING_RULES, and .config/QtProject/qtlogging.ini.
*/
-void QLoggingRegistry::initalizeRules()
+void QLoggingRegistry::initializeRules()
{
QVector er, qr, cr;
// get rules from environment
diff --git a/src/corelib/io/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h
index a3857d35880..12a1f166b3a 100644
--- a/src/corelib/io/qloggingregistry_p.h
+++ b/src/corelib/io/qloggingregistry_p.h
@@ -113,7 +113,7 @@ class Q_AUTOTEST_EXPORT QLoggingRegistry
public:
QLoggingRegistry();
- void initalizeRules();
+ void initializeRules();
void registerCategory(QLoggingCategory *category, QtMsgType enableForLevel);
void unregisterCategory(QLoggingCategory *category);
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 41f4b2aa83a..2ee680a7c68 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -99,6 +99,10 @@ QT_END_NAMESPACE
#include
#endif
+#if QT_HAS_INCLUDE()
+#include
+#endif
+
QT_BEGIN_NAMESPACE
/*!
@@ -2637,6 +2641,8 @@ QString QProcess::nullDevice()
{
#ifdef Q_OS_WIN
return QStringLiteral("\\\\.\\NUL");
+#elif defined(_PATH_DEVNULL)
+ return QStringLiteral(_PATH_DEVNULL);
#else
return QStringLiteral("/dev/null");
#endif
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index 9a63374e6f8..35a0de4fb79 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -86,8 +86,8 @@ public:
}
const QChar *m_data;
- qssize_t m_len;
- qssize_t m_pos = 0;
+ qsizetype m_len;
+ qsizetype m_pos = 0;
QChar m_splitChar = QLatin1Char('/');
};
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index d0cbc82c560..bbc66120b52 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -1451,7 +1451,7 @@ void QConfFileSettingsPrivate::syncConfFile(QConfFile *confFile)
Files that we can't read (because of permissions or
because they don't exist) are treated as empty files.
*/
- if (file.isReadable() && fileInfo.size() != 0) {
+ if (file.isReadable() && file.size() != 0) {
bool ok = false;
#ifdef Q_OS_MAC
if (format == QSettings::NativeFormat) {
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index c3d45caf0e5..b3a5bd797a3 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -48,6 +48,14 @@
#include
#endif
+#if QT_HAS_INCLUDE()
+#include
+#endif
+
+#ifdef Q_OS_UNIX
+#include
+#endif
+
#ifndef QT_NO_STANDARDPATHS
QT_BEGIN_NAMESPACE
@@ -509,6 +517,27 @@ QString QStandardPaths::findExecutable(const QString &executableName, const QStr
QStringList searchPaths = paths;
if (paths.isEmpty()) {
QByteArray pEnv = qgetenv("PATH");
+ if (Q_UNLIKELY(pEnv.isNull())) {
+ // Get a default path. POSIX.1 does not actually require this, but
+ // most Unix libc fall back to confstr(_CS_PATH) if the PATH
+ // environment variable isn't set. Let's try to do the same.
+#if defined(_PATH_DEFPATH)
+ // BSD API.
+ pEnv = _PATH_DEFPATH;
+#elif defined(_CS_PATH)
+ // POSIX API.
+ size_t n = confstr(_CS_PATH, nullptr, 0);
+ if (n) {
+ pEnv.resize(n);
+ // size()+1 is ok because QByteArray always has an extra NUL-terminator
+ confstr(_CS_PATH, pEnv.data(), pEnv.size() + 1);
+ }
+#else
+ // Windows SDK's execvpe() does not have a fallback, so we won't
+ // apply one either.
+#endif
+ }
+
// Remove trailing slashes, which occur on Windows.
const QStringList rawPaths = QString::fromLocal8Bit(pEnv.constData()).split(QDir::listSeparator(), QString::SkipEmptyParts);
searchPaths.reserve(rawPaths.size());
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp
index 6d8b6ee1a0f..7664b77d814 100644
--- a/src/corelib/io/qstorageinfo_unix.cpp
+++ b/src/corelib/io/qstorageinfo_unix.cpp
@@ -108,6 +108,13 @@
# endif // QT_LARGEFILE_SUPPORT
#endif // Q_OS_BSD4
+#if QT_HAS_INCLUDE()
+# include
+#endif
+#ifndef _PATH_MOUNTED
+# define _PATH_MOUNTED "/etc/mnttab"
+#endif
+
QT_BEGIN_NAMESPACE
class QStorageIterator
@@ -274,11 +281,9 @@ inline QByteArray QStorageIterator::subvolume() const
}
#elif defined(Q_OS_SOLARIS)
-static const char pathMounted[] = "/etc/mnttab";
-
inline QStorageIterator::QStorageIterator()
{
- const int fd = qt_safe_open(pathMounted, O_RDONLY);
+ const int fd = qt_safe_open(_PATH_MOUNTED, O_RDONLY);
fp = ::fdopen(fd, "r");
}
@@ -319,11 +324,9 @@ inline QByteArray QStorageIterator::subvolume() const
}
#elif defined(Q_OS_ANDROID)
-static const QLatin1String pathMounted("/proc/mounts");
-
inline QStorageIterator::QStorageIterator()
{
- file.setFileName(pathMounted);
+ file.setFileName(_PATH_MOUNTED);
file.open(QIODevice::ReadOnly | QIODevice::Text);
}
@@ -380,7 +383,6 @@ inline QByteArray QStorageIterator::subvolume() const
}
#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD)
-static const char pathMounted[] = "/etc/mtab";
static const int bufferSize = 1024; // 2 paths (mount point+device) and metainfo;
// should be enough
@@ -397,7 +399,7 @@ inline QStorageIterator::QStorageIterator() :
usingMountinfo = true;
} else {
usingMountinfo = false;
- fp = ::setmntent(pathMounted, "r");
+ fp = ::setmntent(_PATH_MOUNTED, "r");
}
}
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index b8d3e859cf7..35699d52df2 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -393,7 +393,9 @@ bool QTemporaryFileEngine::remove()
// we must explicitly call QFSFileEngine::close() before we remove it.
d->unmapAll();
QFSFileEngine::close();
- if (isUnnamedFile() || QFSFileEngine::remove()) {
+ if (isUnnamedFile())
+ return true;
+ if (!filePathIsTemplate && QFSFileEngine::remove()) {
d->fileEntry.clear();
// If a QTemporaryFile is constructed using a template file path, the path
// is generated in QTemporaryFileEngine::open() and then filePathIsTemplate
@@ -511,7 +513,10 @@ bool QTemporaryFileEngine::materializeUnnamedFile(const QString &newName, QTempo
bool QTemporaryFileEngine::isUnnamedFile() const
{
#ifdef LINUX_UNNAMED_TMPFILE
- Q_ASSERT(unnamedFile == d_func()->fileEntry.isEmpty());
+ if (unnamedFile) {
+ Q_ASSERT(d_func()->fileEntry.isEmpty());
+ Q_ASSERT(filePathIsTemplate);
+ }
return unnamedFile;
#else
return false;
@@ -749,10 +754,21 @@ bool QTemporaryFile::autoRemove() const
}
/*!
- Sets the QTemporaryFile into auto-remove mode if \a b is true.
+ Sets the QTemporaryFile into auto-remove mode if \a b is \c true.
Auto-remove is on by default.
+ If you set this property to \c false, ensure the application provides a way
+ to remove the file once it is no longer needed, including passing the
+ responsibility on to another process. Always use the fileName() function to
+ obtain the name and never try to guess the name that QTemporaryFile has
+ generated.
+
+ On some systems, if fileName() is not called before closing the file, the
+ temporary file may be removed regardless of the state of this property.
+ This behavior should not be relied upon, so application code should either
+ call fileName() or leave the auto removal functionality enabled.
+
\sa autoRemove(), remove()
*/
void QTemporaryFile::setAutoRemove(bool b)
diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h
index 46a0d7aba3e..fb8887af533 100644
--- a/src/corelib/io/qtemporaryfile_p.h
+++ b/src/corelib/io/qtemporaryfile_p.h
@@ -58,7 +58,7 @@
#include "private/qfile_p.h"
#include "qtemporaryfile.h"
-#ifdef Q_OS_LINUX
+#if defined(Q_OS_LINUX) && QT_CONFIG(linkat)
# include
# ifdef O_TMPFILE
// some early libc support had the wrong values for O_TMPFILE
@@ -74,8 +74,8 @@ QT_BEGIN_NAMESPACE
struct QTemporaryFileName
{
QFileSystemEntry::NativePath path;
- qssize_t pos;
- qssize_t length;
+ qsizetype pos;
+ qsizetype length;
QTemporaryFileName(const QString &templateName);
QFileSystemEntry::NativePath generateNext();
@@ -140,7 +140,7 @@ public:
enum MaterializationMode { Overwrite, DontOverwrite, NameIsTemplate };
bool materializeUnnamedFile(const QString &newName, MaterializationMode mode);
- bool isUnnamedFile() const;
+ bool isUnnamedFile() const override final;
const QString &templateName;
quint32 fileMode;
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index cf7ed130bac..4587b9fcd6f 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -90,11 +90,6 @@
fromPercentEncoding() and toPercentEncoding() which deal with
percent encoding and decoding of QString objects.
- Calling isRelative() will tell whether or not the URL is
- relative. A relative URL can be resolved by passing it as argument
- to resolved(), which returns an absolute URL. isParentOf() is used
- for determining whether one URL is a parent of another.
-
fromLocalFile() constructs a QUrl by parsing a local
file path. toLocalFile() converts a URL to a local file path.
@@ -116,6 +111,37 @@
from freedesktop.org, provided that the locale encodes file names using
UTF-8 (required by IDN).
+ \section2 Relative URLs vs Relative Paths
+
+ Calling isRelative() will return whether or not the URL is relative.
+ A relative URL has no \l {scheme}. For example:
+
+ \code
+ qDebug() << QUrl("main.qml").isRelative(); // true: no scheme
+ qDebug() << QUrl("qml/main.qml").isRelative(); // true: no scheme
+ qDebug() << QUrl("file:main.qml").isRelative(); // false: has "file" scheme
+ qDebug() << QUrl("file:qml/main.qml").isRelative(); // false: has "file" scheme
+ \endcode
+
+ Notice that a URL can be absolute while containing a relative path, and
+ vice versa:
+
+ \code
+ // Absolute URL, relative path
+ QUrl url("file:file.txt");
+ qDebug() << url.isRelative(); // false: has "file" scheme
+ qDebug() << QDir::isAbsolutePath(url.path()); // false: relative path
+
+ // Relative URL, absolute path
+ url = QUrl("/home/user/file.txt");
+ qDebug() << url.isRelative(); // true: has no scheme
+ qDebug() << QDir::isAbsolutePath(url.path()); // true: absolute path
+ \endcode
+
+ A relative URL can be resolved by passing it as an argument to resolved(),
+ which returns an absolute URL. isParentOf() is used for determining whether
+ one URL is a parent of another.
+
\section2 Error checking
QUrl is capable of detecting many errors in URLs while parsing it or when
@@ -2539,6 +2565,12 @@ void QUrl::setPath(const QString &path, ParsingMode mode)
/*!
Returns the path of the URL.
+ \code
+ qDebug() << QUrl("file:file.txt").path(); // "file.txt"
+ qDebug() << QUrl("/home/user/file.txt").path(); // "/home/user/file.txt"
+ qDebug() << QUrl("http://www.example.com/test/123").path(); // "/test/123"
+ \endcode
+
The \a options argument controls how to format the path component. All
values produce an unambiguous result. With QUrl::FullyDecoded, all
percent-encoded sequences are decoded; otherwise, the returned value may
@@ -2549,6 +2581,31 @@ void QUrl::setPath(const QString &path, ParsingMode mode)
sequences are present. It is recommended to use that value when the result
will be used in a non-URL context, such as sending to an FTP server.
+ An example of data loss is when you have non-Unicode percent-encoded sequences
+ and use FullyDecoded (the default):
+
+ \code
+ qDebug() << QUrl("/foo%FFbar").path();
+ \endcode
+
+ In this example, there will be some level of data loss because the \c %FF cannot
+ be converted.
+
+ Data loss can also occur when the path contains sub-delimiters (such as \c +):
+
+ \code
+ qDebug() << QUrl("/foo+bar%2B").path(); // "/foo+bar+"
+ \endcode
+
+ Other decoding examples:
+
+ \code
+ const QUrl url("/tmp/Mambo %235%3F.mp3");
+ qDebug() << url.path(QUrl::FullyDecoded); // "/tmp/Mambo #5?.mp3"
+ qDebug() << url.path(QUrl::PrettyDecoded); // "/tmp/Mambo #5?.mp3"
+ qDebug() << url.path(QUrl::FullyEncoded); // "/tmp/Mambo%20%235%3F.mp3"
+ \endcode
+
\sa setPath()
*/
QString QUrl::path(ComponentFormattingOptions options) const
@@ -3257,6 +3314,8 @@ QUrl QUrl::resolved(const QUrl &relative) const
equivalent to calling scheme().isEmpty().
Relative references are defined in RFC 3986 section 4.2.
+
+ \sa {Relative URLs vs Relative Paths}
*/
bool QUrl::isRelative() const
{
@@ -3796,6 +3855,41 @@ bool QUrl::isDetached() const
An empty \a localFile leads to an empty URL (since Qt 5.4).
+ \code
+ qDebug() << QUrl::fromLocalFile("file.txt"); // QUrl("file:file.txt")
+ qDebug() << QUrl::fromLocalFile("/home/user/file.txt"); // QUrl("file:///home/user/file.txt")
+ qDebug() << QUrl::fromLocalFile("file:file.txt"); // doesn't make sense; expects path, not url with scheme
+ \endcode
+
+ In the first line in snippet above, a file URL is constructed from a
+ local, relative path. A file URL with a relative path only makes sense
+ if there is a base URL to resolve it against. For example:
+
+ \code
+ QUrl url = QUrl::fromLocalFile("file.txt");
+ QUrl baseUrl = QUrl("file:/home/user/");
+ // wrong: prints QUrl("file:file.txt"), as url already has a scheme
+ qDebug() << baseUrl.resolved(url);
+ \endcode
+
+ To resolve such a URL, it's necessary to remove the scheme beforehand:
+
+ \code
+ // correct: prints QUrl("file:///home/user/file.txt")
+ url.setScheme(QString());
+ qDebug() << baseUrl.resolved(url);
+ \endcode
+
+ For this reason, it is better to use a relative URL (that is, no scheme)
+ for relative file paths:
+
+ \code
+ QUrl url = QUrl("file.txt");
+ QUrl baseUrl = QUrl("file:/home/user/");
+ // prints QUrl("file:///home/user/file.txt")
+ qDebug() << baseUrl.resolved(url);
+ \endcode
+
\sa toLocalFile(), isLocalFile(), QDir::toNativeSeparators()
*/
QUrl QUrl::fromLocalFile(const QString &localFile)
@@ -3840,6 +3934,12 @@ QUrl QUrl::fromLocalFile(const QString &localFile)
returned value in the form found on SMB networks (for example,
"//servername/path/to/file.txt").
+ \code
+ qDebug() << QUrl("file:file.txt").toLocalFile(); // "file:file.txt"
+ qDebug() << QUrl("file:/home/user/file.txt").toLocalFile(); // "file:///home/user/file.txt"
+ qDebug() << QUrl("file.txt").toLocalFile(); // ""; wasn't a local file as it had no scheme
+ \endcode
+
Note: if the path component of this URL contains a non-UTF-8 binary
sequence (such as %80), the behaviour of this function is undefined.
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index b4ba1a2823e..c70fbaf63b2 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -2660,8 +2660,8 @@ void QSortFilterProxyModel::setFilterRole(int role)
}
/*!
- \since 5.9
- \property QSortFilterProxyModel::recursiveFiltering
+ \since 5.10
+ \property QSortFilterProxyModel::recursiveFilteringEnabled
\brief whether the filter to be applied recursively on children, and for
any matching child, its parents will be visible as well.
@@ -2669,13 +2669,13 @@ void QSortFilterProxyModel::setFilterRole(int role)
\sa filterAcceptsRow()
*/
-bool QSortFilterProxyModel::recursiveFiltering() const
+bool QSortFilterProxyModel::isRecursiveFilteringEnabled() const
{
Q_D(const QSortFilterProxyModel);
return d->filter_recursive;
}
-void QSortFilterProxyModel::setRecursiveFiltering(bool recursive)
+void QSortFilterProxyModel::setRecursiveFilteringEnabled(bool recursive)
{
Q_D(QSortFilterProxyModel);
if (d->filter_recursive == recursive)
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.h b/src/corelib/itemmodels/qsortfilterproxymodel.h
index 2f938365441..6c620f48125 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.h
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.h
@@ -67,7 +67,7 @@ class Q_CORE_EXPORT QSortFilterProxyModel : public QAbstractProxyModel
Q_PROPERTY(bool isSortLocaleAware READ isSortLocaleAware WRITE setSortLocaleAware)
Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole)
Q_PROPERTY(int filterRole READ filterRole WRITE setFilterRole)
- Q_PROPERTY(bool recursiveFiltering READ recursiveFiltering WRITE setRecursiveFiltering)
+ Q_PROPERTY(bool recursiveFilteringEnabled READ isRecursiveFilteringEnabled WRITE setRecursiveFilteringEnabled)
public:
explicit QSortFilterProxyModel(QObject *parent = nullptr);
@@ -108,8 +108,8 @@ public:
int filterRole() const;
void setFilterRole(int role);
- bool recursiveFiltering() const;
- void setRecursiveFiltering(bool recursive);
+ bool isRecursiveFilteringEnabled() const;
+ void setRecursiveFilteringEnabled(bool recursive);
public Q_SLOTS:
void setFilterRegExp(const QString &pattern);
diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index 8abe9b2b44b..2336278b17f 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -188,7 +188,7 @@ vxworks {
kernel/qfunctions_vxworks.h
}
-qqnx_pps {
+qnx:qtConfig(qqnx_pps) {
QMAKE_USE_PRIVATE += pps
SOURCES += \
kernel/qppsattribute.cpp \
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 0ba841bd30a..38bcba275fe 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -2202,11 +2202,11 @@ QString QCoreApplication::applicationFilePath()
QCoreApplicationPrivate *d = self->d_func();
if (d->argc) {
- static const char *procName = d->argv[0];
- if (qstrcmp(procName, d->argv[0]) != 0) {
+ static QByteArray procName = QByteArray(d->argv[0]);
+ if (procName != d->argv[0]) {
// clear the cache if the procname changes, so we reprocess it.
QCoreApplicationPrivate::clearApplicationFilePath();
- procName = d->argv[0];
+ procName = QByteArray(d->argv[0]);
}
}
diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp
index c7109a65069..04c9a9bcba5 100644
--- a/src/corelib/kernel/qjnihelpers.cpp
+++ b/src/corelib/kernel/qjnihelpers.cpp
@@ -592,7 +592,7 @@ void QtAndroidPrivate::setOnBindListener(QtAndroidPrivate::OnBindListener *liste
{
QMutexLocker lock(g_onBindListenerMutex);
*g_onBindListener = listener;
- if (!(*g_serviceSetupLockers)--)
+ if (!g_serviceSetupLockers->deref())
g_waitForServiceSetupSemaphore->release();
}
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 650523d01c7..30cae20359c 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -4796,7 +4796,7 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s
QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type,
const int *types, const QMetaObject *senderMetaObject)
{
- if (!sender || !slotObj || !senderMetaObject) {
+ if (!sender || !receiver || !slotObj || !senderMetaObject) {
qWarning("QObject::connect: invalid null parameter");
if (slotObj)
slotObj->destroyIfLastRef();
diff --git a/src/corelib/kernel/qppsobjectprivate_p.h b/src/corelib/kernel/qppsobjectprivate_p.h
index e1d54e58de0..dae44e36091 100644
--- a/src/corelib/kernel/qppsobjectprivate_p.h
+++ b/src/corelib/kernel/qppsobjectprivate_p.h
@@ -57,13 +57,15 @@
#include
#include
+#include
QT_BEGIN_NAMESPACE
class QSocketNotifier;
-class QPpsObjectPrivate
+class QPpsObjectPrivate : public QObjectPrivate
{
+ Q_DECLARE_PUBLIC(QPpsObject)
public:
explicit QPpsObjectPrivate(const QString &path);
diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp
index a4d3f67c27d..9368e53b3f1 100644
--- a/src/corelib/plugin/qlibrary_win.cpp
+++ b/src/corelib/plugin/qlibrary_win.cpp
@@ -116,7 +116,7 @@ bool QLibraryPrivate::load_sys()
#endif
if (!pHnd) {
errorString = QLibrary::tr("Cannot load library %1: %2").arg(
- QDir::toNativeSeparators(fileName)).arg(qt_error_string());
+ QDir::toNativeSeparators(fileName), qt_error_string());
} else {
// Query the actual name of the library that was loaded
errorString.clear();
@@ -152,7 +152,7 @@ bool QLibraryPrivate::unload_sys()
{
if (!FreeLibrary(pHnd)) {
errorString = QLibrary::tr("Cannot unload library %1: %2").arg(
- QDir::toNativeSeparators(fileName)).arg(qt_error_string());
+ QDir::toNativeSeparators(fileName), qt_error_string());
return false;
}
errorString.clear();
@@ -164,8 +164,7 @@ QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
FARPROC address = GetProcAddress(pHnd, symbol);
if (!address) {
errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg(
- QString::fromLatin1(symbol)).arg(
- QDir::toNativeSeparators(fileName)).arg(qt_error_string());
+ QString::fromLatin1(symbol), QDir::toNativeSeparators(fileName), qt_error_string());
} else {
errorString.clear();
}
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index e58ddaff44d..24734f99ac7 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -3096,10 +3096,12 @@ int QSignalEventGenerator::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
void QSignalEventGenerator::execute(void **_a)
{
+ auto machinePrivate = QStateMachinePrivate::get(qobject_cast(parent()));
+ if (machinePrivate->state != QStateMachinePrivate::Running)
+ return;
int signalIndex = senderSignalIndex();
Q_ASSERT(signalIndex != -1);
- QStateMachine *machine = qobject_cast(parent());
- QStateMachinePrivate::get(machine)->handleTransitionSignal(sender(), signalIndex, _a);
+ machinePrivate->handleTransitionSignal(sender(), signalIndex, _a);
}
QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent)
diff --git a/src/corelib/thread/qfuturewatcher.h b/src/corelib/thread/qfuturewatcher.h
index 1d984a32054..fb7dd304997 100644
--- a/src/corelib/thread/qfuturewatcher.h
+++ b/src/corelib/thread/qfuturewatcher.h
@@ -114,7 +114,7 @@ template
class QFutureWatcher : public QFutureWatcherBase
{
public:
- explicit QFutureWatcher(QObject *_parent = 0)
+ explicit QFutureWatcher(QObject *_parent = nullptr)
: QFutureWatcherBase(_parent)
{ }
~QFutureWatcher()
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index f6fc6724862..050f37dcd24 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -2227,7 +2227,7 @@ static QString qt_tzname(QDateTimePrivate::DaylightStatus daylightStatus)
#endif // Q_OS_WIN
}
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(datetimeparser) && QT_CONFIG(timezone)
/*
\internal
Implemented here to share qt_tzname()
@@ -2245,7 +2245,7 @@ int QDateTimeParser::startsWithLocalTimeZone(const QStringRef name)
}
return 0;
}
-#endif // QT_BOOTSTRAPPED
+#endif // datetimeparser && timezone
// Calls the platform variant of mktime for the given date, time and daylightStatus,
// and updates the date, time, daylightStatus and abbreviation with the returned values
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index a390bce95f1..5a7b75db620 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -81,7 +81,7 @@ public:
int daysInYear() const;
int weekNumber(int *yearNum = nullptr) const;
-#if QT_DEPRECATED_SINCE(5, 11) && !defined QT_NO_TEXTDATE
+#if QT_DEPRECATED_SINCE(5, 10) && !defined QT_NO_TEXTDATE
QT_DEPRECATED_X("Use QLocale::monthName or QLocale::standaloneMonthName")
static QString shortMonthName(int month, MonthNameType type = DateFormat);
QT_DEPRECATED_X("Use QLocale::dayName or QLocale::standaloneDayName")
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index f0c8b5a7996..551e01e076d 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -195,9 +195,11 @@ bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const
return false;
// Preserve zone:
- v = (tspec == Qt::TimeZone
- ? QDateTime(newDate, newTime, v.timeZone())
- : QDateTime(newDate, newTime, tspec, offset));
+ v =
+#if QT_CONFIG(timezone)
+ tspec == Qt::TimeZone ? QDateTime(newDate, newTime, v.timeZone()) :
+#endif
+ QDateTime(newDate, newTime, tspec, offset);
return true;
}
@@ -213,7 +215,9 @@ int QDateTimeParser::absoluteMax(int s, const QDateTime &cur) const
{
const SectionNode &sn = sectionNode(s);
switch (sn.type) {
+#if QT_CONFIG(timezone)
case TimeZoneSection: return QTimeZone::MaxUtcOffsetSecs;
+#endif
case Hour24Section:
case Hour12Section: return 23; // this is special-cased in
// parseSection. We want it to be
@@ -248,7 +252,9 @@ int QDateTimeParser::absoluteMin(int s) const
{
const SectionNode &sn = sectionNode(s);
switch (sn.type) {
+#if QT_CONFIG(timezone)
case TimeZoneSection: return QTimeZone::MinUtcOffsetSecs;
+#endif
case Hour24Section:
case Hour12Section:
case MinuteSection:
@@ -766,9 +772,11 @@ QDateTimeParser::parseSection(const QDateTime ¤tValue, int sectionIndex,
text->replace(offset, used, sectiontext.constData(), used);
break; }
case TimeZoneSection:
+#if QT_CONFIG(timezone)
result = findTimeZone(sectionTextRef, currentValue,
absoluteMax(sectionIndex),
absoluteMin(sectionIndex));
+#endif
break;
case MonthSection:
case DayOfWeekSectionShort:
@@ -1091,17 +1099,21 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
int dayofweek = defaultDate.dayOfWeek();
Qt::TimeSpec tspec = defaultValue.timeSpec();
int zoneOffset = 0; // In seconds; local - UTC
+#if QT_CONFIG(timezone)
QTimeZone timeZone;
+#endif
switch (tspec) {
case Qt::OffsetFromUTC: // timeZone is ignored
zoneOffset = defaultValue.offsetFromUtc();
break;
+#if QT_CONFIG(timezone)
case Qt::TimeZone:
timeZone = defaultValue.timeZone();
if (timeZone.isValid())
zoneOffset = timeZone.offsetFromUtc(defaultValue);
// else: is there anything we can do about this ?
break;
+#endif
default: // zoneOffset and timeZone are ignored
break;
}
@@ -1126,9 +1138,11 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
{
const QDate date = actualDate(isSet, year, year2digits, month, day, dayofweek);
const QTime time = actualTime(isSet, hour, hour12, ampm, minute, second, msec);
- sect = parseSection(tspec == Qt::TimeZone
- ? QDateTime(date, time, timeZone)
- : QDateTime(date, time, tspec, zoneOffset),
+ sect = parseSection(
+#if QT_CONFIG(timezone)
+ tspec == Qt::TimeZone ? QDateTime(date, time, timeZone) :
+#endif
+ QDateTime(date, time, tspec, zoneOffset),
index, pos, input);
}
@@ -1154,16 +1168,20 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
case TimeZoneSection:
current = &zoneOffset;
if (sect.used > 0) {
- // Synchronize with what findTimeZone() found:
+#if QT_CONFIG(timezone) // Synchronize with what findTimeZone() found:
QStringRef zoneName = input->midRef(pos, sect.used);
Q_ASSERT(!zoneName.isEmpty()); // sect.used > 0
- const QByteArray latinZone(zoneName.toLatin1());
+ const QByteArray latinZone(zoneName == QLatin1String("Z")
+ ? QByteArray("UTC") : zoneName.toLatin1());
timeZone = QTimeZone(latinZone);
tspec = timeZone.isValid()
? (QTimeZone::isTimeZoneIdAvailable(latinZone)
? Qt::TimeZone
: Qt::OffsetFromUTC)
: (Q_ASSERT(startsWithLocalTimeZone(zoneName)), Qt::LocalTime);
+#else
+ tspec = Qt::LocalTime;
+#endif
}
break;
case Hour24Section: current = &hour; break;
@@ -1321,9 +1339,11 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
const QDate date(year, month, day);
const QTime time(hour, minute, second, msec);
- return StateNode(tspec == Qt::TimeZone
- ? QDateTime(date, time, timeZone)
- : QDateTime(date, time, tspec, zoneOffset),
+ return StateNode(
+#if QT_CONFIG(timezone)
+ tspec == Qt::TimeZone ? QDateTime(date, time, timeZone) :
+#endif
+ QDateTime(date, time, tspec, zoneOffset),
state, padding, conflicts);
}
@@ -1571,6 +1591,7 @@ QDateTimeParser::ParsedSection
QDateTimeParser::findTimeZone(QStringRef str, const QDateTime &when,
int maxVal, int minVal) const
{
+#if QT_CONFIG(timezone)
int index = startsWithLocalTimeZone(str);
int offset;
@@ -1597,6 +1618,10 @@ QDateTimeParser::findTimeZone(QStringRef str, const QDateTime &when,
while (index > 0) {
str.truncate(index);
+ if (str == QLatin1String("Z")) {
+ offset = 0; // "Zulu" time - a.k.a. UTC
+ break;
+ }
QTimeZone zone(str.toLatin1());
if (zone.isValid()) {
offset = zone.offsetFromUtc(when);
@@ -1609,6 +1634,7 @@ QDateTimeParser::findTimeZone(QStringRef str, const QDateTime &when,
if (index > 0 && maxVal >= offset && offset >= minVal)
return ParsedSection(Acceptable, offset, index);
+#endif // timezone
return ParsedSection();
}
diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h
index c4afef0193b..c9e63fe3072 100644
--- a/src/corelib/tools/qdatetimeparser_p.h
+++ b/src/corelib/tools/qdatetimeparser_p.h
@@ -223,7 +223,10 @@ private:
QString *dayName = 0, int *used = 0) const;
ParsedSection findTimeZone(QStringRef str, const QDateTime &when,
int maxVal, int minVal) const;
- static int startsWithLocalTimeZone(const QStringRef name); // implemented in qdatetime.cpp
+#if QT_CONFIG(timezone)
+ // Implemented in qdatetime.cpp:
+ static int startsWithLocalTimeZone(const QStringRef name);
+#endif
enum AmPmFinder {
Neither = -1,
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index c785a5882a2..5598dfe237c 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -580,7 +580,7 @@ int qt_repeatCount(QStringView s)
if (s.isEmpty())
return 0;
const QChar c = s.front();
- qssize_t j = 1;
+ qsizetype j = 1;
while (j < s.size() && s.at(j) == c)
++j;
return int(j);
@@ -3459,7 +3459,7 @@ bool QLocaleData::validateChars(QStringView str, NumberMode numMode, QByteArray
bool dec = false;
int decDigitCnt = 0;
- for (qssize_t i = 0; i < str.size(); ++i) {
+ for (qsizetype i = 0; i < str.size(); ++i) {
char c = digitToCLocale(str.at(i));
if (c >= '0' && c <= '9') {
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index fc72c6e32ce..a5b90968359 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -115,9 +115,9 @@ struct QMapNode : public QMapNodeBase
inline QMapNode *leftNode() const { return static_cast(left); }
inline QMapNode *rightNode() const { return static_cast(right); }
- inline const QMapNode *nextNode() const { return static_cast(QMapNodeBase::nextNode()); }
+ inline const QMapNode *nextNode() const { return reinterpret_cast(QMapNodeBase::nextNode()); }
inline const QMapNode *previousNode() const { return static_cast(QMapNodeBase::previousNode()); }
- inline QMapNode *nextNode() { return static_cast(QMapNodeBase::nextNode()); }
+ inline QMapNode *nextNode() { return reinterpret_cast(QMapNodeBase::nextNode()); }
inline QMapNode *previousNode() { return static_cast(QMapNodeBase::previousNode()); }
QMapNode *copy(QMapData *d) const;
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 78b7e69d9c5..8093a26f7d9 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -160,9 +160,9 @@ static inline bool qt_ends_with(QStringView haystack, QStringView needle, Qt::Ca
static inline bool qt_ends_with(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs);
static inline bool qt_ends_with(QStringView haystack, QChar needle, Qt::CaseSensitivity cs);
-qssize_t QtPrivate::qustrlen(const ushort *str) Q_DECL_NOTHROW
+qsizetype QtPrivate::qustrlen(const ushort *str) Q_DECL_NOTHROW
{
- qssize_t result = 0;
+ qsizetype result = 0;
#ifdef __SSE2__
// find the 16-byte alignment immediately prior or equal to str
@@ -769,8 +769,6 @@ static int qt_compare_strings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSens
Case-sensitive comparison is based exclusively on the numeric Unicode values
of the characters and is very fast, but is not what a human would expect.
Consider sorting user-visible strings with QString::localeAwareCompare().
-
- \snippet qstring/main.cpp qCompareStrings-QSV-QSV
*/
int QtPrivate::compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW
{
@@ -4837,7 +4835,7 @@ static QByteArray qt_convert_to_local_8bit(QStringView string);
locale, the returned byte array is undefined. Those characters may be
suppressed or replaced by another.
- \sa fromLocal8Bit(), toLatin1(), toUtf8(), QTextCodec, qConvertToLocal8Bit()
+ \sa fromLocal8Bit(), toLatin1(), toUtf8(), QTextCodec
*/
QByteArray QString::toLocal8Bit_helper(const QChar *data, int size)
@@ -4871,8 +4869,7 @@ static QByteArray qt_convert_to_local_8bit(QStringView string)
The behavior is undefined if \a string contains characters not
supported by the locale's 8-bit encoding.
- \sa QString::toLocal8Bit(), QStringView::toLocal8Bit(), QtPrivate::vonvertToLatin1(),
- QtPrivate::convertToUtf8(), QtPrivate::convertToUcs4()
+ \sa QString::toLocal8Bit(), QStringView::toLocal8Bit()
*/
QByteArray QtPrivate::convertToLocal8Bit(QStringView string)
{
@@ -4915,8 +4912,7 @@ static QByteArray qt_convert_to_utf8(QStringView str)
UTF-8 is a Unicode codec and can represent all characters in a Unicode
string like QStringView.
- \sa QString::toUtf8(), QStringView::toUtf8(), QtPrivate::convertToLatin1(),
- QtPrivate::convertToLocal8Bit(), QtPrivate::convertToUcs4()
+ \sa QString::toUtf8(), QStringView::toUtf8()
*/
QByteArray QtPrivate::convertToUtf8(QStringView string)
{
@@ -5279,8 +5275,8 @@ namespace {
}
/*!
- \fn QStringView qTrimmed(QStringView s)
- \fn QLatin1String qTrimmed(QLatin1String s)
+ \fn QStringView QtPrivate::trimmed(QStringView s)
+ \fn QLatin1String QtPrivate::trimmed(QLatin1String s)
\internal
\relates QStringView
\since 5.10
@@ -5521,14 +5517,9 @@ QString& QString::fill(QChar ch, int size)
Returns the number of characters in this string.
- The last character in the string is at position size() - 1. In
- addition, QString ensures that the character at position size()
- is always '\\0', so that you can use the return value of data()
- and constData() as arguments to functions that expect
- '\\0'-terminated strings.
+ The last character in the string is at position size() - 1.
Example:
-
\snippet qstring/main.cpp 58
\sa isEmpty(), resize()
@@ -6046,10 +6037,13 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1,
/*!
\fn const QChar *QString::unicode() const
- Returns a '\\0'-terminated Unicode representation of the string.
+ Returns a Unicode representation of the string.
The result remains valid until the string is modified.
- \sa utf16()
+ \note The returned string may not be '\\0'-terminated.
+ Use size() to determine the length of the array.
+
+ \sa utf16(), fromRawData()
*/
/*!
@@ -7250,6 +7244,16 @@ static ResultList splitString(const StringSource &source, const QChar *sep,
\snippet qstring/main.cpp 62
+ If \a sep is empty, split() returns an empty string, followed
+ by each of the string's characters, followed by another empty string:
+
+ \snippet qstring/main.cpp 62-empty
+
+ To understand this behavior, recall that the empty string matches
+ everywhere, so the above is qualitatively the same as:
+
+ \snippet qstring/main.cpp 62-slashes
+
\sa QStringList::join(), section()
*/
QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
@@ -7259,15 +7263,10 @@ QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseS
/*!
Splits the string into substring references wherever \a sep occurs, and
- returns the list of those strings. If \a sep does not match
- anywhere in the string, splitRef() returns a single-element vector
- containing this string reference.
+ returns the list of those strings.
- \a cs specifies whether \a sep should be matched case
- sensitively or case insensitively.
-
- If \a behavior is QString::SkipEmptyParts, empty entries don't
- appear in the result. By default, empty entries are kept.
+ See QString::split() for how \a sep, \a behavior and \a cs interact to form
+ the result.
\note All references are valid as long this string is alive. Destroying this
string will cause all references be dangling pointers.
@@ -7298,15 +7297,10 @@ QVector QString::splitRef(QChar sep, SplitBehavior behavior, Qt::Cas
/*!
Splits the string into substrings references wherever \a sep occurs, and
- returns the list of those strings. If \a sep does not match
- anywhere in the string, split() returns a single-element vector
- containing this string reference.
+ returns the list of those strings.
- \a cs specifies whether \a sep should be matched case
- sensitively or case insensitively.
-
- If \a behavior is QString::SkipEmptyParts, empty entries don't
- appear in the result. By default, empty entries are kept.
+ See QString::split() for how \a sep, \a behavior and \a cs interact to form
+ the result.
\note All references are valid as long this string is alive. Destroying this
string will cause all references be dangling pointers.
@@ -8519,7 +8513,10 @@ bool QString::isRightToLeft() const
Returns a pointer to the data stored in the QString. The pointer
can be used to access and modify the characters that compose the
- string. For convenience, the data is '\\0'-terminated.
+ string.
+
+ Unlike constData() and unicode(), the returned data is always
+ '\\0'-terminated.
Example:
@@ -8535,18 +8532,25 @@ bool QString::isRightToLeft() const
/*! \fn const QChar *QString::data() const
\overload
+
+ \note The returned string may not be '\\0'-terminated.
+ Use size() to determine the length of the array.
+
+ \sa fromRawData()
*/
/*! \fn const QChar *QString::constData() const
Returns a pointer to the data stored in the QString. The pointer
- can be used to access the characters that compose the string. For
- convenience, the data is '\\0'-terminated.
+ can be used to access the characters that compose the string.
Note that the pointer remains valid only as long as the string is
not modified.
- \sa data(), operator[]()
+ \note The returned string may not be '\\0'-terminated.
+ Use size() to determine the length of the array.
+
+ \sa data(), operator[](), fromRawData()
*/
/*! \fn void QString::push_front(const QString &other)
@@ -8996,7 +9000,7 @@ QString &QString::setRawData(const QChar *unicode, int size)
If \a cs is Qt::CaseSensitive (the default), the search is case-sensitive;
otherwise the search is case-insensitive.
- \sa endsWith(), qStartsWith()
+ \sa endsWith()
*/
/*!
@@ -9016,7 +9020,7 @@ QString &QString::setRawData(const QChar *unicode, int size)
If \a cs is Qt::CaseSensitive (the default), the search is case-sensitive;
otherwise the search is case-insensitive.
- \sa startsWith(), qEndsWith()
+ \sa startsWith()
*/
/*!
diff --git a/src/corelib/tools/qstringalgorithms.h b/src/corelib/tools/qstringalgorithms.h
index 336da87468b..aaa702301ed 100644
--- a/src/corelib/tools/qstringalgorithms.h
+++ b/src/corelib/tools/qstringalgorithms.h
@@ -55,7 +55,7 @@ template class QVector;
namespace QtPrivate {
-Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qssize_t qustrlen(const ushort *str) Q_DECL_NOTHROW;
+Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrlen(const ushort *str) Q_DECL_NOTHROW;
Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW;
Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QLatin1String rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW;
diff --git a/src/corelib/tools/qstringiterator.qdoc b/src/corelib/tools/qstringiterator.qdoc
index 95c2247bc18..caec8803f3a 100644
--- a/src/corelib/tools/qstringiterator.qdoc
+++ b/src/corelib/tools/qstringiterator.qdoc
@@ -120,7 +120,7 @@
*/
/*!
- \fn QStringIterator::QStringIterator(QStringView string, qssize_t idx)
+ \fn QStringIterator::QStringIterator(QStringView string, qsizetype idx)
Constructs an iterator over the contents of \a string. The iterator will point
before position \a idx in the string.
diff --git a/src/corelib/tools/qstringiterator_p.h b/src/corelib/tools/qstringiterator_p.h
index 8b1a6a1cd32..219589b6e43 100644
--- a/src/corelib/tools/qstringiterator_p.h
+++ b/src/corelib/tools/qstringiterator_p.h
@@ -62,7 +62,7 @@ class QStringIterator
QString::const_iterator i, pos, e;
Q_STATIC_ASSERT((std::is_same::value));
public:
- explicit QStringIterator(QStringView string, qssize_t idx = 0)
+ explicit QStringIterator(QStringView string, qsizetype idx = 0)
: i(string.begin()),
pos(i + idx),
e(string.end())
diff --git a/src/corelib/tools/qstringview.cpp b/src/corelib/tools/qstringview.cpp
index 8eefc6d814c..6321427a2d7 100644
--- a/src/corelib/tools/qstringview.cpp
+++ b/src/corelib/tools/qstringview.cpp
@@ -131,9 +131,9 @@ QT_BEGIN_NAMESPACE
/*!
\typedef QStringView::size_type
- Alias for qssize_t. Provided for compatibility with the STL.
+ Alias for qsizetype. Provided for compatibility with the STL.
- Unlike other Qt classes, QStringView uses qssize_t as its \c size_type, to allow
+ Unlike other Qt classes, QStringView uses qsizetype as its \c size_type, to allow
accepting data from \c{std::basic_string} without truncation. The Qt API functions,
for example length(), return \c int, while the STL-compatible functions, for example
size(), return \c size_type.
@@ -224,7 +224,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView::QStringView(const Char *str, qssize_t len)
+ \fn QStringView::QStringView(const Char *str, qsizetype len)
Constructs a string view on \a str with length \a len.
@@ -486,7 +486,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn qssize_t QStringView::size() const
+ \fn qsizetype QStringView::size() const
Returns the size of this string view, in UTF-16 code points (that is,
surrogate pairs count as two for the purposes of this function, the same
@@ -510,7 +510,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QChar QStringView::operator[](qssize_t n) const
+ \fn QChar QStringView::operator[](qsizetype n) const
Returns the character at position \a n in this string view.
@@ -520,7 +520,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QChar QStringView::at(qssize_t n) const
+ \fn QChar QStringView::at(qsizetype n) const
Returns the character at position \a n in this string view.
@@ -582,7 +582,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView QStringView::mid(qssize_t start) const
+ \fn QStringView QStringView::mid(qsizetype start) const
Returns the substring starting at position \a start in this object,
and extending to the end of the string.
@@ -593,7 +593,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView QStringView::mid(qssize_t start, qssize_t length) const
+ \fn QStringView QStringView::mid(qsizetype start, qsizetype length) const
\overload
Returns the substring of length \a length starting at position
@@ -606,7 +606,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView QStringView::left(qssize_t length) const
+ \fn QStringView QStringView::left(qsizetype length) const
Returns the substring of length \a length starting at position
0 in this object.
@@ -617,7 +617,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView QStringView::right(qssize_t length) const
+ \fn QStringView QStringView::right(qsizetype length) const
Returns the substring of length \a length starting at position
size() - \a length in this object.
@@ -628,7 +628,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView QStringView::chopped(qssize_t length) const
+ \fn QStringView QStringView::chopped(qsizetype length) const
Returns the substring of length size() - \a length starting at the
beginning of this object.
@@ -641,7 +641,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QStringView::truncate(qssize_t length)
+ \fn void QStringView::truncate(qsizetype length)
Truncates this string view to length \a length.
@@ -653,7 +653,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QStringView::chop(qssize_t length)
+ \fn void QStringView::chop(qsizetype length)
Truncates this string view by \a length characters.
@@ -672,8 +672,6 @@ QT_BEGIN_NAMESPACE
Whitespace means any character for which QChar::isSpace() returns
\c true. This includes the ASCII characters '\\t', '\\n', '\\v',
'\\f', '\\r', and ' '.
-
- \sa qTrimmed()
*/
/*!
@@ -689,7 +687,7 @@ QT_BEGIN_NAMESPACE
If \a cs is Qt::CaseSensitive (the default), the search is case-sensitive;
otherwise the search is case-insensitive.
- \sa endsWith(), qStartsWith()
+ \sa endsWith()
*/
/*!
@@ -705,7 +703,7 @@ QT_BEGIN_NAMESPACE
If \a cs is Qt::CaseSensitive (the default), the search is case-sensitive;
otherwise the search is case-insensitive.
- \sa startsWith(), qEndsWith()
+ \sa startsWith()
*/
/*!
@@ -730,7 +728,7 @@ QT_BEGIN_NAMESPACE
The behavior is undefined if the string contains characters not
supported by the locale's 8-bit encoding.
- \sa toLatin1(), toUtf8(), QTextCodec, qConvertToLocal8Bit()
+ \sa toLatin1(), toUtf8(), QTextCodec
*/
/*!
diff --git a/src/corelib/tools/qstringview.h b/src/corelib/tools/qstringview.h
index 14405f325d4..ef442e5b655 100644
--- a/src/corelib/tools/qstringview.h
+++ b/src/corelib/tools/qstringview.h
@@ -111,7 +111,7 @@ public:
#endif
typedef const QChar value_type;
typedef std::ptrdiff_t difference_type;
- typedef qssize_t size_type;
+ typedef qsizetype size_type;
typedef value_type &reference;
typedef value_type &const_reference;
typedef value_type *pointer;
@@ -139,24 +139,25 @@ private:
using if_compatible_qstring_like = typename std::enable_if::value || std::is_same::value, bool>::type;
template
- static Q_DECL_CONSTEXPR qssize_t lengthHelperArray(const Char (&)[N]) Q_DECL_NOTHROW
+ static Q_DECL_CONSTEXPR qsizetype lengthHelperArray(const Char (&)[N]) Q_DECL_NOTHROW
{
- return qssize_t(N - 1);
+ return qsizetype(N - 1);
}
template
- static qssize_t lengthHelperPointer(const Char *str) Q_DECL_NOTHROW
+ static qsizetype lengthHelperPointer(const Char *str) Q_DECL_NOTHROW
{
#if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
if (__builtin_constant_p(*str)) {
- qssize_t result = 0;
+ qsizetype result = 0;
while (*str++)
++result;
+ return result;
}
#endif
return QtPrivate::qustrlen(reinterpret_cast(str));
}
- static qssize_t lengthHelperPointer(const QChar *str) Q_DECL_NOTHROW
+ static qsizetype lengthHelperPointer(const QChar *str) Q_DECL_NOTHROW
{
return QtPrivate::qustrlen(reinterpret_cast(str));
}
@@ -174,7 +175,7 @@ public:
: QStringView() {}
template = true>
- Q_DECL_CONSTEXPR QStringView(const Char *str, qssize_t len)
+ Q_DECL_CONSTEXPR QStringView(const Char *str, qsizetype len)
: m_size((Q_ASSERT(len >= 0), Q_ASSERT(str || !len), len)),
m_data(castHelper(str)) {}
@@ -204,20 +205,20 @@ public:
#else
template = true>
QStringView(const String &str) Q_DECL_NOTHROW
- : QStringView(str.isNull() ? nullptr : str.data(), qssize_t(str.size())) {}
+ : QStringView(str.isNull() ? nullptr : str.data(), qsizetype(str.size())) {}
#endif
template = true>
QStringView(const StdBasicString &str) Q_DECL_NOTHROW
- : QStringView(str.data(), qssize_t(str.size())) {}
+ : QStringView(str.data(), qsizetype(str.size())) {}
Q_REQUIRED_RESULT inline QString toString() const; // defined in qstring.h
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR qssize_t size() const Q_DECL_NOTHROW { return m_size; }
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR qsizetype size() const Q_DECL_NOTHROW { return m_size; }
Q_REQUIRED_RESULT const_pointer data() const Q_DECL_NOTHROW { return reinterpret_cast(m_data); }
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR const storage_type *utf16() const Q_DECL_NOTHROW { return m_data; }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar operator[](qssize_t n) const
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar operator[](qsizetype n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n < size()), QChar(m_data[n]); }
//
@@ -229,22 +230,22 @@ public:
Q_REQUIRED_RESULT QByteArray toLocal8Bit() const { return QtPrivate::convertToLocal8Bit(*this); }
Q_REQUIRED_RESULT inline QVector toUcs4() const; // defined in qvector.h
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar at(qssize_t n) const { return (*this)[n]; }
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar at(qsizetype n) const { return (*this)[n]; }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qssize_t pos) const
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qsizetype pos) const
{ return Q_ASSERT(pos >= 0), Q_ASSERT(pos <= size()), QStringView(m_data + pos, m_size - pos); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qssize_t pos, qssize_t n) const
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qsizetype pos, qsizetype n) const
{ return Q_ASSERT(pos >= 0), Q_ASSERT(n >= 0), Q_ASSERT(pos + n <= size()), QStringView(m_data + pos, n); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView left(qssize_t n) const
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView left(qsizetype n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data, n); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView right(qssize_t n) const
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView right(qsizetype n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data + m_size - n, n); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView chopped(qssize_t n) const
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView chopped(qsizetype n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data, m_size - n); }
- Q_DECL_RELAXED_CONSTEXPR void truncate(qssize_t n)
+ Q_DECL_RELAXED_CONSTEXPR void truncate(qsizetype n)
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size = n; }
- Q_DECL_RELAXED_CONSTEXPR void chop(qssize_t n)
+ Q_DECL_RELAXED_CONSTEXPR void chop(qsizetype n)
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size -= n; }
Q_REQUIRED_RESULT QStringView trimmed() const Q_DECL_NOTHROW { return QtPrivate::trimmed(*this); }
@@ -291,7 +292,7 @@ public:
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar first() const { return front(); }
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar last() const { return back(); }
private:
- qssize_t m_size;
+ qsizetype m_size;
const storage_type *m_data;
};
Q_DECLARE_TYPEINFO(QStringView, Q_PRIMITIVE_TYPE);
diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp
index ecab7508335..01fa8b21023 100644
--- a/src/corelib/tools/qunicodetables.cpp
+++ b/src/corelib/tools/qunicodetables.cpp
@@ -6083,9 +6083,9 @@ static const Properties uc_properties[] = {
{ 18, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 7, 8, 13, 7 },
{ 25, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 8, 12, 7 },
{ 25, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 12, 0, 12, 7 },
- { 10, 5, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 3, 4, 4, 12, 8 },
- { 10, 5, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 3, 4, 4, 12, 8 },
- { 10, 5, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 3, 4, 4, 12, 2 },
+ { 10, 5, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 3, 4, 4, 12, 8 },
+ { 10, 5, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 3, 4, 4, 12, 8 },
+ { 10, 5, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 3, 4, 4, 12, 2 },
{ 26, 10, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 12, 8 },
{ 26, 13, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 12, 8 },
{ 25, 4, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 10, 8 },
@@ -6146,7 +6146,7 @@ static const Properties uc_properties[] = {
{ 18, 13, 0, 3, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 8, 8, 12, 8 },
{ 25, 13, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 6, 8 },
{ 0, 17, 230, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 8 },
- { 10, 5, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 12, 2 },
+ { 10, 5, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 12, 2 },
{ 29, 10, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 12, 8 },
{ 0, 17, 220, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 8 },
{ 17, 13, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 8, 12, 8 },
@@ -6749,7 +6749,7 @@ static const Properties uc_properties[] = {
{ 25, 10, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 12, 6, 33 },
{ 25, 10, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 12, 33 },
{ 0, 17, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 4, 4, 21, 33 },
- { 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 3, 4, 4, 4, 33 },
+ { 10, 18, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 3, 4, 4, 4, 33 },
{ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 14, 9, 11, 33 },
{ 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 14, 9, 11, 33 },
{ 3, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 14, 9, 11, 33 },
@@ -7058,7 +7058,7 @@ static const Properties uc_properties[] = {
{ 6, 9, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 80, 0, 0, 5, 17, 2 },
{ 6, 9, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 80, 0, 0, 5, 4, 2 },
{ 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 0, 4, 20, 2 },
- { 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 1 },
+ { 10, 18, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 1 },
{ 10, 18, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 4, 4, 21, 1 },
{ 10, 0, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 21, 2 },
{ 10, 1, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 21, 2 },
@@ -7108,10 +7108,10 @@ static const Properties uc_properties[] = {
{ 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 3, 4, 4, 12, 2 },
{ 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 3, 4, 4, 12, 2 },
{ 13, 18, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 12, 0 },
- { 10, 19, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 },
- { 10, 20, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 },
- { 10, 21, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 },
- { 10, 22, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 },
+ { 10, 19, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 },
+ { 10, 20, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 },
+ { 10, 21, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 },
+ { 10, 22, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 3, 4, 4, 21, 2 },
{ 10, 18, 0, 5, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 4, 4, 21, 2 },
{ 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 80, 0, 0, 0, 12, 2 },
{ 17, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 80, 0, 8, 6, 12, 3 },
diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h
index 5a422ea4eb0..be2f44f0c32 100644
--- a/src/corelib/tools/qunicodetables_p.h
+++ b/src/corelib/tools/qunicodetables_p.h
@@ -50,11 +50,11 @@
// We mean it.
//
-#include
-
#ifndef QUNICODETABLES_P_H
#define QUNICODETABLES_P_H
+#include
+
#include
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 6825782131f..ce6e657be0f 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -162,9 +162,10 @@ public:
const const_iterator ce = this->cend(), cit = std::find(this->cbegin(), ce, t);
if (cit == ce)
return 0;
- // next operation detaches, so ce, cit may become invalidated:
+ // next operation detaches, so ce, cit, t may become invalidated:
+ const T tCopy = t;
const int firstFoundIdx = std::distance(this->cbegin(), cit);
- const iterator e = end(), it = std::remove(begin() + firstFoundIdx, e, t);
+ const iterator e = end(), it = std::remove(begin() + firstFoundIdx, e, tCopy);
const int result = std::distance(it, e);
erase(it, e);
return result;
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index c1ed410de70..9b5295a17e9 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -3741,7 +3741,6 @@ void QXmlStreamWriter::writeEntityReference(const QString &name)
void QXmlStreamWriter::writeNamespace(const QString &namespaceUri, const QString &prefix)
{
Q_D(QXmlStreamWriter);
- Q_ASSERT(!namespaceUri.isEmpty());
Q_ASSERT(prefix != QLatin1String("xmlns"));
if (prefix.isEmpty()) {
d->findNamespace(namespaceUri, d->inStartElement);
diff --git a/src/dbus/doc/qtdbus.qdocconf b/src/dbus/doc/qtdbus.qdocconf
index ff46cc5961b..69eaa0eec39 100644
--- a/src/dbus/doc/qtdbus.qdocconf
+++ b/src/dbus/doc/qtdbus.qdocconf
@@ -59,4 +59,4 @@ navigation.cppclassespage = "Qt D-Bus C++ Classes"
manifestmeta.thumbnail.names = "QtDBus/D-Bus List Names Example" \
"QtDBus/D-Bus Ping Pong Example" \
- "QtDBus/D-Bus Complex Ping Pong Example" \
+ "QtDBus/D-Bus Complex Ping Pong Example"
diff --git a/src/gui/configure.json b/src/gui/configure.json
index b617a1e31d2..0f71f7a98f7 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -723,6 +723,33 @@
},
"use": "egl"
},
+ "egl-openwfd": {
+ "label": "OpenWFD EGL",
+ "type": "compile",
+ "test": {
+ "include": [ "wfd.h" ],
+ "main": [
+ "wfdEnumerateDevices(nullptr, 0, nullptr);"
+ ]
+ },
+ "use": "egl"
+ },
+ "egl-rcar": {
+ "label": "RCAR EGL",
+ "type": "compile",
+ "test": {
+ "include": [ "EGL/egl.h" ],
+ "tail": [
+ "extern \"C\" {",
+ "extern unsigned long PVRGrfxServerInit(void);",
+ "}"
+ ],
+ "main": [
+ "PVRGrfxServerInit();"
+ ]
+ },
+ "use": "egl opengl_es2"
+ },
"evdev": {
"label": "evdev",
"type": "compile",
@@ -954,7 +981,7 @@
"label": "IMF",
"emitIf": "config.qnx",
"condition": "libs.imf",
- "output": [ "privateConfig" ]
+ "output": [ "privateFeature" ]
},
"integrityfb": {
"label": "INTEGRITY framebuffer",
@@ -1124,11 +1151,21 @@
"condition": "features.eglfs && tests.egl-viv",
"output": [ "privateFeature" ]
},
+ "eglfs_rcar": {
+ "label": "EGLFS RCAR",
+ "condition": "config.integrity && features.eglfs && tests.egl-rcar",
+ "output": [ "privateFeature" ]
+ },
"eglfs_viv_wl": {
"label": "EGLFS i.Mx6 Wayland",
"condition": "features.eglfs_viv && libs.wayland_server",
"output": [ "privateFeature" ]
},
+ "eglfs_openwfd": {
+ "label": "EGLFS OpenWFD",
+ "condition": "config.integrity && features.eglfs && tests.egl-openwfd",
+ "output": [ "privateFeature" ]
+ },
"gif": {
"label": "GIF",
"condition": "features.imageformatplugin",
@@ -1204,6 +1241,7 @@
"label": "XCB",
"section": "Platform plugins",
"autoDetect": "!config.darwin",
+ "enable": "input.xcb == 'system' || input.xcb == 'qt'",
"condition": "libs.xcb",
"output": [ "privateFeature" ]
},
@@ -1628,7 +1666,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla
"section": "EGLFS details",
"condition": "features.eglfs",
"entries": [
- "eglfs_viv", "eglfs_viv_wl", "eglfs_egldevice", "eglfs_gbm", "eglfs_mali", "eglfs_brcm", "egl_x11"
+ "eglfs_openwfd", "eglfs_viv", "eglfs_viv_wl", "eglfs_rcar", "eglfs_egldevice", "eglfs_gbm", "eglfs_mali", "eglfs_brcm", "egl_x11"
]
},
"linuxfb", "vnc", "mirclient",
diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf
index 3b3ebafc2d6..e1afa426edd 100644
--- a/src/gui/doc/qtgui.qdocconf
+++ b/src/gui/doc/qtgui.qdocconf
@@ -56,5 +56,7 @@ imagedirs += images \
../../../examples/gui/doc/images \
../../../doc/src/images \
+manifestmeta.highlighted.names = "QtGui/Analog Clock Window Example"
+
navigation.landingpage = "Qt GUI"
navigation.cppclassespage = "Qt GUI C++ Classes"
diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp
index 1ec45a7491d..587f375ce7f 100644
--- a/src/gui/image/qbmphandler.cpp
+++ b/src/gui/image/qbmphandler.cpp
@@ -49,10 +49,10 @@ QT_BEGIN_NAMESPACE
static void swapPixel01(QImage *image) // 1-bpp: swap 0 and 1 pixels
{
- qssize_t i;
+ qsizetype i;
if (image->depth() == 1 && image->colorCount() == 2) {
uint *p = (uint *)image->bits();
- qssize_t nbytes = static_cast(image->sizeInBytes());
+ qsizetype nbytes = static_cast(image->sizeInBytes());
for (i=0; i::max()/depth < width
|| bytes_per_line <= 0
|| height <= 0
- || std::numeric_limits::max()/uint(bytes_per_line) < height
+ || std::numeric_limits::max()/uint(bytes_per_line) < height
|| std::numeric_limits::max()/sizeof(uchar *) < uint(height))
return 0;
@@ -1470,7 +1470,7 @@ int QImage::byteCount() const
\sa byteCount(), bytesPerLine(), bits(), {QImage#Image Information}{Image
Information}
*/
-qssize_t QImage::sizeInBytes() const
+qsizetype QImage::sizeInBytes() const
{
return d ? d->nbytes : 0;
}
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 5f2965042f1..9b76b62f249 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -217,7 +217,7 @@ public:
#if QT_DEPRECATED_SINCE(5, 10)
QT_DEPRECATED_X("Use sizeInBytes") int byteCount() const;
#endif
- qssize_t sizeInBytes() const;
+ qsizetype sizeInBytes() const;
uchar *scanLine(int);
const uchar *scanLine(int) const;
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index 6abaa2887eb..4eef6173364 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -823,8 +823,8 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve
const int depth = 32;
- const qssize_t dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
- const qssize_t nbytes = dst_bytes_per_line * data->height;
+ const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
+ const qsizetype nbytes = dst_bytes_per_line * data->height;
uchar *const newData = (uchar *)realloc(data->data, nbytes);
if (!newData)
return false;
@@ -877,8 +877,8 @@ static bool convert_indexed8_to_ARGB_inplace(QImageData *data, Qt::ImageConversi
const int depth = 32;
- const qssize_t dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
- const qssize_t nbytes = dst_bytes_per_line * data->height;
+ const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
+ const qsizetype nbytes = dst_bytes_per_line * data->height;
uchar *const newData = (uchar *)realloc(data->data, nbytes);
if (!newData)
return false;
@@ -945,8 +945,8 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers
const int depth = 16;
- const qssize_t dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
- const qssize_t nbytes = dst_bytes_per_line * data->height;
+ const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
+ const qsizetype nbytes = dst_bytes_per_line * data->height;
uchar *const newData = (uchar *)realloc(data->data, nbytes);
if (!newData)
return false;
@@ -1002,8 +1002,8 @@ static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFl
const int depth = 16;
- const qssize_t dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
- const qssize_t src_bytes_per_line = data->bytes_per_line;
+ const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
+ const qsizetype src_bytes_per_line = data->bytes_per_line;
quint32 *src_data = (quint32 *) data->data;
quint16 *dst_data = (quint16 *) data->data;
@@ -1257,9 +1257,9 @@ void dither_to_Mono(QImageData *dst, const QImageData *src,
}
uchar *dst_data = dst->data;
- qssize_t dst_bpl = dst->bytes_per_line;
+ qsizetype dst_bpl = dst->bytes_per_line;
const uchar *src_data = src->data;
- qssize_t src_bpl = src->bytes_per_line;
+ qsizetype src_bpl = src->bytes_per_line;
switch (dithermode) {
case Diffuse: {
@@ -1912,8 +1912,8 @@ static void convert_Indexed8_to_Alpha8(QImageData *dest, const QImageData *src,
if (simpleCase)
memcpy(dest->data, src->data, src->bytes_per_line * src->height);
else {
- qssize_t size = src->bytes_per_line * src->height;
- for (qssize_t i = 0; i < size; ++i) {
+ qsizetype size = src->bytes_per_line * src->height;
+ for (qsizetype i = 0; i < size; ++i) {
dest->data[i] = translate[src->data[i]];
}
}
@@ -1936,8 +1936,8 @@ static void convert_Indexed8_to_Grayscale8(QImageData *dest, const QImageData *s
if (simpleCase)
memcpy(dest->data, src->data, src->bytes_per_line * src->height);
else {
- qssize_t size = src->bytes_per_line * src->height;
- for (qssize_t i = 0; i < size; ++i) {
+ qsizetype size = src->bytes_per_line * src->height;
+ for (qsizetype i = 0; i < size; ++i) {
dest->data[i] = translate[src->data[i]];
}
}
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 9ba4945dc5b..befecbfe8bd 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -71,12 +71,12 @@ struct Q_GUI_EXPORT QImageData { // internal image data
int width;
int height;
int depth;
- qssize_t nbytes; // number of bytes data
+ qsizetype nbytes; // number of bytes data
qreal devicePixelRatio;
QVector colortable;
uchar *data;
QImage::Format format;
- qssize_t bytes_per_line;
+ qsizetype bytes_per_line;
int ser_no; // serial number
int detach_no;
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index d694352fc17..646e737afa7 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -191,7 +191,7 @@ void QBlittablePlatformPixmap::fromImage(const QImage &image,
uchar *mem = thisImg->bits();
const uchar *bits = correctFormatPic.constBits();
- qssize_t bytesCopied = 0;
+ qsizetype bytesCopied = 0;
while (bytesCopied < correctFormatPic.sizeInBytes()) {
memcpy(mem,bits,correctFormatPic.bytesPerLine());
mem += thisImg->bytesPerLine();
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 5004582c5fc..b7c61779e69 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1787,6 +1787,9 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
case QWindowSystemInterfacePrivate::WindowScreenChanged:
QGuiApplicationPrivate::processWindowScreenChangedEvent(static_cast(e));
break;
+ case QWindowSystemInterfacePrivate::SafeAreaMarginsChanged:
+ QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(static_cast(e));
+ break;
case QWindowSystemInterfacePrivate::ApplicationStateChanged: {
QWindowSystemInterfacePrivate::ApplicationStateChangedEvent * changeEvent = static_cast(e);
QGuiApplicationPrivate::setApplicationState(changeEvent->newState, changeEvent->forcePropagate); }
@@ -2284,6 +2287,17 @@ void QGuiApplicationPrivate::processWindowScreenChangedEvent(QWindowSystemInterf
}
}
+void QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *wse)
+{
+ if (wse->window.isNull())
+ return;
+
+ // Handle by forwarding directly to QWindowPrivate, instead of sending spontaneous
+ // QEvent like most other functions, as there's no QEvent type for the safe area
+ // change, and we don't want to add one until we know that this is a good API.
+ qt_window_private(wse->window)->processSafeAreaMarginsChanged();
+}
+
void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce)
{
if (self)
@@ -2979,7 +2993,7 @@ QPlatformDragQtResponse QGuiApplicationPrivate::processDrag(QWindow *w, const QM
static QPointer currentDragWindow;
static Qt::DropAction lastAcceptedDropAction = Qt::IgnoreAction;
QPlatformDrag *platformDrag = platformIntegration()->drag();
- if (!platformDrag) {
+ if (!platformDrag || (w && w->d_func()->blockedByModalWindow)) {
lastAcceptedDropAction = Qt::IgnoreAction;
return QPlatformDragQtResponse(false, lastAcceptedDropAction, QRect());
}
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index b7b847785c4..75cbc7abde7 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -133,6 +133,8 @@ public:
static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e);
static void processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *e);
+ static void processSafeAreaMarginsChangedEvent(QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *e);
+
static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e);
static void updateFilteredScreenOrientation(QScreen *screen);
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index caef9428403..8689f9f3b18 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -376,8 +376,22 @@ qreal QHighDpiScaling::screenSubfactor(const QPlatformScreen *screen)
{
qreal factor = qreal(1.0);
if (screen) {
- if (m_usePixelDensity)
- factor *= screen->pixelDensity();
+ if (m_usePixelDensity) {
+ qreal pixelDensity = screen->pixelDensity();
+
+ // Pixel density reported by the screen is sometimes not precise enough,
+ // so recalculate it: divide px (physical pixels) by dp (device-independent pixels)
+ // for both width and height, and then use the average if it is different from
+ // the one initially reported by the screen
+ QRect screenGeometry = screen->geometry();
+ qreal wFactor = qreal(screenGeometry.width()) / qRound(screenGeometry.width() / pixelDensity);
+ qreal hFactor = qreal(screenGeometry.height()) / qRound(screenGeometry.height() / pixelDensity);
+ qreal averageDensity = (wFactor + hFactor) / 2;
+ if (!qFuzzyCompare(pixelDensity, averageDensity))
+ pixelDensity = averageDensity;
+
+ factor *= pixelDensity;
+ }
if (m_screenFactorSet) {
QVariant screenFactor = screen->screen()->property(scaleFactorProperty);
if (screenFactor.isValid())
diff --git a/src/gui/kernel/qinputdevicemanager.cpp b/src/gui/kernel/qinputdevicemanager.cpp
index 2d231ae26f6..37b1450d5ae 100644
--- a/src/gui/kernel/qinputdevicemanager.cpp
+++ b/src/gui/kernel/qinputdevicemanager.cpp
@@ -92,4 +92,48 @@ void QInputDeviceManager::setCursorPos(const QPoint &pos)
emit cursorPositionChangeRequested(pos);
}
+/*!
+ \return the keyboard modifier state stored in the QInputDeviceManager object.
+
+ Keyboard input handlers are expected to keep this up-to-date via
+ setKeyboardModifiers().
+
+ Querying the state via this function (e.g. from a mouse handler that needs
+ to include the modifier state in mouse events) is the preferred alternative
+ over QGuiApplication::keyboardModifiers() since the latter may not report
+ the current state due to asynchronous QPA event processing.
+ */
+Qt::KeyboardModifiers QInputDeviceManager::keyboardModifiers() const
+{
+ Q_D(const QInputDeviceManager);
+ return d->keyboardModifiers;
+}
+
+void QInputDeviceManager::setKeyboardModifiers(Qt::KeyboardModifiers modsBeforeEvent, int key)
+{
+ Q_D(QInputDeviceManager);
+ Qt::KeyboardModifiers mods;
+ switch (key) {
+ case Qt::Key_Shift:
+ mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::ShiftModifier);
+ break;
+ case Qt::Key_Control:
+ mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::ControlModifier);
+ break;
+ case Qt::Key_Alt:
+ mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::AltModifier);
+ break;
+ case Qt::Key_Meta:
+ mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::MetaModifier);
+ break;
+ case Qt::Key_AltGr:
+ mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::GroupSwitchModifier);
+ break;
+ default:
+ mods = modsBeforeEvent;
+ break;
+ }
+ d->keyboardModifiers = mods;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h
index db9d0596b6c..ddf1e6befab 100644
--- a/src/gui/kernel/qinputdevicemanager_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p.h
@@ -78,6 +78,9 @@ public:
void setCursorPos(const QPoint &pos);
+ Qt::KeyboardModifiers keyboardModifiers() const;
+ void setKeyboardModifiers(Qt::KeyboardModifiers modsBeforeEvent, int key);
+
signals:
void deviceListChanged(QInputDeviceManager::DeviceType type);
void cursorPositionChangeRequested(const QPoint &pos);
diff --git a/src/gui/kernel/qinputdevicemanager_p_p.h b/src/gui/kernel/qinputdevicemanager_p_p.h
index ae91f3a2abf..0a91252fbc3 100644
--- a/src/gui/kernel/qinputdevicemanager_p_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p_p.h
@@ -69,6 +69,8 @@ public:
void setDeviceCount(QInputDeviceManager::DeviceType type, int count);
QMap m_deviceCount;
+
+ Qt::KeyboardModifiers keyboardModifiers;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 6298dd5f456..27ea3864b99 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -937,7 +937,9 @@ GLuint QOpenGLContext::defaultFramebufferObject() const
/*!
Makes the context current in the current thread, against the given
- \a surface. Returns \c true if successful.
+ \a surface. Returns \c true if successful; otherwise returns \c false.
+ The latter may happen if the surface is not exposed, or the graphics
+ hardware is not available due to e.g. the application being suspended.
If \a surface is 0 this is equivalent to calling doneCurrent().
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 2284290d6cc..4bf96e277fa 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -165,6 +165,16 @@ QMargins QPlatformWindow::frameMargins() const
return QMargins();
}
+/*!
+ The safe area margins of a window represent the area that is safe to
+ place content within, without intersecting areas of the screen where
+ system UI is placed, or where a screen bezel may cover the content.
+*/
+QMargins QPlatformWindow::safeAreaMargins() const
+{
+ return QMargins();
+}
+
/*!
Reimplemented in subclasses to show the surface
if \a visible is \c true, and hide it if \a visible is \c false.
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h
index 4105ef1c1aa..61f1cb624c8 100644
--- a/src/gui/kernel/qplatformwindow.h
+++ b/src/gui/kernel/qplatformwindow.h
@@ -88,6 +88,7 @@ public:
virtual QRect normalGeometry() const;
virtual QMargins frameMargins() const;
+ virtual QMargins safeAreaMargins() const;
virtual void setVisible(bool visible);
virtual void setWindowFlags(Qt::WindowFlags flags);
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index fea55e459dd..3e5777ad491 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -2790,6 +2790,8 @@ bool QWindowPrivate::applyCursor()
if (!platformWindow)
return true;
QCursor *c = QGuiApplication::overrideCursor();
+ if (c != nullptr && platformCursor->capabilities().testFlag(QPlatformCursor::OverrideCursor))
+ return true;
if (!c && hasCursor)
c = &cursor;
platformCursor->changeCursor(c, q);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 2de5aab2c44..7ef73eb410f 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -155,6 +155,8 @@ public:
virtual void clearFocusObject();
virtual QRectF closestAcceptableGeometry(const QRectF &rect) const;
+ virtual void processSafeAreaMarginsChanged() {};
+
bool isPopup() const { return (windowFlags & Qt::WindowType_Mask) == Qt::Popup; }
static QWindowPrivate *get(QWindow *window) { return window->d_func(); }
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index a47bac8f396..35a9ede2272 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -265,6 +265,13 @@ void QWindowSystemInterface::handleWindowScreenChanged(QWindow *window, QScreen
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleSafeAreaMarginsChanged, QWindow *window)
+{
+ QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *e =
+ new QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent(window);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
+}
+
QT_DEFINE_QPA_EVENT_HANDLER(void, handleApplicationStateChanged, Qt::ApplicationState newState, bool forcePropagate)
{
Q_ASSERT(QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState));
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 960f79b5ba5..b22495f9d05 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -207,6 +207,9 @@ public:
static void handleWindowStateChanged(QWindow *window, Qt::WindowStates newState, int oldState = -1);
static void handleWindowScreenChanged(QWindow *window, QScreen *newScreen);
+ template
+ static void handleSafeAreaMarginsChanged(QWindow *window);
+
template
static void handleApplicationStateChanged(Qt::ApplicationState newState, bool forcePropagate = false);
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index 152ea92919a..c3fb19d21a3 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -98,7 +98,8 @@ public:
#endif
ApplicationStateChanged = 0x19,
FlushEvents = 0x20,
- WindowScreenChanged = 0x21
+ WindowScreenChanged = 0x21,
+ SafeAreaMarginsChanged = 0x22
};
class WindowSystemEvent {
@@ -185,6 +186,15 @@ public:
QPointer screen;
};
+ class SafeAreaMarginsChangedEvent : public WindowSystemEvent {
+ public:
+ SafeAreaMarginsChangedEvent(QWindow *w)
+ : WindowSystemEvent(SafeAreaMarginsChanged), window(w)
+ { }
+
+ QPointer window;
+ };
+
class ApplicationStateChangedEvent : public WindowSystemEvent {
public:
ApplicationStateChangedEvent(Qt::ApplicationState newState, bool forcePropagate = false)
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 855f2453962..c55bcb12c96 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -853,7 +853,7 @@ QString QColor::name(NameFormat format) const
return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6);
case HexArgb:
// it's called rgba() but it does return AARRGGBB
- return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8);
+ return QLatin1Char('#') + QString::number(rgba() | Q_INT64_C(0x100000000), 16).rightRef(8);
}
return QString();
}
diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h
index 7f677db465a..de721c94aac 100644
--- a/src/gui/painting/qcoregraphics_p.h
+++ b/src/gui/painting/qcoregraphics_p.h
@@ -56,13 +56,15 @@
#include
#include
-#ifdef Q_OS_MACOS
+
+#if defined(__OBJC__) && defined(Q_OS_MACOS)
#include
+#define HAVE_APPKIT
#endif
QT_BEGIN_NAMESPACE
-#ifdef Q_OS_MACOS
+#ifdef HAVE_APPKIT
Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QPixmap &pm);
Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0);
Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
@@ -75,7 +77,7 @@ Q_GUI_EXPORT void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBou
Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
-#ifdef Q_OS_MACOS
+#ifdef HAVE_APPKIT
Q_GUI_EXPORT QColor qt_mac_toQColor(const NSColor *color);
Q_GUI_EXPORT QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
#endif
@@ -121,4 +123,6 @@ private:
QT_END_NAMESPACE
+#undef HAVE_APPKIT
+
#endif // QCOREGRAPHICS_P_H
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 149fa124f6f..7f8976d9723 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -2383,7 +2383,7 @@ static void QT_FASTCALL fetchTransformedBilinearARGB32PM_fast_rotate_helper(uint
__m128i v_fy = _mm_setr_epi32(fy, fy + fdy, fy + fdy + fdy, fy + fdy + fdy + fdy);
const uchar *textureData = image.imageData;
- const qssize_t bytesPerLine = image.bytesPerLine;
+ const qsizetype bytesPerLine = image.bytesPerLine;
const __m128i vbpl = _mm_shufflelo_epi16(_mm_cvtsi32_si128(bytesPerLine/4), _MM_SHUFFLE(0, 0, 0, 0));
while (b < boundedEnd - 3) {
@@ -4719,6 +4719,7 @@ static void blend_transformed_argb(int count, const QSpan *spans, void *userData
CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode];
uint buffer[buffer_size];
+ quint32 mask = (data->texture.format == QImage::Format_RGB32) ? 0xff000000 : 0;
const int image_x1 = data->texture.x1;
const int image_y1 = data->texture.y1;
@@ -4752,7 +4753,7 @@ static void blend_transformed_argb(int count, const QSpan *spans, void *userData
while (b < end) {
int px = qBound(image_x1, x >> 16, image_x2);
int py = qBound(image_y1, y >> 16, image_y2);
- *b = reinterpret_cast(data->texture.scanLine(py))[px];
+ *b = reinterpret_cast(data->texture.scanLine(py))[px] | mask;
x += fdx;
y += fdy;
@@ -4793,7 +4794,7 @@ static void blend_transformed_argb(int count, const QSpan *spans, void *userData
const int px = qBound(image_x1, int(tx) - (tx < 0), image_x2);
const int py = qBound(image_y1, int(ty) - (ty < 0), image_y2);
- *b = reinterpret_cast(data->texture.scanLine(py))[px];
+ *b = reinterpret_cast(data->texture.scanLine(py))[px] | mask;
x += fdx;
y += fdy;
w += fdw;
@@ -4959,7 +4960,7 @@ static void blend_transformed_tiled_argb(int count, const QSpan *spans, void *us
int image_width = data->texture.width;
int image_height = data->texture.height;
- const qssize_t scanline_offset = data->texture.bytesPerLine / 4;
+ const qsizetype scanline_offset = data->texture.bytesPerLine / 4;
if (data->fast_matrix) {
// The increment pr x in the scanline
diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp
index d6c3319c762..26195397883 100644
--- a/src/gui/painting/qdrawhelper_avx2.cpp
+++ b/src/gui/painting/qdrawhelper_avx2.cpp
@@ -685,7 +685,7 @@ void QT_FASTCALL fetchTransformedBilinearARGB32PM_fast_rotate_helper_avx2(uint *
v_fy = _mm256_add_epi32(v_fy, _mm256_mullo_epi32(_mm256_set1_epi32(fdy), v_index));
const uchar *textureData = image.imageData;
- const qssize_t bytesPerLine = image.bytesPerLine;
+ const qsizetype bytesPerLine = image.bytesPerLine;
const __m256i vbpl = _mm256_set1_epi16(bytesPerLine/4);
while (b < boundedEnd - 7) {
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 1dea386da42..4c2fe873558 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -293,7 +293,7 @@ struct QTextureData
int y1;
int x2;
int y2;
- qssize_t bytesPerLine;
+ qsizetype bytesPerLine;
QImage::Format format;
const QVector *colorTable;
bool hasAlpha;
@@ -847,7 +847,7 @@ inline void qt_memfill(T *dest, T value, int count)
template Q_STATIC_TEMPLATE_FUNCTION
inline void qt_rectfill(T *dest, T value,
- int x, int y, int width, int height, qssize_t stride)
+ int x, int y, int width, int height, qsizetype stride)
{
char *d = reinterpret_cast(dest + x) + y * stride;
if (uint(stride) == (width * sizeof(T))) {
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index f42fd4ff87e..1aee7d5f745 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -751,11 +751,29 @@ void QPaintEngine::drawPath(const QPainterPath &)
void QPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
{
const QTextItemInt &ti = static_cast(textItem);
+ if (ti.glyphs.numGlyphs == 0)
+ return;
+
+ if (ti.fontEngine->glyphFormat == QFontEngine::Format_ARGB) {
+ QVarLengthArray positions;
+ QVarLengthArray glyphs;
+ QTransform matrix = QTransform::fromTranslate(p.x(), p.y() - ti.fontEngine->ascent().toReal());
+ ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
+ painter()->save();
+ painter()->setRenderHint(QPainter::SmoothPixmapTransform,
+ bool((painter()->renderHints() & QPainter::TextAntialiasing)
+ && !(painter()->font().styleStrategy() & QFont::NoAntialias)));
+ for (int i = 0; i < ti.glyphs.numGlyphs; ++i) {
+ QImage glyph = ti.fontEngine->bitmapForGlyph(glyphs[i], QFixed(), QTransform());
+ painter()->drawImage(positions[i].x.toReal(), positions[i].y.toReal(), glyph);
+ }
+ painter()->restore();
+ return;
+ }
QPainterPath path;
path.setFillRule(Qt::WindingFill);
- if (ti.glyphs.numGlyphs)
- ti.fontEngine->addOutlineToPath(0, 0, ti.glyphs, &path, ti.flags);
+ ti.fontEngine->addOutlineToPath(0, 0, ti.glyphs, &path, ti.flags);
if (!path.isEmpty()) {
painter()->save();
painter()->setRenderHint(QPainter::Antialiasing,
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 873303f78eb..0e3163eefbc 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -994,7 +994,7 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt,
Q_ASSERT(img.depth() >= 8);
- qssize_t srcBPL = img.bytesPerLine();
+ qsizetype srcBPL = img.bytesPerLine();
const uchar *srcBits = img.bits();
int srcSize = img.depth() >> 3; // This is the part that is incompatible with lower than 8-bit..
int iw = img.width();
@@ -1043,7 +1043,7 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt,
// call the blend function...
int dstSize = rasterBuffer->bytesPerPixel();
- qssize_t dstBPL = rasterBuffer->bytesPerLine();
+ qsizetype dstBPL = rasterBuffer->bytesPerLine();
func(rasterBuffer->buffer() + x * dstSize + y * dstBPL, dstBPL,
srcBits, srcBPL,
iw, ih,
@@ -2318,8 +2318,8 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
clippedSourceRect = clippedSourceRect.intersected(img.rect());
- const qssize_t dbpl = d->rasterBuffer->bytesPerLine();
- const qssize_t sbpl = img.bytesPerLine();
+ const qsizetype dbpl = d->rasterBuffer->bytesPerLine();
+ const qsizetype sbpl = img.bytesPerLine();
uchar *dst = d->rasterBuffer->buffer();
uint bpp = img.depth() >> 3;
@@ -2828,7 +2828,7 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs,
cache->fillInPendingGlyphs();
const QImage &image = cache->image();
- qssize_t bpl = image.bytesPerLine();
+ qsizetype bpl = image.bytesPerLine();
int depth = image.depth();
int rightShift = 0;
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 5f7f6a51489..e98ad8ce8b0 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -6482,7 +6482,7 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText
extended->drawTextItem(QPointF(x, y), ti2);
else
engine->drawTextItem(QPointF(x, y), ti2);
- drawTextItemDecoration(q, p, ti2.fontEngine, textEngine, ti2.underlineStyle,
+ drawTextItemDecoration(q, QPointF(x, y), ti2.fontEngine, textEngine, ti2.underlineStyle,
ti2.flags, ti2.width.toReal(), ti2.charFormat);
if (!rtl)
@@ -6515,7 +6515,7 @@ void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QText
extended->drawTextItem(QPointF(x, y), ti2);
else
engine->drawTextItem(QPointF(x,y), ti2);
- drawTextItemDecoration(q, p, ti2.fontEngine, textEngine, ti2.underlineStyle,
+ drawTextItemDecoration(q, QPointF(x, y), ti2.fontEngine, textEngine, ti2.underlineStyle,
ti2.flags, ti2.width.toReal(), ti2.charFormat);
// reset the high byte for all glyphs
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp
index af13b96c32c..e7ca00b3a96 100644
--- a/src/gui/text/qdistancefield.cpp
+++ b/src/gui/text/qdistancefield.cpp
@@ -177,8 +177,8 @@ void drawTriangle(qint32 *bits, int width, int height, const QPoint *center,
const int y2 = clip == Clip ? qBound(0, v2->y() >> 8, height) : v2->y() >> 8;
const int yC = clip == Clip ? qBound(0, center->y() >> 8, height) : center->y() >> 8;
- const int v1Frac = clip == Clip ? (y1 << 8) + 0xff - v1->y() : ~v2->y() & 0xff;
- const int v2Frac = clip == Clip ? (y2 << 8) + 0xff - v2->y() : ~v1->y() & 0xff;
+ const int v1Frac = clip == Clip ? (y1 << 8) + 0xff - v1->y() : ~v1->y() & 0xff;
+ const int v2Frac = clip == Clip ? (y2 << 8) + 0xff - v2->y() : ~v2->y() & 0xff;
const int centerFrac = clip == Clip ? (yC << 8) + 0xff - center->y() : ~center->y() & 0xff;
int dx1 = 0, x1 = 0, dx2 = 0, x2 = 0;
diff --git a/src/gui/util/qshadergraphloader.cpp b/src/gui/util/qshadergraphloader.cpp
index c7560d91057..8d92c73a5a9 100644
--- a/src/gui/util/qshadergraphloader.cpp
+++ b/src/gui/util/qshadergraphloader.cpp
@@ -48,10 +48,13 @@
QT_BEGIN_NAMESPACE
+void qt_register_ShaderLanguage_enums();
+
QShaderGraphLoader::QShaderGraphLoader() Q_DECL_NOTHROW
: m_status(Null),
m_device(nullptr)
{
+ qt_register_ShaderLanguage_enums();
}
QShaderGraphLoader::Status QShaderGraphLoader::status() const Q_DECL_NOTHROW
diff --git a/src/gui/util/qshaderlanguage.cpp b/src/gui/util/qshaderlanguage.cpp
index 4a0da5bfb53..f9192f5ff3f 100644
--- a/src/gui/util/qshaderlanguage.cpp
+++ b/src/gui/util/qshaderlanguage.cpp
@@ -43,14 +43,12 @@
QT_BEGIN_NAMESPACE
-namespace {
- void registerEnums()
- {
- qRegisterMetaType();
- qRegisterMetaType();
- }
+// Note: to be invoked explicitly. Relying for example on
+// Q_COREAPP_STARTUP_FUNCTION would not be acceptable in static builds.
+void qt_register_ShaderLanguage_enums()
+{
+ qRegisterMetaType();
+ qRegisterMetaType();
}
-Q_COREAPP_STARTUP_FUNCTION(registerEnums)
-
QT_END_NAMESPACE
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index dce256b7e56..07644b869f7 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -1889,7 +1889,8 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession
emit q->networkSessionConnected();
lastSessionState = state;
- if (online && state == QNetworkSession::Disconnected) {
+ if (online && (state == QNetworkSession::Disconnected
+ || state == QNetworkSession::NotAvailable)) {
const auto cfgs = networkConfigurationManager.allConfigurations();
for (const QNetworkConfiguration &cfg : cfgs) {
if (cfg.state().testFlag(QNetworkConfiguration::Active)) {
@@ -1931,9 +1932,9 @@ void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
online = (networkConfiguration.state() & QNetworkConfiguration::Active);
} else {
if (online != isOnline) {
+ online = isOnline;
_q_networkSessionClosed();
createSession(q->configuration());
- online = isOnline;
}
}
if (online) {
diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp
index 215cd3fdddb..677da08cb6c 100644
--- a/src/network/bearer/qbearerengine.cpp
+++ b/src/network/bearer/qbearerengine.cpp
@@ -93,8 +93,8 @@ bool QBearerEngine::configurationsInUse() const
|| hasUsedConfiguration(userChoiceConfigurations);
}
+QT_END_NAMESPACE
+
#include "moc_qbearerengine_p.cpp"
#endif // QT_NO_BEARERMANAGEMENT
-
-QT_END_NAMESPACE
diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp
index 7d7b7cc5b06..81b5e01d6af 100644
--- a/src/network/bearer/qnetworkconfigmanager.cpp
+++ b/src/network/bearer/qnetworkconfigmanager.cpp
@@ -378,8 +378,8 @@ void QNetworkConfigurationManager::updateConfigurations()
priv->performAsyncConfigurationUpdate();
}
-#include "moc_qnetworkconfigmanager.cpp"
-
QT_END_NAMESPACE
+#include "moc_qnetworkconfigmanager.cpp"
+
#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp
index bbcd191041c..e5562e3a0b4 100644
--- a/src/network/bearer/qnetworksession.cpp
+++ b/src/network/bearer/qnetworksession.cpp
@@ -749,8 +749,8 @@ void QNetworkSession::disconnectNotify(const QMetaMethod &signal)
d->setALREnabled(false);
}
-#include "moc_qnetworksession.cpp"
-
QT_END_NAMESPACE
+#include "moc_qnetworksession.cpp"
+
#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/network/configure.json b/src/network/configure.json
index ea01e8224d3..94a23bbc788 100644
--- a/src/network/configure.json
+++ b/src/network/configure.json
@@ -69,18 +69,10 @@
{
"comment": "placeholder for OPENSSL_{PATH,LIBS{,_{DEBUG,RELEASE}}}",
"libs": "",
- "builds": {
- "debug": "",
- "release": ""
- },
"condition": "config.win32 && !features.shared"
},
{
"libs": "-lssleay32 -llibeay32",
- "builds": {
- "debug": "",
- "release": ""
- },
"condition": "config.win32 && features.shared"
},
{ "libs": "-lssl -lcrypto", "condition": "!config.win32" }
diff --git a/src/network/doc/qtnetwork.qdocconf b/src/network/doc/qtnetwork.qdocconf
index 2a8e577dda0..4f667eed9d7 100644
--- a/src/network/doc/qtnetwork.qdocconf
+++ b/src/network/doc/qtnetwork.qdocconf
@@ -40,5 +40,7 @@ exampledirs += ../../../examples/network \
imagedirs += images \
../../../examples/network/doc/images
+manifestmeta.highlighted.names = "QtNetwork/HTTP Example"
+
navigation.landingpage = "Qt Network"
navigation.cppclassespage = "Qt Network C++ Classes"
diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
index 1da00813ce2..ce1ec6442a6 100644
--- a/src/network/kernel/qdnslookup_unix.cpp
+++ b/src/network/kernel/qdnslookup_unix.cpp
@@ -42,6 +42,7 @@
#if QT_CONFIG(library)
#include
#endif
+#include
#include
#include
#include
@@ -58,6 +59,8 @@
# include
#endif
+#include
+
QT_BEGIN_NAMESPACE
#if QT_CONFIG(library)
@@ -137,7 +140,7 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
// Initialize state.
struct __res_state state;
- memset(&state, 0, sizeof(state));
+ std::memset(&state, 0, sizeof(state));
if (local_res_ninit(&state) < 0) {
reply->error = QDnsLookup::ResolverError;
reply->errorString = tr("Resolver initialization failed");
@@ -189,11 +192,25 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
QScopedPointer state_ptr(&state);
// Perform DNS query.
- unsigned char response[PACKETSZ];
- memset(response, 0, sizeof(response));
- const int responseLength = local_res_nquery(&state, requestName, C_IN, requestType, response, sizeof(response));
+ QVarLengthArray buffer(PACKETSZ);
+ std::memset(buffer.data(), 0, buffer.size());
+ int responseLength = local_res_nquery(&state, requestName, C_IN, requestType, buffer.data(), buffer.size());
+ if (Q_UNLIKELY(responseLength > PACKETSZ)) {
+ buffer.resize(responseLength);
+ std::memset(buffer.data(), 0, buffer.size());
+ responseLength = local_res_nquery(&state, requestName, C_IN, requestType, buffer.data(), buffer.size());
+ if (Q_UNLIKELY(responseLength > buffer.size())) {
+ // Ok, we give up.
+ reply->error = QDnsLookup::ResolverError;
+ reply->errorString.clear(); // We cannot be more specific, alas.
+ return;
+ }
+ }
- // Check the response header.
+ unsigned char *response = buffer.data();
+ // Check the response header. Though res_nquery returns -1 as a
+ // responseLength in case of error, we still can extract the
+ // exact error code from the response.
HEADER *header = (HEADER*)response;
const int answerCount = ntohs(header->ancount);
switch (header->rcode) {
diff --git a/src/network/kernel/qnetworkinterface_linux.cpp b/src/network/kernel/qnetworkinterface_linux.cpp
index 3211d1b8d8b..01b28110707 100644
--- a/src/network/kernel/qnetworkinterface_linux.cpp
+++ b/src/network/kernel/qnetworkinterface_linux.cpp
@@ -165,7 +165,7 @@ template struct ProcessNetlinkRequest
int expectedType = expectedTypeForRequest(hdr->nlmsg_type);
const bool isDump = hdr->nlmsg_flags & NLM_F_DUMP;
forever {
- qssize_t len = recv(sock, buf, bufsize, 0);
+ qsizetype len = recv(sock, buf, bufsize, 0);
hdr = reinterpret_cast(buf);
if (!NLMSG_OK(hdr, len))
return;
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 98baa0c0473..13e10e4102c 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -1713,6 +1713,8 @@ void QAbstractSocket::connectToHost(const QString &hostName, quint16 port,
}
#endif
+ // Sync up with error string, which open() shall clear.
+ d->socketError = UnknownSocketError;
if (openMode & QIODevice::Unbuffered)
d->isBuffered = false;
else if (!d_func()->isBuffered)
@@ -1948,6 +1950,8 @@ bool QAbstractSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState
return false;
}
+ // Sync up with error string, which open() shall clear.
+ d->socketError = UnknownSocketError;
if (d->threadData->hasEventDispatcher())
d->socketEngine->setReceiver(d);
diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h
index 3d788319a8c..066a35ff854 100644
--- a/src/network/socket/qabstractsocket_p.h
+++ b/src/network/socket/qabstractsocket_p.h
@@ -156,6 +156,7 @@ public:
QAbstractSocket::SocketType socketType;
QAbstractSocket::SocketState state;
+ // Must be kept in sync with QIODevicePrivate::errorString.
QAbstractSocket::SocketError socketError;
QAbstractSocket::NetworkLayerProtocol preferredNetworkLayerProtocol;
diff --git a/src/network/socket/qlocalserver_win.cpp b/src/network/socket/qlocalserver_win.cpp
index 8cb3449343f..ced923ced13 100644
--- a/src/network/socket/qlocalserver_win.cpp
+++ b/src/network/socket/qlocalserver_win.cpp
@@ -225,7 +225,7 @@ bool QLocalServerPrivate::addListener()
void QLocalServerPrivate::setError(const QString &function)
{
int windowsError = GetLastError();
- errorString = QString::fromLatin1("%1: %2").arg(function).arg(qt_error_string(windowsError));
+ errorString = QString::fromLatin1("%1: %2").arg(function, qt_error_string(windowsError));
error = QAbstractSocket::UnknownSocketError;
}
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index e8ab8de469c..c303f016481 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -1321,6 +1321,9 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
setPortAndAddress(header.destinationPort, header.destinationAddress, &aa, &msg.namelen);
+ uint oldIfIndex = 0;
+ bool mustSetIpv6MulticastIf = false;
+
if (msg.namelen == sizeof(aa.a6)) {
// sending IPv6
if (header.hopLimit != -1) {
@@ -1332,7 +1335,7 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
cmsgptr = reinterpret_cast(reinterpret_cast(cmsgptr)
+ WSA_CMSG_SPACE(sizeof(int)));
}
- if (header.ifindex != 0 || !header.senderAddress.isNull()) {
+ if (!header.senderAddress.isNull()) {
struct in6_pktinfo *data = reinterpret_cast(WSA_CMSG_DATA(cmsgptr));
memset(data, 0, sizeof(*data));
msg.Control.len += WSA_CMSG_SPACE(sizeof(*data));
@@ -1345,6 +1348,21 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
memcpy(&data->ipi6_addr, &tmp, sizeof(tmp));
cmsgptr = reinterpret_cast(reinterpret_cast(cmsgptr)
+ WSA_CMSG_SPACE(sizeof(*data)));
+ } else if (header.ifindex != 0) {
+ // Unlike other operating systems, setting the interface index in the in6_pktinfo
+ // structure above and leaving the ipi6_addr set to :: will cause the packets to be
+ // sent with source address ::. So we have to use IPV6_MULTICAST_IF, which MSDN is
+ // quite clear that "This option does not change the default interface for receiving
+ // IPv6 multicast traffic."
+ QT_SOCKOPTLEN_T len = sizeof(oldIfIndex);
+ if (::getsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_MULTICAST_IF,
+ reinterpret_cast(&oldIfIndex), &len) == -1
+ || ::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_MULTICAST_IF,
+ reinterpret_cast(&header.ifindex), sizeof(header.ifindex)) == -1) {
+ setError(QAbstractSocket::NetworkError, SendDatagramErrorString);
+ return -1;
+ }
+ mustSetIpv6MulticastIf = true;
}
} else {
// sending IPv4
@@ -1398,6 +1416,12 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l
ret = qint64(bytesSent);
}
+ if (mustSetIpv6MulticastIf) {
+ // undo what we did above
+ ::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_MULTICAST_IF,
+ reinterpret_cast(&oldIfIndex), sizeof(oldIfIndex));
+ }
+
#if defined (QNATIVESOCKETENGINE_DEBUG)
qDebug("QNativeSocketEnginePrivate::nativeSendDatagram(%p \"%s\", %lli, \"%s\", %i) == %lli", data,
qt_prettyDebug(data, qMin(len, 16), len).data(), len,
diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp
index 79629a07f2a..85c4f4cbfdb 100644
--- a/src/network/socket/qudpsocket.cpp
+++ b/src/network/socket/qudpsocket.cpp
@@ -185,6 +185,10 @@ QUdpSocket::~QUdpSocket()
This function returns \c true if successful; otherwise it returns \c false
and sets the socket error accordingly.
+ \note Joining IPv6 multicast groups without an interface selection is not
+ supported in all operating systems. Consider using the overload where the
+ interface is specified.
+
\sa leaveMulticastGroup()
*/
bool QUdpSocket::joinMulticastGroup(const QHostAddress &groupAddress)
@@ -219,6 +223,9 @@ bool QUdpSocket::joinMulticastGroup(const QHostAddress &groupAddress,
This function returns \c true if successful; otherwise it returns \c false and
sets the socket error accordingly.
+ \note This function should be called with the same arguments as were passed
+ to joinMulticastGroup().
+
\sa joinMulticastGroup()
*/
bool QUdpSocket::leaveMulticastGroup(const QHostAddress &groupAddress)
@@ -233,6 +240,9 @@ bool QUdpSocket::leaveMulticastGroup(const QHostAddress &groupAddress)
Leaves the multicast group specified by \a groupAddress on the interface \a
iface.
+ \note This function should be called with the same arguments as were passed
+ to joinMulticastGroup().
+
\sa joinMulticastGroup()
*/
bool QUdpSocket::leaveMulticastGroup(const QHostAddress &groupAddress,
diff --git a/src/network/ssl/qsslkey_qt.cpp b/src/network/ssl/qsslkey_qt.cpp
index 817317f303e..a85fed21ed7 100644
--- a/src/network/ssl/qsslkey_qt.cpp
+++ b/src/network/ssl/qsslkey_qt.cpp
@@ -95,7 +95,7 @@ static OidLengthMap createOidMap()
oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.8"), 160); // secp160r1
oids.insert(oids.cend(), QByteArrayLiteral("1.3.132.0.9"), 160); // secp160k1
oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.11"), 384); // brainpoolP384r1
- oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.13"), 521); // brainpoolP512r1
+ oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.13"), 512); // brainpoolP512r1
oids.insert(oids.cend(), QByteArrayLiteral("1.3.36.3.3.2.8.1.1.7"), 256); // brainpoolP256r1
return oids;
}
diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp
index 5c2bd551986..046b4322526 100644
--- a/src/network/ssl/qsslsocket_mac.cpp
+++ b/src/network/ssl/qsslsocket_mac.cpp
@@ -47,6 +47,7 @@
#include "qsslkey_p.h"
#include
+#include
#include
#include
#include
@@ -1307,13 +1308,17 @@ bool QSslSocketBackendPrivate::verifyPeerTrust()
// actual system CA certificate list (which most use-cases need) other than
// by letting SecTrustEvaluate fall through to the system list; so, in this case
// (even though the client code may have provided its own certs), we retain
- // the default behavior.
+ // the default behavior. Note, with macOS SDK below 10.12 using 'trust my
+ // anchors only' may result in some valid chains rejected, apparently the
+ // ones containing intermediated certificates; so we use this functionality
+ // on more recent versions only.
+
+ bool anchorsFromConfigurationOnly = false;
#ifdef Q_OS_MACOS
- const bool anchorsFromConfigurationOnly = true;
-#else
- const bool anchorsFromConfigurationOnly = false;
-#endif
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSSierra)
+ anchorsFromConfigurationOnly = true;
+#endif // Q_OS_MACOS
SecTrustSetAnchorCertificatesOnly(trust, anchorsFromConfigurationOnly);
diff --git a/src/network/ssl/qsslsocket_winrt.cpp b/src/network/ssl/qsslsocket_winrt.cpp
index 6c5a09962b1..f64ae2e0201 100644
--- a/src/network/ssl/qsslsocket_winrt.cpp
+++ b/src/network/ssl/qsslsocket_winrt.cpp
@@ -47,6 +47,7 @@
#include
#include
#include
+#include
#include
#include
@@ -443,8 +444,11 @@ void QSslSocketBackendPrivate::continueHandshake()
return;
}
- hr = op->put_Completed(Callback(
- this, &QSslSocketBackendPrivate::onSslUpgrade).Get());
+ hr = QEventDispatcherWinRT::runOnXamlThread([this, op]() {
+ HRESULT hr = op->put_Completed(Callback(
+ this, &QSslSocketBackendPrivate::onSslUpgrade).Get());
+ return hr;
+ });
Q_ASSERT_SUCCEEDED(hr);
}
diff --git a/src/platformsupport/eglconvenience/qeglpbuffer.cpp b/src/platformsupport/eglconvenience/qeglpbuffer.cpp
index 67d72047349..15fc0897786 100644
--- a/src/platformsupport/eglconvenience/qeglpbuffer.cpp
+++ b/src/platformsupport/eglconvenience/qeglpbuffer.cpp
@@ -62,7 +62,7 @@ QEGLPbuffer::QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffs
, m_display(display)
, m_pbuffer(EGL_NO_SURFACE)
{
- bool hasSurfaceless = !flags.testFlag(QEGLPlatformContext::NoSurfaceless)
+ m_hasSurfaceless = !flags.testFlag(QEGLPlatformContext::NoSurfaceless)
&& q_hasEglExtension(display, "EGL_KHR_surfaceless_context");
// Disable surfaceless contexts on Mesa for now. As of 10.6.0 and Intel at least, some
@@ -72,9 +72,9 @@ QEGLPbuffer::QEGLPbuffer(EGLDisplay display, const QSurfaceFormat &format, QOffs
// read/draw surface in the Intel backend.
const char *vendor = eglQueryString(display, EGL_VENDOR); // hard to check for GL_ strings here, so blacklist all Mesa
if (vendor && strstr(vendor, "Mesa"))
- hasSurfaceless = false;
+ m_hasSurfaceless = false;
- if (hasSurfaceless)
+ if (m_hasSurfaceless)
return;
EGLConfig config = q_configFromGLFormat(m_display, m_format, false, EGL_PBUFFER_BIT);
@@ -100,4 +100,9 @@ QEGLPbuffer::~QEGLPbuffer()
eglDestroySurface(m_display, m_pbuffer);
}
+bool QEGLPbuffer::isValid() const
+{
+ return m_pbuffer != EGL_NO_SURFACE || m_hasSurfaceless;
+}
+
QT_END_NAMESPACE
diff --git a/src/platformsupport/eglconvenience/qeglpbuffer_p.h b/src/platformsupport/eglconvenience/qeglpbuffer_p.h
index eed8cd9dcab..0285e067a63 100644
--- a/src/platformsupport/eglconvenience/qeglpbuffer_p.h
+++ b/src/platformsupport/eglconvenience/qeglpbuffer_p.h
@@ -64,7 +64,7 @@ public:
~QEGLPbuffer();
QSurfaceFormat format() const override { return m_format; }
- bool isValid() const override { return m_pbuffer != EGL_NO_SURFACE; }
+ bool isValid() const override;
EGLSurface pbuffer() const { return m_pbuffer; }
@@ -72,6 +72,7 @@ private:
QSurfaceFormat m_format;
EGLDisplay m_display;
EGLSurface m_pbuffer;
+ bool m_hasSurfaceless;
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
index 898cabd7860..beec8e763ca 100644
--- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
+++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
@@ -1773,7 +1773,10 @@ QFixed QFontEngineFT::scaledBitmapMetrics(QFixed m) const
glyph_metrics_t QFontEngineFT::scaledBitmapMetrics(const glyph_metrics_t &m, const QTransform &t) const
{
- QTransform trans(t);
+ QTransform trans;
+ trans.setMatrix(t.m11(), t.m12(), t.m13(),
+ t.m21(), t.m22(), t.m23(),
+ 0, 0, t.m33());
const qreal scaleFactor = scalableBitmapScaleFactor.toReal();
trans.scale(scaleFactor, scaleFactor);
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 6347d4d2319..237e8a89a53 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -416,7 +416,19 @@ extern CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef);
template <>
QFontEngine *QCoreTextFontDatabaseEngineFactory::fontEngine(const QFontDef &fontDef, void *usrPtr)
{
- CTFontDescriptorRef descriptor = static_cast(usrPtr);
+ QCFType descriptor = QCFType::constructFromGet(
+ static_cast(usrPtr));
+
+ // CoreText will sometimes invalidate information in font descriptors that refer
+ // to system fonts in certain function calls or application states. While the descriptor
+ // looks the same from the outside, some internal plumbing is different, causing the results
+ // of creating CTFonts from those descriptors unreliable. The work-around for this
+ // is to copy the attributes of those descriptors each time we make a new CTFont
+ // from them instead of referring to the original, as that may trigger the CoreText bug.
+ if (m_systemFontDescriptors.contains(descriptor)) {
+ QCFType attributes = CTFontDescriptorCopyAttributes(descriptor);
+ descriptor = CTFontDescriptorCreateWithAttributes(attributes);
+ }
// Since we do not pass in the destination DPI to CoreText when making
// the font, we need to pass in a point size which is scaled to include
@@ -427,14 +439,10 @@ QFontEngine *QCoreTextFontDatabaseEngineFactory::fontEngine
qreal scaledPointSize = fontDef.pixelSize;
CGAffineTransform matrix = qt_transform_from_fontdef(fontDef);
- CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, &matrix);
- if (font) {
- QFontEngine *engine = new QCoreTextFontEngine(font, fontDef);
- CFRelease(font);
- return engine;
- }
+ if (QCFType font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, &matrix))
+ return new QCoreTextFontEngine(font, fontDef);
- return NULL;
+ return nullptr;
}
#ifndef QT_NO_FREETYPE
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
index 76ab31c0463..05f6ed641ca 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
@@ -87,12 +87,14 @@ public:
QFont *themeFont(QPlatformTheme::Font) const;
const QHash &themeFonts() const;
+protected:
+ mutable QSet m_systemFontDescriptors;
+
private:
void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString());
mutable QString defaultFontName;
- mutable QSet m_systemFontDescriptors;
mutable QHash m_themeFonts;
bool m_hasPopulatedAliases;
};
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
index 2d6426db7f6..47a65eded8d 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
@@ -49,6 +49,9 @@
#include
#include
+#include
+#include
+
#ifdef Q_OS_FREEBSD
#include
#else
@@ -222,6 +225,8 @@ void QEvdevKeyboardHandler::readKeycode()
void QEvdevKeyboardHandler::processKeyEvent(int nativecode, int unicode, int qtcode,
Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat)
{
+ QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(modifiers, qtcode);
+
QWindowSystemInterface::handleExtendedKeyEvent(0, (isPress ? QEvent::KeyPress : QEvent::KeyRelease),
qtcode, modifiers, nativecode + 8, 0, int(modifiers),
(unicode != 0xffff ) ? QString(unicode) : QString(), autoRepeat);
@@ -403,6 +408,8 @@ QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint
Qt::KeyboardModifiers qtmods = Qt::KeyboardModifiers(qtcode & modmask);
qtcode &= ~modmask;
+ // qtmods here is the modifier state before the event, i.e. not
+ // including the current key in case it is a modifier.
qCDebug(qLcEvdevKeyMap, "Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode, int(qtmods));
// If NumLockOff and keypad key pressed remap event sent
diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
index 21f7fde7c86..54af8a5b0cb 100644
--- a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
+++ b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
@@ -40,6 +40,8 @@
#include "qlibinputkeyboard_p.h"
#include
#include
+#include
+#include
#include
#include
#ifndef QT_NO_XKBCOMMON_EVDEV
@@ -196,6 +198,8 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e)
const xkb_keysym_t sym = xkb_state_key_get_one_sym(m_state, k);
+ // mods here is the modifier state before the event, i.e. not
+ // including the current key in case it is a modifier.
Qt::KeyboardModifiers mods = Qt::NoModifier;
const int qtkey = keysymToQtKey(sym, &mods, text);
@@ -211,6 +215,7 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e)
xkb_state_update_key(m_state, k, pressed ? XKB_KEY_DOWN : XKB_KEY_UP);
+ QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(mods, qtkey);
QWindowSystemInterface::handleExtendedKeyEvent(nullptr,
pressed ? QEvent::KeyPress : QEvent::KeyRelease,
qtkey, mods, k, sym, mods, text);
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp
index 12379a83fac..cb08ab53b22 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer.cpp
+++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp
@@ -42,6 +42,8 @@
#include
#include
#include
+#include
+#include
#include
#include
@@ -80,7 +82,7 @@ void QLibInputPointer::processButton(libinput_event_pointer *e)
m_buttons.setFlag(button, pressed);
QEvent::Type type = pressed ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease;
- Qt::KeyboardModifiers mods = QGuiApplication::keyboardModifiers();
+ Qt::KeyboardModifiers mods = QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers();
QWindowSystemInterface::handleMouseEvent(nullptr, m_pos, m_pos, m_buttons, button, type, mods);
}
@@ -95,7 +97,7 @@ void QLibInputPointer::processMotion(libinput_event_pointer *e)
m_pos.setX(qBound(g.left(), qRound(m_pos.x() + dx), g.right()));
m_pos.setY(qBound(g.top(), qRound(m_pos.y() + dy), g.bottom()));
- Qt::KeyboardModifiers mods = QGuiApplication::keyboardModifiers();
+ Qt::KeyboardModifiers mods = QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers();
QWindowSystemInterface::handleMouseEvent(nullptr, m_pos, m_pos, m_buttons,
Qt::NoButton, QEvent::MouseMove, mods);
diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro
index b362722b282..824fd0388f9 100644
--- a/src/plugins/bearer/bearer.pro
+++ b/src/plugins/bearer/bearer.pro
@@ -6,11 +6,6 @@ QT_FOR_CONFIG += network-private
SUBDIRS += connman networkmanager
}
-#win32:SUBDIRS += nla
-win32:SUBDIRS += generic
-win32:!winrt: SUBDIRS += nativewifi
-darwin:qtConfig(corewlan): SUBDIRS += corewlan
-mac:SUBDIRS += generic
android:SUBDIRS += android
isEmpty(SUBDIRS):SUBDIRS = generic
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index 55eec572700..7c9db4640b7 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -506,7 +506,7 @@ void QConnmanTechnologyInterface::scan()
void QConnmanTechnologyInterface::scanReply(QDBusPendingCallWatcher *call)
{
- QDBusPendingReply props_reply = *call;
+ QDBusPendingReply<> props_reply = *call;
if (props_reply.isError()) {
qDebug() << props_reply.error().message();
}
diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp
index a3bc58bb89c..309e41bfd6f 100644
--- a/src/plugins/platforms/android/androidjniaccessibility.cpp
+++ b/src/plugins/platforms/android/androidjniaccessibility.cpp
@@ -106,7 +106,8 @@ namespace QtAndroidAccessibility
QAccessibleInterface *iface = interfaceFromId(objectId);
if (iface && iface->isValid()) {
const int childCount = iface->childCount();
- QVarLengthArray ifaceIdArray(childCount);
+ QVarLengthArray ifaceIdArray;
+ ifaceIdArray.reserve(childCount);
for (int i = 0; i < childCount; ++i) {
QAccessibleInterface *child = iface->child(i);
if (child && child->isValid())
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index 7fa809f3f81..fe4c5be4cba 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -526,6 +526,10 @@ void QAndroidInputContext::updateCursorPosition()
void QAndroidInputContext::updateSelectionHandles()
{
+ static bool noHandles = qEnvironmentVariableIntValue("QT_QPA_NO_TEXT_HANDLES");
+ if (noHandles)
+ return;
+
auto im = qGuiApp->inputMethod();
if (!m_focusObject || (m_cursorHandleShown == CursorHandleNotShown)) {
// Hide the handles
@@ -843,11 +847,11 @@ jint QAndroidInputContext::getCursorCapsMode(jint /*reqModes*/)
const uint qtInputMethodHints = query->value(Qt::ImHints).toUInt();
- if (qtInputMethodHints & Qt::ImhPreferUppercase)
- res = CAP_MODE_SENTENCES;
+ if (!(qtInputMethodHints & Qt::ImhLowercaseOnly) && !(qtInputMethodHints & Qt::ImhNoAutoUppercase))
+ res |= CAP_MODE_SENTENCES;
if (qtInputMethodHints & Qt::ImhUppercaseOnly)
- res = CAP_MODE_CHARACTERS;
+ res |= CAP_MODE_CHARACTERS;
return res;
}
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h
index 129307acf41..0530aa82015 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.h
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h
@@ -84,6 +84,7 @@ private:
NSOpenGLContext *m_shareContext;
QSurfaceFormat m_format;
QPointer m_currentWindow;
+ bool m_didCheckForSoftwareContext;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index 5ed81a7f1b2..b656025ec7e 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -121,7 +121,8 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo
const QVariant &nativeHandle)
: m_context(nil),
m_shareContext(nil),
- m_format(format)
+ m_format(format),
+ m_didCheckForSoftwareContext(false)
{
if (!nativeHandle.isNull()) {
if (!nativeHandle.canConvert()) {
@@ -152,9 +153,32 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo
QMacAutoReleasePool pool; // For the SG Canvas render thread
+ m_shareContext = share ? static_cast(share)->nsOpenGLContext() : nil;
+
+ if (m_shareContext) {
+ // Allow sharing between 3.2 Core and 4.1 Core profile versions in
+ // cases where NSOpenGLContext creates a 4.1 context where a 3.2
+ // context was requested. Due to the semantics of QSurfaceFormat
+ // this 4.1 version can find its way onto the format for the new
+ // context, even though it was at no point requested by the user.
+ GLint shareContextRequestedProfile;
+ [m_shareContext.pixelFormat getValues:&shareContextRequestedProfile
+ forAttribute:NSOpenGLPFAOpenGLProfile forVirtualScreen:0];
+ auto shareContextActualProfile = share->format().version();
+
+ if (shareContextRequestedProfile == NSOpenGLProfileVersion3_2Core &&
+ shareContextActualProfile >= qMakePair(4, 1)) {
+
+ // There is a mismatch, downgrade requested format to make the
+ // NSOpenGLPFAOpenGLProfile attributes match. (NSOpenGLContext will
+ // fail to create a new context if there is a mismatch).
+ if (m_format.version() >= qMakePair(4, 1))
+ m_format.setVersion(3, 2);
+ }
+ }
+
// create native context for the requested pixel format and share
NSOpenGLPixelFormat *pixelFormat = createNSOpenGLPixelFormat(m_format);
- m_shareContext = share ? static_cast(share)->nsOpenGLContext() : nil;
m_context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:m_shareContext];
// retry without sharing on context creation failure.
@@ -239,6 +263,22 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface)
QWindow *window = static_cast(surface)->window();
setActiveWindow(window);
+
+ // Disable high-resolution surfaces when using the software renderer, which has the
+ // problem that the system silently falls back to a to using a low-resolution buffer
+ // when a high-resolution buffer is requested. This is not detectable using the NSWindow
+ // convertSizeToBacking and backingScaleFactor APIs. A typical result of this is that Qt
+ // will display a quarter of the window content when running in a virtual machine.
+ if (!m_didCheckForSoftwareContext) {
+ m_didCheckForSoftwareContext = true;
+
+ const GLubyte* renderer = glGetString(GL_RENDERER);
+ if (qstrcmp((const char *)renderer, "Apple Software Renderer") == 0) {
+ NSView *view = static_cast(surface)->m_view;
+ [view setWantsBestResolutionOpenGLSurface:NO];
+ }
+ }
+
update();
return true;
}
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.h b/src/plugins/platforms/cocoa/qcocoamenubar.h
index 32a8fd89b49..6f3aca3a516 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.h
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.h
@@ -71,6 +71,7 @@ public:
QList merged() const;
NSMenuItem *itemForRole(QPlatformMenuItem::MenuRole r);
+ QCocoaWindow *cocoaWindow() const;
void syncMenu_helper(QPlatformMenu *menu, bool menubarUpdate);
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm
index fd28a4d7dad..8091d00bda5 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm
@@ -452,5 +452,10 @@ NSMenuItem *QCocoaMenuBar::itemForRole(QPlatformMenuItem::MenuRole r)
return nullptr;
}
+QCocoaWindow *QCocoaMenuBar::cocoaWindow() const
+{
+ return m_window.data();
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
index fdca7297de9..cd597da71ca 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
@@ -43,6 +43,7 @@
#include "qcocoahelpers.h"
#include "qcocoamenubar.h"
#include "qcocoamenuitem.h"
+#include "qcocoaintegration.h"
#include
#include
@@ -347,10 +348,13 @@
- (BOOL)validateMenuItem:(NSMenuItem*)menuItem
{
- if ([menuItem action] == @selector(hide:)
- || [menuItem action] == @selector(hideOtherApplications:)
+ if ([menuItem action] == @selector(hideOtherApplications:)
|| [menuItem action] == @selector(unhideAllApplications:)) {
return [NSApp validateMenuItem:menuItem];
+ } else if ([menuItem action] == @selector(hide:)) {
+ if (QCocoaIntegration::instance()->activePopupWindow())
+ return NO;
+ return [NSApp validateMenuItem:menuItem];
} else if ([menuItem tag]) {
QCocoaMenuItem *cocoaItem = reinterpret_cast([menuItem tag]);
return cocoaItem->isEnabled();
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index c3160e32c29..c000c90a855 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -198,6 +198,7 @@ void QCocoaWindow::initialize()
BOOL enable = qt_mac_resolveOption(YES, window(), "_q_mac_wantsBestResolutionOpenGLSurface",
"QT_MAC_WANTS_BEST_RESOLUTION_OPENGL_SURFACE");
[m_view setWantsBestResolutionOpenGLSurface:enable];
+ // See also QCocoaGLContext::makeCurrent for software renderer workarounds.
}
BOOL enable = qt_mac_resolveOption(NO, window(), "_q_mac_wantsLayer",
"QT_MAC_WANTS_LAYER");
diff --git a/src/plugins/platforms/eglfs/api/qeglfscontext_p.h b/src/plugins/platforms/eglfs/api/qeglfscontext_p.h
index 96f7f01381e..af8725b6b38 100644
--- a/src/plugins/platforms/eglfs/api/qeglfscontext_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfscontext_p.h
@@ -52,6 +52,7 @@
//
#include "qeglfsglobal_p.h"
+#include "qeglfscursor_p.h"
#include
#include
@@ -68,6 +69,8 @@ public:
void runGLChecks() override;
void swapBuffers(QPlatformSurface *surface) override;
+ QEglFSCursorData cursorData;
+
private:
EGLNativeWindowType m_tempWindow;
};
diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
index f46206cab51..22319fcc66c 100644
--- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp
@@ -40,10 +40,10 @@
#include "qeglfscursor_p.h"
#include "qeglfsintegration_p.h"
#include "qeglfsscreen_p.h"
+#include "qeglfscontext_p.h"
#include
#include
-#include
#include