Merge remote-tracking branch 'origin/5.10.0' into 5.10

Change-Id: I6dcf85067ec226136c207ea69ca9d66736c84db5
This commit is contained in:
Liang Qi 2017-12-08 13:56:16 +01:00
commit 812bb236dd
59 changed files with 897 additions and 203 deletions

View File

@ -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) {

576
dist/changes-5.10.0 vendored Normal file
View File

@ -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 <QByteArray> and
<QString>, 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
"<APPDIR>/data/<APPNAME>" 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.

View File

@ -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" \

View File

@ -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

View File

@ -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(' '));
}

View File

@ -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)

View File

@ -36,6 +36,8 @@ exampledirs += ../../../examples/qtconcurrent \
../ \
snippets
manifestmeta.highlighted.names = "QtConcurrent/QtConcurrent Progress Dialog Example"
excludedirs += ../../../examples/widgets/doc
imagedirs += images

View File

@ -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",

View File

@ -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"

View File

@ -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

View File

@ -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_renameat2 -1

View File

@ -160,8 +160,8 @@ Q_STATIC_ASSERT_X(std::numeric_limits<float>::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<qssize_t, qptrdiff>::value));
Q_STATIC_ASSERT(sizeof(size_t) == sizeof(qsizetype)); // implied by the definition
Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
/*!
\class QFlag
@ -824,7 +824,7 @@ Q_STATIC_ASSERT((std::is_same<qssize_t, qptrdiff>::value));
*/
/*!
\typedef qssize_t
\typedef qsizetype
\relates <QtGlobal>
\since 5.10
@ -833,7 +833,7 @@ Q_STATIC_ASSERT((std::is_same<qssize_t, qptrdiff>::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
*/

View File

@ -439,7 +439,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 <int> struct QIntegerForSize;
@ -456,7 +456,7 @@ typedef QIntegerForSize<Q_PROCESSOR_WORDSIZE>::Unsigned qregisteruint;
typedef QIntegerForSizeof<void*>::Unsigned quintptr;
typedef QIntegerForSizeof<void*>::Signed qptrdiff;
typedef qptrdiff qintptr;
using qssize_t = QIntegerForSizeof<std::size_t>::Signed;
using qsizetype = QIntegerForSizeof<std::size_t>::Signed;
/* moc compats (signals/slots) */
#ifndef QT_MOC_COMPAT

View File

@ -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<unsigned *>(buffer);
unsigned *end = ptr + count;
@ -122,7 +122,7 @@ out:
return ptr - reinterpret_cast<unsigned *>(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<uchar *>(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<qssize_t>(n, 0); // ignore any errors
return qMax<qsizetype>(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);
@ -682,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
@ -874,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

View File

@ -55,10 +55,10 @@ public:
QRandomGenerator(quint32 seedValue = 1)
: QRandomGenerator(&seedValue, 1)
{}
template <qssize_t N> QRandomGenerator(const quint32 (&seedBuffer)[N])
template <qsizetype N> 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 +131,7 @@ public:
}
template <typename UInt, IfValidUInt<UInt> = true>
void fillRange(UInt *buffer, qssize_t count)
void fillRange(UInt *buffer, qsizetype count)
{
_fillRange(buffer, buffer + count);
}
@ -177,7 +177,8 @@ private:
friend class QRandomGenerator64;
struct SystemGenerator;
struct SystemAndGlobalGenerators;
typedef std::mt19937 RandomEngine;
using RandomEngine = std::mersenne_twister_engine<quint32,
32,624,397,31,0x9908b0df,11,0xffffffff,7,0x9d2c5680,15,0xefc60000,18,1812433253>;
union Storage {
uint dummy;
@ -214,10 +215,10 @@ public:
QRandomGenerator64(quint32 seedValue = 1)
: QRandomGenerator(seedValue)
{}
template <qssize_t N> QRandomGenerator64(const quint32 (&seedBuffer)[N])
template <qsizetype N> 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

View File

@ -503,7 +503,8 @@ bool
QFile::remove()
{
Q_D(QFile);
if (d->fileName.isEmpty()) {
if (d->fileName.isEmpty() &&
!static_cast<QFSFileEngine *>(d->engine())->isUnnamedFile()) {
qWarning("QFile::remove: Empty or null file name");
return false;
}

View File

@ -102,6 +102,10 @@ 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 {
@ -212,6 +216,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 <typename T>
static inline typename QtPrivate::QEnableIf<(&T::st_atimensec, &T::st_mtimensec, true)>::Type get(const T *p, struct timeval *access, struct timeval *modification)
{
@ -221,6 +227,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)
@ -278,6 +285,7 @@ mtime(const T &statBuffer, int)
{ return timespecToMSecs(statBuffer.st_mtimespec); }
#endif
#ifndef st_mtimensec
// Xtimensec
template <typename T>
Q_DECL_UNUSED static typename std::enable_if<(&T::st_atimensec, true), qint64>::type
@ -298,8 +306,9 @@ template <typename T>
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)
@ -395,7 +404,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; }
@ -928,7 +936,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)
@ -978,7 +986,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
}
} else {
// it doesn't exist
entryExists = false;
entryErrno = errno;
data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute;
}
@ -986,8 +994,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) {
@ -1001,7 +1009,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
}
if (statResult != 0) {
entryExists = false;
entryErrno = errno;
data.birthTime_ = 0;
data.metadataChangeTime_ = 0;
data.modificationTime_ = 0;
@ -1020,13 +1028,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;
}
};
@ -1035,9 +1043,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;
}
@ -1047,13 +1056,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;
@ -1065,19 +1074,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

View File

@ -64,6 +64,10 @@
# endif
#endif
#ifdef Q_OS_UNIX
struct statx;
#endif
QT_BEGIN_NAMESPACE
class QFileSystemEngine;

View File

@ -112,6 +112,9 @@ public:
qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE;
bool cloneTo(QAbstractFileEngine *target) override;
virtual bool isUnnamedFile() const
{ return false; }
bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) Q_DECL_OVERRIDE;
bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;

View File

@ -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('/');
};

View File

@ -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)

View File

@ -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 <fcntl.h>
# 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;

View File

@ -2657,8 +2657,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.
@ -2666,13 +2666,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)

View File

@ -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 = Q_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);

View File

@ -81,7 +81,7 @@ public:
int daysInYear() const;
int weekNumber(int *yearNum = Q_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")

View File

@ -1169,7 +1169,8 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
#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)
@ -1615,6 +1616,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);

View File

@ -576,7 +576,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);
@ -3443,7 +3443,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') {

View File

@ -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

View File

@ -55,7 +55,7 @@ template <typename T> 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;

View File

@ -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.

View File

@ -62,7 +62,7 @@ class QStringIterator
QString::const_iterator i, pos, e;
Q_STATIC_ASSERT((std::is_same<QString::const_iterator, const QChar *>::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())

View File

@ -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.

View File

@ -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,17 +139,17 @@ private:
using if_compatible_qstring_like = typename std::enable_if<std::is_same<T, QString>::value || std::is_same<T, QStringRef>::value, bool>::type;
template <typename Char, size_t N>
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 <typename Char>
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;
@ -157,7 +157,7 @@ private:
#endif
return QtPrivate::qustrlen(reinterpret_cast<const ushort *>(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<const ushort *>(str));
}
@ -175,7 +175,7 @@ public:
: QStringView() {}
template <typename Char, if_compatible_char<Char> = 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)) {}
@ -205,20 +205,20 @@ public:
#else
template <typename String, if_compatible_qstring_like<String> = 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 <typename StdBasicString, if_compatible_string<StdBasicString> = 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<const_pointer>(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]); }
//
@ -230,22 +230,22 @@ public:
Q_REQUIRED_RESULT QByteArray toLocal8Bit() const { return QtPrivate::convertToLocal8Bit(*this); }
Q_REQUIRED_RESULT inline QVector<uint> 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); }
@ -292,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);

View File

@ -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"

View File

@ -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"

View File

@ -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<qssize_t>(image->sizeInBytes());
qsizetype nbytes = static_cast<qsizetype>(image->sizeInBytes());
for (i=0; i<nbytes/4; i++) {
*p = ~*p;
p++;

View File

@ -130,7 +130,7 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format)
if (std::numeric_limits<int>::max()/depth < width
|| bytes_per_line <= 0
|| height <= 0
|| std::numeric_limits<qssize_t>::max()/uint(bytes_per_line) < height
|| std::numeric_limits<qsizetype>::max()/uint(bytes_per_line) < height
|| std::numeric_limits<int>::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;
}

View File

@ -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;

View File

@ -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]];
}
}

View File

@ -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<QRgb> colortable;
uchar *data;
QImage::Format format;
qssize_t bytes_per_line;
qsizetype bytes_per_line;
int ser_no; // serial number
int detach_no;

View File

@ -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();

View File

@ -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())

View File

@ -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) {
@ -4959,7 +4959,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

View File

@ -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) {

View File

@ -293,7 +293,7 @@ struct QTextureData
int y1;
int x2;
int y2;
qssize_t bytesPerLine;
qsizetype bytesPerLine;
QImage::Format format;
const QVector<QRgb> *colorTable;
bool hasAlpha;
@ -847,7 +847,7 @@ inline void qt_memfill(T *dest, T value, int count)
template <class T> 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<char*>(dest + x) + y * stride;
if (uint(stride) == (width * sizeof(T))) {

View File

@ -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;

View File

@ -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

View File

@ -43,14 +43,12 @@
QT_BEGIN_NAMESPACE
namespace {
void registerEnums()
{
qRegisterMetaType<QShaderLanguage::StorageQualifier>();
qRegisterMetaType<QShaderLanguage::VariableType>();
}
// 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<QShaderLanguage::StorageQualifier>();
qRegisterMetaType<QShaderLanguage::VariableType>();
}
Q_COREAPP_STARTUP_FUNCTION(registerEnums)
QT_END_NAMESPACE

View File

@ -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"

View File

@ -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);

View File

@ -152,9 +152,32 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo
QMacAutoReleasePool pool; // For the SG Canvas render thread
m_shareContext = share ? static_cast<QCocoaGLContext *>(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<QCocoaGLContext *>(share)->nsOpenGLContext() : nil;
m_context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:m_shareContext];
// retry without sharing on context creation failure.

View File

@ -155,6 +155,19 @@ public:
*/
/*!
Constructs an empty field called \a fieldName of variant type \a type.
\sa setRequiredStatus(), setLength(), setPrecision(), setDefaultValue(),
setGenerated(), setReadOnly()
*/
QSqlField::QSqlField(const QString &fieldName, QVariant::Type type)
{
d = new QSqlFieldPrivate(fieldName, type, QString());
val = QVariant(type);
}
/*!
\overload
Constructs an empty field called \a fieldName of variant type \a
type in \a table.

View File

@ -55,8 +55,9 @@ public:
enum RequiredStatus { Unknown = -1, Optional = 0, Required = 1 };
explicit QSqlField(const QString& fieldName = QString(),
QVariant::Type type = QVariant::Invalid,
const QString &tableName = QString());
QVariant::Type type = QVariant::Invalid);
QSqlField(const QString &fieldName, QVariant::Type type,
const QString &tableName);
QSqlField(const QSqlField& other);
QSqlField& operator=(const QSqlField& other);

View File

@ -48,4 +48,6 @@ imagedirs += images \
navigation.landingpage = "Qt Widgets"
navigation.cppclassespage = "Qt Widgets C++ Classes"
manifestmeta.highlighted.names = "QtWidgets/Calendar Widget Example" \
"QtWidgets/Simple Tree Model Example"
"QtWidgets/Editable Tree Model Example" \
"QtWidgets/Address Book Example" \
"QtWidgets/Application Example"

View File

@ -70,6 +70,7 @@ private slots:
void io();
void openCloseOpenClose();
void removeAndReOpen();
void removeUnnamed();
void size();
void resize();
void openOnRootDrives();
@ -442,11 +443,13 @@ void tst_QTemporaryFile::removeAndReOpen()
{
QTemporaryFile file;
file.open();
fileName = file.fileName();
fileName = file.fileName(); // materializes any unnamed file
QVERIFY(QFile::exists(fileName));
file.remove();
QVERIFY(file.remove());
QVERIFY(file.fileName().isEmpty());
QVERIFY(!QFile::exists(fileName));
QVERIFY(!file.remove());
QVERIFY(file.open());
QCOMPARE(QFileInfo(file.fileName()).path(), QFileInfo(fileName).path());
@ -456,6 +459,19 @@ void tst_QTemporaryFile::removeAndReOpen()
QVERIFY(!QFile::exists(fileName));
}
void tst_QTemporaryFile::removeUnnamed()
{
QTemporaryFile file;
file.open();
// we did not call fileName(), so the file name may not have a name
QVERIFY(file.remove());
QVERIFY(file.fileName().isEmpty());
// if it was unnamed, this will succeed again, so we can't check the result
file.remove();
}
void tst_QTemporaryFile::size()
{
QTemporaryFile file;

View File

@ -100,7 +100,7 @@ public:
TestModel(QAbstractItemModel *sourceModel)
: QSortFilterProxyModel()
{
setRecursiveFiltering(true);
setRecursiveFilteringEnabled(true);
setSourceModel(sourceModel);
}
@ -213,6 +213,7 @@ private Q_SLOTS:
QCOMPARE(treeAsString(model), sourceStr);
TestModel proxy(&model);
QVERIFY(proxy.isRecursiveFilteringEnabled());
QCOMPARE(treeAsString(proxy), proxyStr);
}

View File

@ -2396,8 +2396,8 @@ void tst_QDateTime::fromStringStringFormat_data()
QTest::newRow("data14") << QString("32.01.2004") << QString("dd.MM.yyyy") << invalidDateTime();
QTest::newRow("data15") << QString("Thu January 2004") << QString("ddd MMMM yyyy") << QDateTime(QDate(2004, 1, 1), QTime());
QTest::newRow("data16") << QString("2005-06-28T07:57:30.001Z")
<< QString("yyyy-MM-ddThh:mm:ss.zZ")
<< QDateTime(QDate(2005, 06, 28), QTime(07, 57, 30, 1));
<< QString("yyyy-MM-ddThh:mm:ss.zt")
<< QDateTime(QDate(2005, 06, 28), QTime(07, 57, 30, 1), Qt::UTC);
}
void tst_QDateTime::fromStringStringFormat()

View File

@ -461,9 +461,9 @@ void tst_QStringView::fromLiteral(const Char *arg) const
const Char *null = nullptr;
const Char empty[] = { 0 };
QCOMPARE(QStringView(null).size(), qssize_t(0));
QCOMPARE(QStringView(null).size(), qsizetype(0));
QCOMPARE(QStringView(null).data(), nullptr);
QCOMPARE(QStringView(empty).size(), qssize_t(0));
QCOMPARE(QStringView(empty).size(), qsizetype(0));
QCOMPARE(static_cast<const void*>(QStringView(empty).data()),
static_cast<const void*>(empty));

View File

@ -3441,10 +3441,10 @@ void tst_QImage::hugeQImage()
QVERIFY(!image.isNull());
QCOMPARE(image.height(), 25000);
QCOMPARE(image.width(), 25000);
QCOMPARE(image.sizeInBytes(), qssize_t(25000)*25000*4);
QCOMPARE(image.sizeInBytes(), qsizetype(25000)*25000*4);
QCOMPARE(image.bytesPerLine(), 25000 * 4);
QCOMPARE(image.constScanLine(24990), image.constBits() + qssize_t(25000)*24990*4);
QCOMPARE(image.constScanLine(24990), image.constBits() + qsizetype(25000)*24990*4);
image.setPixel(20000, 24990, 0xffaabbcc);
QCOMPARE(image.pixel(20000, 24990), 0xffaabbcc);