Merge remote-tracking branch 'origin/5.9' into dev

Conflicts:
	src/corelib/io/qwindowspipewriter.cpp
	src/widgets/styles/qcommonstyle.cpp

Change-Id: I0d33efdc4dc256e234abc490a18ccda72cd1d9e6
This commit is contained in:
Simon Hausmann 2017-07-19 09:47:29 +02:00
commit 407302fb1b
67 changed files with 418 additions and 296 deletions

View File

@ -1,4 +1,4 @@
requires(if(wince|embedded|x11):qtHaveModule(gui))
requires(if(embedded|x11):qtHaveModule(gui))
TEMPLATE = subdirs
SUBDIRS = styleexample raycasting flickable digiflip

View File

@ -16,9 +16,3 @@ EXAMPLE_FILES = animation.gif
# install
target.path = $$[QT_INSTALL_EXAMPLES]/network/multistreamserver
INSTALLS += target
wince*: {
addFiles.files += *.gif
addFiles.path = .
DEPLOYMENT += addFiles
}

View File

@ -8,14 +8,12 @@ qtHaveModule(widgets) {
SUBDIRS += contextinfo \
threadedqopenglwidget \
2dpainting \
hellogl2
!wince: SUBDIRS += \
qopenglwidget \
cube \
textures \
hellogles3 \
computegles31
hellogl2 \
qopenglwidget \
cube \
textures \
hellogles3 \
computegles31
}
EXAMPLE_FILES += \

View File

@ -3,12 +3,10 @@ requires(qtHaveModule(concurrent))
TEMPLATE = subdirs
SUBDIRS = imagescaling \
map \
progressdialog \
runfunction \
wordcount
!wince* {
SUBDIRS += progressdialog
}
!qtHaveModule(gui) {
SUBDIRS -= \

View File

@ -10,11 +10,3 @@ QT += sql widgets widgets
target.path = $$[QT_INSTALL_EXAMPLES]/sql/books
INSTALLS += target
wince {
CONFIG(debug, debug|release):sqlPlugins.files = $$QT_BUILD_TREE/plugins/sqldrivers/*d4.dll
CONFIG(release, debug|release):sqlPlugins.files = $$QT_BUILD_TREE/plugins/sqldrivers/*[^d]4.dll
sqlPlugins.path = sqldrivers
INSTALLS += sqlPlugins
}

View File

@ -4,16 +4,14 @@ TEMPLATE = subdirs
SUBDIRS = books \
drilldown \
cachedtable \
relationaltablemodel \
sqlwidgetmapper
!wince:qtHaveModule(xml): SUBDIRS += masterdetail
!wince: SUBDIRS += \
cachedtable \
querymodel \
relationaltablemodel \
sqlwidgetmapper \
tablemodel
qtHaveModule(xml): SUBDIRS += masterdetail
!cross_compile:{
contains(QT_BUILD_PARTS, tools):{
SUBDIRS += sqlbrowser

View File

@ -10,5 +10,3 @@ RESOURCES += configdialog.qrc
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/configdialog
INSTALLS += target
wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib

View File

@ -3,17 +3,13 @@ QT_FOR_CONFIG += widgets
TEMPLATE = subdirs
SUBDIRS = classwizard \
configdialog \
extension \
findfiles \
licensewizard \
standarddialogs \
tabdialog \
trivialwizard
!wince {
SUBDIRS += \
licensewizard \
extension \
findfiles
}
!qtHaveModule(printsupport): SUBDIRS -= licensewizard
!qtConfig(wizard) {
SUBDIRS -= trivialwizard licensewizard classwizard

View File

@ -7,5 +7,3 @@ SOURCES = dialog.cpp \
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/standarddialogs
INSTALLS += target
wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib

View File

@ -7,5 +7,3 @@ SOURCES = main.cpp \
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/tabdialog
INSTALLS += target
wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib

View File

@ -10,10 +10,3 @@ EXAMPLE_FILES = frank.xbel jennifer.xbel
# install
target.path = $$[QT_INSTALL_EXAMPLES]/xml/dombookmarks
INSTALLS += target
wince {
addFiles.files = frank.xbel jennifer.xbel
addFiles.path = "\\My Documents"
INSTALLS += addFiles
}

View File

@ -6,12 +6,6 @@ RESOURCES = resources.qrc
win32: CONFIG += console
wince {
htmlfiles.files = *.html
htmlfiles.path = .
INSTALLS += htmlfiles
}
# install
target.path = $$[QT_INSTALL_EXAMPLES]/xml/htmlinfo
INSTALLS += target

View File

@ -12,9 +12,3 @@ EXAMPLE_FILES = frank.xbel jennifer.xbel
# install
target.path = $$[QT_INSTALL_EXAMPLES]/xml/saxbookmarks
INSTALLS += target
wince {
addFiles.files = frank.xbel jennifer.xbel
addFiles.path = "\\My Documents"
INSTALLS += addFiles
}

View File

@ -1,6 +1,11 @@
!macx-xcode {
QMAKE_CC = @echo compiling $< && $$QMAKE_CC
QMAKE_CXX = @echo compiling $< && $$QMAKE_CXX
msvc {
QMAKE_CC = @$$QMAKE_CC
QMAKE_CXX = @$$QMAKE_CXX
} else {
QMAKE_CC = @echo compiling $< && $$QMAKE_CC
QMAKE_CXX = @echo compiling $< && $$QMAKE_CXX
}
!contains(QMAKE_LINK, "@:"):QMAKE_LINK = @echo linking $@ && $$QMAKE_LINK
QMAKE_LINK_SHLIB = @echo linking $@ && $$QMAKE_LINK_SHLIB
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** 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 documentation of the Qt Toolkit.
@ -1809,6 +1809,14 @@
\note Most of the time, the default \c{Info.plist} is good enough.
\section1 QMAKE_IOS_DEPLOYMENT_TARGET
\note This variable is used on the iOS platform only.
Specifies the hard minimum version of iOS that the application supports.
For more information, see \l {Expressing Supported iOS Versions}.
\section1 QMAKE_LFLAGS
Specifies a general set of flags that are passed to
@ -2101,12 +2109,11 @@
\section1 QMAKE_MACOSX_DEPLOYMENT_TARGET
This variable only takes effect when building on \macos. On that
platform, the variable will be forwarded to the MACOSX_DEPLOYMENT_TARGET
environment variable, which is interpreted by the compiler or linker.
For more information, see the
\l{Qt for macOS - Deployment#macOS Version Dependencies}{Deploying
an Application on \macos} document.
\note This variable is used on the \macos platform only.
Specifies the hard minimum version of \macos that the application supports.
For more information, see \l{macOS Version Dependencies}.
\section1 QMAKE_MAKEFILE
@ -2251,6 +2258,22 @@
This is only utilized if the \l{VERSION} or \l{RC_ICONS} variable is set
and the \l{RC_FILE} and \l{RES_FILE} variables are not set.
\section1 QMAKE_TVOS_DEPLOYMENT_TARGET
\note This variable is used on the tvOS platform only.
Specifies the hard minimum version of tvOS that the application supports.
For more information, see \l {Expressing Supported iOS Versions}.
\section1 QMAKE_WATCHOS_DEPLOYMENT_TARGET
\note This variable is used on the watchOS platform only.
Specifies the hard minimum version of watchOS that the application supports.
For more information, see \l {Expressing Supported iOS Versions}.
\section1 QT
Specifies the \l{All Modules}{Qt modules} that are used by your project. For

View File

@ -62,7 +62,7 @@ QUrl url = QUrl::fromEncoded("http://qt-project.org/List%20of%20holidays.xml");
//! [2]
bool checkUrl(const QUrl &url) {
if (!url.isValid()) {
qDebug(QString("Invalid URL: %1").arg(url.toString()));
qDebug("Invalid URL: %s", qUtf8Printable(url.toString()));
return false;
}

View File

@ -3148,98 +3148,6 @@ Q_CORE_EXPORT Q_DECL_CONST_FUNCTION unsigned int qt_int_sqrt(unsigned int n)
void *qMemCopy(void *dest, const void *src, size_t n) { return memcpy(dest, src, n); }
void *qMemSet(void *dest, int c, size_t n) { return memset(dest, c, n); }
#if !defined(Q_OS_WIN) && !defined(QT_NO_THREAD) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) && \
defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L
namespace {
// There are two incompatible versions of strerror_r:
// a) the XSI/POSIX.1 version, which returns an int,
// indicating success or not
// b) the GNU version, which returns a char*, which may or may not
// be the beginning of the buffer we used
// The GNU libc manpage for strerror_r says you should use the XSI
// version in portable code. However, it's impossible to do that if
// _GNU_SOURCE is defined so we use C++ overloading to decide what to do
// depending on the return type
static inline Q_DECL_UNUSED QString fromstrerror_helper(int, const QByteArray &buf)
{
return QString::fromLocal8Bit(buf.constData());
}
static inline Q_DECL_UNUSED QString fromstrerror_helper(const char *str, const QByteArray &)
{
return QString::fromLocal8Bit(str);
}
}
#endif
QString qt_error_string(int errorCode)
{
const char *s = 0;
QString ret;
if (errorCode == -1) {
#if defined(Q_OS_WIN)
errorCode = GetLastError();
#else
errorCode = errno;
#endif
}
switch (errorCode) {
case 0:
break;
case EACCES:
s = QT_TRANSLATE_NOOP("QIODevice", "Permission denied");
break;
case EMFILE:
s = QT_TRANSLATE_NOOP("QIODevice", "Too many open files");
break;
case ENOENT:
s = QT_TRANSLATE_NOOP("QIODevice", "No such file or directory");
break;
case ENOSPC:
s = QT_TRANSLATE_NOOP("QIODevice", "No space left on device");
break;
default: {
#if defined(Q_OS_WIN)
// Retrieve the system error message for the last-error code.
# ifndef Q_OS_WINRT
wchar_t *string = 0;
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER,
NULL,
errorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR)&string,
0,
NULL);
ret = QString::fromWCharArray(string);
LocalFree((HLOCAL)string);
# else // !Q_OS_WINRT
__declspec(thread) static wchar_t errorString[4096];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
errorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
errorString,
ARRAYSIZE(errorString),
NULL);
ret = QString::fromWCharArray(errorString);
# endif // Q_OS_WINRT
if (ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND)
ret = QString::fromLatin1("The specified module could not be found.");
#elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX)
QByteArray buf(1024, '\0');
ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf);
#else
ret = QString::fromLocal8Bit(strerror(errorCode));
#endif
break; }
}
if (s)
// ######## this breaks moc build currently
// ret = QCoreApplication::translate("QIODevice", s);
ret = QString::fromLatin1(s);
return ret.trimmed();
}
// In the C runtime on all platforms access to the environment is not thread-safe. We
// add thread-safety for the Qt wrappers.
static QBasicMutex environmentMutex;

View File

@ -267,6 +267,9 @@
# if !defined(__MAC_10_12)
# define __MAC_10_12 101200
# endif
# if !defined(__MAC_10_13)
# define __MAC_10_13 101300
# endif
# if !defined(MAC_OS_X_VERSION_10_7)
# define MAC_OS_X_VERSION_10_7 1070
# endif
@ -285,6 +288,9 @@
# if !defined(MAC_OS_X_VERSION_10_12)
# define MAC_OS_X_VERSION_10_12 101200
# endif
# if !defined(MAC_OS_X_VERSION_10_13)
# define MAC_OS_X_VERSION_10_13 101300
# endif
#
# if !defined(__IPHONE_4_3)
# define __IPHONE_4_3 40300
@ -337,6 +343,18 @@
# if !defined(__IPHONE_10_0)
# define __IPHONE_10_0 100000
# endif
# if !defined(__IPHONE_10_1)
# define __IPHONE_10_1 100100
# endif
# if !defined(__IPHONE_10_2)
# define __IPHONE_10_2 100200
# endif
# if !defined(__IPHONE_10_3)
# define __IPHONE_10_3 100300
# endif
# if !defined(__IPHONE_11_0)
# define __IPHONE_11_0 110000
# endif
#endif
#ifdef __LSB_VERSION__

View File

@ -677,6 +677,17 @@ bool QAbstractFileEngine::setPermissions(uint perms)
return false;
}
/*!
\since 5.9
Return an identifier that (hopefully) uniquely identifies this file in the
system. Returns an invalid QByteArray() if that cannot be calculated.
*/
QByteArray QAbstractFileEngine::id() const
{
return QByteArray();
}
/*!
Return the file engine's current file name in the format
specified by \a file.

View File

@ -141,6 +141,7 @@ public:
virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const;
virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const;
virtual bool setPermissions(uint perms);
virtual QByteArray id() const;
virtual QString fileName(FileName file=DefaultName) const;
virtual uint ownerId(FileOwner) const;
virtual QString owner(FileOwner) const;

View File

@ -571,7 +571,9 @@ QFile::rename(const QString &newName)
// Note: this does not take file engines into account.
QByteArray targetId = QFileSystemEngine::id(QFileSystemEntry(newName));
if (!targetId.isNull()) {
QByteArray fileId = QFileSystemEngine::id(QFileSystemEntry(d->fileName));
QByteArray fileId = d->fileEngine ?
d->fileEngine->id() :
QFileSystemEngine::id(QFileSystemEntry(d->fileName));
if (fileId != targetId || d->fileName.compare(newName, Qt::CaseInsensitive)) {
// ### Race condition. If a file is moved in after this, it /will/ be
// overwritten. On Unix, the proper solution is to use hardlinks:

View File

@ -92,6 +92,7 @@ public:
QFileSystemMetaData::MetaDataFlags what);
#if defined(Q_OS_UNIX)
static bool fillMetaData(int fd, QFileSystemMetaData &data); // what = PosixStatFlags
static QByteArray id(int fd);
static bool setPermissions(int fd, QFile::Permissions permissions, QSystemError &error,
QFileSystemMetaData *data = nullptr);
#endif
@ -104,6 +105,7 @@ public:
QFileSystemMetaData::MetaDataFlags what);
static bool fillPermissions(const QFileSystemEntry &entry, QFileSystemMetaData &data,
QFileSystemMetaData::MetaDataFlags what);
static QByteArray id(HANDLE fHandle);
static QString owner(const QFileSystemEntry &entry, QAbstractFileEngine::FileOwner own);
static QString nativeAbsoluteFilePath(const QString &path);
#endif

View File

@ -327,6 +327,20 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
return result;
}
//static
QByteArray QFileSystemEngine::id(int id)
{
QT_STATBUF statResult;
if (QT_FSTAT(id, &statResult)) {
qErrnoWarning("fstat() failed for fd %d", id);
return QByteArray();
}
QByteArray result = QByteArray::number(quint64(statResult.st_dev), 16);
result += ':';
result += QByteArray::number(quint64(statResult.st_ino));
return result;
}
//static
QString QFileSystemEngine::resolveUserName(uint userId)
{

View File

@ -561,19 +561,21 @@ typedef struct _FILE_ID_INFO {
// File ID for Windows up to version 7.
static inline QByteArray fileId(HANDLE handle)
{
QByteArray result;
#ifndef Q_OS_WINRT
BY_HANDLE_FILE_INFORMATION info;
if (GetFileInformationByHandle(handle, &info)) {
result = QByteArray::number(uint(info.nFileIndexLow), 16);
result += ':';
result += QByteArray::number(uint(info.nFileIndexHigh), 16);
char buffer[sizeof "01234567:0123456701234567"];
qsnprintf(buffer, sizeof(buffer), "%lx:%08lx%08lx",
info.dwVolumeSerialNumber,
info.nFileIndexHigh,
info.nFileIndexLow);
return buffer;
}
#else // !Q_OS_WINRT
Q_UNUSED(handle);
Q_UNIMPLEMENTED();
#endif // Q_OS_WINRT
return result;
return QByteArray();
}
// File ID for Windows starting from version 8.
@ -609,13 +611,19 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry)
FILE_SHARE_READ, OPEN_EXISTING, NULL);
#endif // Q_OS_WINRT
if (handle != INVALID_HANDLE_VALUE) {
result = QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8 ?
fileIdWin8(handle) : fileId(handle);
result = id(handle);
CloseHandle(handle);
}
return result;
}
//static
QByteArray QFileSystemEngine::id(HANDLE fHandle)
{
return QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows8 ?
fileIdWin8(HANDLE(fHandle)) : fileId(HANDLE(fHandle));
}
//static
QString QFileSystemEngine::owner(const QFileSystemEntry &entry, QAbstractFileEngine::FileOwner own)
{

View File

@ -277,7 +277,7 @@ bool QFSFileEnginePrivate::openFh(QIODevice::OpenMode openMode, FILE *fh)
if (ret != 0) {
q->setError(errno == EMFILE ? QFile::ResourceError : QFile::OpenError,
qt_error_string(int(errno)));
QSystemError::stdString());
this->openMode = QIODevice::NotOpen;
this->fh = 0;
@ -341,7 +341,7 @@ bool QFSFileEnginePrivate::openFd(QIODevice::OpenMode openMode, int fd)
if (ret == -1) {
q->setError(errno == EMFILE ? QFile::ResourceError : QFile::OpenError,
qt_error_string(int(errno)));
QSystemError::stdString());
this->openMode = QIODevice::NotOpen;
this->fd = -1;
@ -400,7 +400,7 @@ bool QFSFileEnginePrivate::closeFdFh()
if (!flushed || !closed) {
if (flushed) {
// If not flushed, we want the flush error to fall through.
q->setError(QFile::UnspecifiedError, qt_error_string(errno));
q->setError(QFile::UnspecifiedError, QSystemError::stdString());
}
return false;
}
@ -452,7 +452,7 @@ bool QFSFileEnginePrivate::flushFh()
if (ret != 0) {
q->setError(errno == ENOSPC ? QFile::ResourceError : QFile::WriteError,
qt_error_string(errno));
QSystemError::stdString());
return false;
}
return true;
@ -567,14 +567,14 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos)
} while (ret != 0 && errno == EINTR);
if (ret != 0) {
q->setError(QFile::ReadError, qt_error_string(int(errno)));
q->setError(QFile::ReadError, QSystemError::stdString());
return false;
}
} else {
// Unbuffered stdio mode.
if (QT_LSEEK(fd, QT_OFF_T(pos), SEEK_SET) == -1) {
qWarning("QFile::at: Cannot set file position %lld", pos);
q->setError(QFile::PositionError, qt_error_string(errno));
q->setError(QFile::PositionError, QSystemError::stdString());
return false;
}
}
@ -616,7 +616,7 @@ qint64 QFSFileEnginePrivate::readFdFh(char *data, qint64 len)
Q_Q(QFSFileEngine);
if (len < 0 || len != qint64(size_t(len))) {
q->setError(QFile::ReadError, qt_error_string(EINVAL));
q->setError(QFile::ReadError, QSystemError::stdString(EINVAL));
return -1;
}
@ -662,7 +662,7 @@ qint64 QFSFileEnginePrivate::readFdFh(char *data, qint64 len)
if (!eof && readBytes == 0) {
readBytes = -1;
q->setError(QFile::ReadError, qt_error_string(errno));
q->setError(QFile::ReadError, QSystemError::stdString());
}
return readBytes;
@ -708,7 +708,7 @@ qint64 QFSFileEnginePrivate::readLineFdFh(char *data, qint64 maxlen)
// solves this.
if (!fgets(data, int(maxlen + 1), fh)) {
if (!feof(fh))
q->setError(QFile::ReadError, qt_error_string(int(errno)));
q->setError(QFile::ReadError, QSystemError::stdString());
return -1; // error
}
@ -748,7 +748,7 @@ qint64 QFSFileEnginePrivate::writeFdFh(const char *data, qint64 len)
Q_Q(QFSFileEngine);
if (len < 0 || len != qint64(size_t(len))) {
q->setError(QFile::WriteError, qt_error_string(EINVAL));
q->setError(QFile::WriteError, QSystemError::stdString(EINVAL));
return -1;
}
@ -785,7 +785,7 @@ qint64 QFSFileEnginePrivate::writeFdFh(const char *data, qint64 len)
if (len && writtenBytes == 0) {
writtenBytes = -1;
q->setError(errno == ENOSPC ? QFile::ResourceError : QFile::WriteError, qt_error_string(errno));
q->setError(errno == ENOSPC ? QFile::ResourceError : QFile::WriteError, QSystemError::stdString());
} else {
// reset the cached size, if any
metaData.clearFlags(QFileSystemMetaData::SizeAttribute);

View File

@ -93,6 +93,7 @@ public:
QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const Q_DECL_OVERRIDE;
FileFlags fileFlags(FileFlags type) const Q_DECL_OVERRIDE;
bool setPermissions(uint perms) Q_DECL_OVERRIDE;
QByteArray id() const override;
QString fileName(FileName file) const Q_DECL_OVERRIDE;
uint ownerId(FileOwner) const Q_DECL_OVERRIDE;
QString owner(FileOwner) const Q_DECL_OVERRIDE;

View File

@ -542,6 +542,14 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(FileFlags type) const
return ret;
}
QByteArray QFSFileEngine::id() const
{
Q_D(const QFSFileEngine);
if (d->fd != -1)
return QFileSystemEngine::id(d->fd);
return QFileSystemEngine::id(d->fileEntry);
}
QString QFSFileEngine::fileName(FileName file) const
{
Q_D(const QFSFileEngine);

View File

@ -285,7 +285,7 @@ qint64 QFSFileEnginePrivate::nativeSize() const
filled = doStat(QFileSystemMetaData::SizeAttribute);
if (!filled) {
thatQ->setError(QFile::UnspecifiedError, qt_error_string(errno));
thatQ->setError(QFile::UnspecifiedError, QSystemError::stdString());
return 0;
}
return metaData.size();
@ -352,7 +352,7 @@ qint64 QFSFileEnginePrivate::nativeRead(char *data, qint64 maxlen)
if (fh || fd != -1) {
// stdio / stdlib mode.
if (fh && nativeIsSequential() && feof(fh)) {
q->setError(QFile::ReadError, qt_error_string(int(errno)));
q->setError(QFile::ReadError, QSystemError::stdString());
return -1;
}
@ -751,6 +751,24 @@ QAbstractFileEngine::FileFlags QFSFileEngine::fileFlags(QAbstractFileEngine::Fil
return ret;
}
QByteArray QFSFileEngine::id() const
{
Q_D(const QFSFileEngine);
HANDLE h = d->fileHandle;
if (h == INVALID_HANDLE_VALUE) {
int localFd = d->fd;
if (d->fh && d->fileEntry.isEmpty())
localFd = QT_FILENO(d->fh);
if (localFd != -1)
h = HANDLE(_get_osfhandle(localFd));
}
if (h != INVALID_HANDLE_VALUE)
return QFileSystemEngine::id(h);
// file is not open, try by path
return QFileSystemEngine::id(d->fileEntry);
}
QString QFSFileEngine::fileName(FileName file) const
{
Q_D(const QFSFileEngine);

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** 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 QtCore module of the Qt Toolkit.
@ -334,12 +334,11 @@ bool QLoggingCategory::isEnabled(QtMsgType msgtype) const
/*!
Changes the message type \a type for the category to \a enable.
\note Changes only affect the current QLoggingCategory object, and won't
change the settings of other objects for the same category name.
Use either \l setFilterRules() or \l installFilter() to change the
configuration globally.
This method is meant to be used only from inside a filter
installed by \l installFilter(). See \l {Configuring Categories} for
an overview on how to configure categories globally.
\note \c QtFatalMsg cannot be changed. It will always return \c true.
\note \c QtFatalMsg cannot be changed. It will always remain \c true.
*/
void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
{
@ -411,8 +410,8 @@ QLoggingCategory *QLoggingCategory::defaultCategory()
filter is free to change the respective category configuration with
\l setEnabled().
The filter might be called concurrently from different threads, and
therefore has to be reentrant.
The filter might be called from different threads, but never concurrently.
The filter shall not call any static functions of QLoggingCategory.
Example:
\snippet qloggingcategory/main.cpp 21

View File

@ -53,6 +53,7 @@
#include <qshareddata.h>
#include <qplatformdefs.h>
#include "private/qabstractfileengine_p.h"
#include "private/qsystemerror_p.h"
#ifdef Q_OS_UNIX
# include "private/qcore_unix_p.h"
@ -1282,7 +1283,7 @@ bool QResourceFileEngine::open(QIODevice::OpenMode flags)
return false;
d->uncompress();
if (!d->resource.isValid()) {
d->errorString = qt_error_string(ENOENT);
d->errorString = QSystemError::stdString(ENOENT);
return false;
}
return true;

View File

@ -57,7 +57,7 @@ void QWindowsPipeReader::Overlapped::clear()
QWindowsPipeReader::QWindowsPipeReader(QObject *parent)
: QObject(parent),
handle(INVALID_HANDLE_VALUE),
overlapped(this),
overlapped(nullptr),
readBufferMaxSize(0),
actualReadBufferSize(0),
stopped(true),
@ -74,6 +74,7 @@ QWindowsPipeReader::QWindowsPipeReader(QObject *parent)
QWindowsPipeReader::~QWindowsPipeReader()
{
stop();
delete overlapped;
}
/*!
@ -95,14 +96,16 @@ void QWindowsPipeReader::stop()
{
stopped = true;
if (readSequenceStarted) {
if (!CancelIoEx(handle, &overlapped)) {
overlapped->pipeReader = nullptr;
if (!CancelIoEx(handle, overlapped)) {
const DWORD dwError = GetLastError();
if (dwError != ERROR_NOT_FOUND) {
qErrnoWarning(dwError, "QWindowsPipeReader: qt_cancelIo on handle %x failed.",
qErrnoWarning(dwError, "QWindowsPipeReader: CancelIoEx on handle %p failed.",
handle);
}
}
waitForNotification(-1);
overlapped = nullptr; // The object will be deleted in the I/O callback.
readSequenceStarted = false;
}
}
@ -223,8 +226,10 @@ void QWindowsPipeReader::startAsyncRead()
stopped = false;
readSequenceStarted = true;
overlapped.clear();
if (!ReadFileEx(handle, ptr, bytesToRead, &overlapped, &readFileCompleted)) {
if (!overlapped)
overlapped = new Overlapped(this);
overlapped->clear();
if (!ReadFileEx(handle, ptr, bytesToRead, overlapped, &readFileCompleted)) {
readSequenceStarted = false;
const DWORD dwError = GetLastError();
@ -251,7 +256,10 @@ void QWindowsPipeReader::readFileCompleted(DWORD errorCode, DWORD numberOfBytesT
OVERLAPPED *overlappedBase)
{
Overlapped *overlapped = static_cast<Overlapped *>(overlappedBase);
overlapped->pipeReader->notified(errorCode, numberOfBytesTransfered);
if (overlapped->pipeReader)
overlapped->pipeReader->notified(errorCode, numberOfBytesTransfered);
else
delete overlapped;
}
/*!

View File

@ -105,7 +105,7 @@ private:
};
HANDLE handle;
Overlapped overlapped;
Overlapped *overlapped;
qint64 readBufferMaxSize;
QRingBuffer readBuffer;
qint64 actualReadBufferSize;

View File

@ -56,7 +56,7 @@ void QWindowsPipeWriter::Overlapped::clear()
QWindowsPipeWriter::QWindowsPipeWriter(HANDLE pipeWriteEnd, QObject *parent)
: QObject(parent),
handle(pipeWriteEnd),
overlapped(this),
overlapped(nullptr),
pendingBytesWrittenValue(0),
stopped(true),
writeSequenceStarted(false),
@ -71,6 +71,7 @@ QWindowsPipeWriter::QWindowsPipeWriter(HANDLE pipeWriteEnd, QObject *parent)
QWindowsPipeWriter::~QWindowsPipeWriter()
{
stop();
delete overlapped;
}
bool QWindowsPipeWriter::waitForWrite(int msecs)
@ -121,7 +122,10 @@ void QWindowsPipeWriter::writeFileCompleted(DWORD errorCode, DWORD numberOfBytes
OVERLAPPED *overlappedBase)
{
Overlapped *overlapped = static_cast<Overlapped *>(overlappedBase);
overlapped->pipeWriter->notified(errorCode, numberOfBytesTransfered);
if (overlapped->pipeWriter)
overlapped->pipeWriter->notified(errorCode, numberOfBytesTransfered);
else
delete overlapped;
}
/*!
@ -183,12 +187,14 @@ bool QWindowsPipeWriter::write(const QByteArray &ba)
if (writeSequenceStarted)
return false;
overlapped.clear();
if (!overlapped)
overlapped = new Overlapped(this);
overlapped->clear();
buffer = ba;
stopped = false;
writeSequenceStarted = true;
if (!WriteFileEx(handle, buffer.constData(), buffer.size(),
&overlapped, &writeFileCompleted)) {
overlapped, &writeFileCompleted)) {
writeSequenceStarted = false;
buffer.clear();
qErrnoWarning("QWindowsPipeWriter::write failed.");
@ -204,14 +210,16 @@ void QWindowsPipeWriter::stop()
bytesWrittenPending = false;
pendingBytesWrittenValue = 0;
if (writeSequenceStarted) {
if (!CancelIoEx(handle, &overlapped)) {
overlapped->pipeWriter = nullptr;
if (!CancelIoEx(handle, overlapped)) {
const DWORD dwError = GetLastError();
if (dwError != ERROR_NOT_FOUND) {
qErrnoWarning(dwError, "QWindowsPipeWriter: qt_cancelIo on handle %x failed.",
qErrnoWarning(dwError, "QWindowsPipeWriter: CancelIoEx on handle %p failed.",
handle);
}
}
waitForNotification(-1);
overlapped = nullptr; // The object will be deleted in the I/O callback.
writeSequenceStarted = false;
}
}

View File

@ -143,7 +143,7 @@ private:
};
HANDLE handle;
Overlapped overlapped;
Overlapped *overlapped;
QByteArray buffer;
qint64 pendingBytesWrittenValue;
bool stopped;

View File

@ -101,6 +101,11 @@ static QString windowsErrorString(int errorCode)
if (ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND)
ret = QString::fromLatin1("The specified module could not be found.");
if (ret.endsWith(QLatin1String("\r\n")))
ret.chop(2);
if (ret.isEmpty())
ret = QString::fromLatin1("Unknown error 0x%1.")
.arg(unsigned(errorCode), 8, 16, QLatin1Char('0'));
return ret;
}
#endif
@ -126,7 +131,7 @@ static QString standardLibraryErrorString(int errorCode)
break;
default: {
#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX)
QByteArray buf(1024, '\0');
QByteArray buf(1024, Qt::Uninitialized);
ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf);
#else
ret = QString::fromLocal8Bit(strerror(errorCode));
@ -141,7 +146,7 @@ static QString standardLibraryErrorString(int errorCode)
return ret.trimmed();
}
QString QSystemError::toString() const
QString QSystemError::string(ErrorScope errorScope, int errorCode)
{
switch(errorScope) {
case NativeError:
@ -161,5 +166,26 @@ QString QSystemError::toString() const
}
}
QT_END_NAMESPACE
QString QSystemError::stdString(int errorCode)
{
return standardLibraryErrorString(errorCode == -1 ? errno : errorCode);
}
#ifdef Q_OS_WIN
QString QSystemError::windowsString(int errorCode)
{
return windowsErrorString(errorCode == -1 ? GetLastError() : errorCode);
}
QString qt_error_string(int code)
{
return windowsErrorString(code == -1 ? GetLastError() : code);
}
#else
QString qt_error_string(int code)
{
return standardLibraryErrorString(code == -1 ? errno : code);
}
#endif
QT_END_NAMESPACE

View File

@ -69,10 +69,16 @@ public:
inline QSystemError(int error, ErrorScope scope);
inline QSystemError();
QString toString() const;
inline QString toString() const;
inline ErrorScope scope() const;
inline int error() const;
static QString string(ErrorScope errorScope, int errorCode);
static QString stdString(int errorCode = -1);
#ifdef Q_OS_WIN
static QString windowsString(int errorCode = -1);
#endif
//data members
int errorCode;
ErrorScope errorScope;
@ -90,6 +96,11 @@ QSystemError::QSystemError()
}
QString QSystemError::toString() const
{
return string(errorScope, errorCode);
}
QSystemError::ErrorScope QSystemError::scope() const
{
return errorScope;
@ -100,7 +111,6 @@ int QSystemError::error() const
return errorCode;
}
QT_END_NAMESPACE
#endif // QSYSTEMERROR_P_H

View File

@ -48,6 +48,7 @@
#include <qmutex.h>
#include <qmap.h>
#include <private/qcoreapplication_p.h>
#include <private/qsystemerror_p.h>
#ifdef Q_OS_MAC
# include <private/qcore_mac_p.h>
#endif
@ -237,7 +238,7 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib)
lib->errorString = file.errorString();
if (qt_debug_component()) {
qWarning("%s: %s", (const char*) QFile::encodeName(library),
qPrintable(qt_error_string(errno)));
qPrintable(QSystemError::stdString()));
}
return false;
}

View File

@ -373,7 +373,7 @@ public:
typedef const T *pointer;
typedef const T &reference;
inline const_iterator() : i(Q_NULLPTR) { }
Q_DECL_CONSTEXPR inline const_iterator() : i(Q_NULLPTR) { }
explicit inline const_iterator(void *node)
: i(reinterpret_cast<QHashData::Node *>(node)) { }
#ifdef QT_STRICT_ITERATORS
@ -387,8 +387,8 @@ public:
inline const T &value() const { return concrete(i)->value; }
inline const T &operator*() const { return concrete(i)->value; }
inline const T *operator->() const { return &concrete(i)->value; }
inline bool operator==(const const_iterator &o) const { return i == o.i; }
inline bool operator!=(const const_iterator &o) const { return i != o.i; }
Q_DECL_CONSTEXPR inline bool operator==(const const_iterator &o) const { return i == o.i; }
Q_DECL_CONSTEXPR inline bool operator!=(const const_iterator &o) const { return i != o.i; }
inline const_iterator &operator++() {
i = QHashData::nextNode(i);

View File

@ -473,7 +473,7 @@ public:
typedef const T *pointer;
typedef const T &reference;
inline const_iterator() : i(Q_NULLPTR) { }
Q_DECL_CONSTEXPR inline const_iterator() : i(Q_NULLPTR) { }
inline const_iterator(const Node *node) : i(node) { }
#ifdef QT_STRICT_ITERATORS
explicit inline const_iterator(const iterator &o)
@ -486,8 +486,8 @@ public:
inline const T &value() const { return i->value; }
inline const T &operator*() const { return i->value; }
inline const T *operator->() const { return &i->value; }
inline bool operator==(const const_iterator &o) const { return i == o.i; }
inline bool operator!=(const const_iterator &o) const { return i != o.i; }
Q_DECL_CONSTEXPR inline bool operator==(const const_iterator &o) const { return i == o.i; }
Q_DECL_CONSTEXPR inline bool operator!=(const const_iterator &o) const { return i != o.i; }
inline const_iterator &operator++() {
i = i->nextNode();

View File

@ -45,6 +45,8 @@
#include <QtCore/qvector.h>
#include <QDebug>
#include <locale>
QT_BEGIN_NAMESPACE
typedef QMap<QByteArray, QByteArray> OidNameMap;
@ -82,6 +84,27 @@ static OidNameMap createOidMap()
}
Q_GLOBAL_STATIC_WITH_ARGS(OidNameMap, oidNameMap, (createOidMap()))
static bool stringToNonNegativeInt(const QByteArray &asnString, int *val)
{
// Helper function for toDateTime(), which handles chunking of the original
// string into smaller sub-components, so we expect the whole 'asnString' to
// be a valid non-negative number.
Q_ASSERT(val);
// We want the C locale, as used by QByteArray; however, no leading sign is
// allowed (which QByteArray would accept), so we have to check the data:
const std::locale localeC;
for (char v : asnString) {
if (!std::isdigit(v, localeC))
return false;
}
bool ok = false;
*val = asnString.toInt(&ok);
Q_ASSERT(ok && *val >= 0);
return true;
}
QAsn1Element::QAsn1Element(quint8 type, const QByteArray &value)
: mType(type)
, mValue(value)
@ -231,15 +254,19 @@ bool QAsn1Element::toBool(bool *ok) const
QDateTime QAsn1Element::toDateTime() const
{
if (mValue.endsWith('Z')) {
if (mType == UtcTimeType && mValue.size() == 13)
return QDateTime(QDate(2000 + mValue.mid(0, 2).toInt(),
if (mType == UtcTimeType && mValue.size() == 13) {
int year = 0;
if (!stringToNonNegativeInt(mValue.mid(0, 2), &year))
return QDateTime();
// RFC 2459: YY represents a year in the range [1950, 2049]
return QDateTime(QDate(year < 50 ? 2000 + year : 1900 + year,
mValue.mid(2, 2).toInt(),
mValue.mid(4, 2).toInt()),
QTime(mValue.mid(6, 2).toInt(),
mValue.mid(8, 2).toInt(),
mValue.mid(10, 2).toInt()),
Qt::UTC);
else if (mType == GeneralizedTimeType && mValue.size() == 15)
} else if (mType == GeneralizedTimeType && mValue.size() == 15) {
return QDateTime(QDate(mValue.mid(0, 4).toInt(),
mValue.mid(4, 2).toInt(),
mValue.mid(6, 2).toInt()),
@ -247,6 +274,7 @@ QDateTime QAsn1Element::toDateTime() const
mValue.mid(10, 2).toInt(),
mValue.mid(12, 2).toInt()),
Qt::UTC);
}
}
return QDateTime();
}

View File

@ -256,10 +256,6 @@ public:
QKdeThemePrivate(const QStringList &kdeDirs, int kdeVersion)
: kdeDirs(kdeDirs)
, kdeVersion(kdeVersion)
, toolButtonStyle(Qt::ToolButtonTextBesideIcon)
, toolBarIconSize(0)
, singleClick(true)
, wheelScrollLines(3)
{ }
static QString kdeGlobals(const QString &kdeDir, int kdeVersion)
@ -282,10 +278,15 @@ public:
QString iconThemeName;
QString iconFallbackThemeName;
QStringList styleNames;
int toolButtonStyle;
int toolBarIconSize;
bool singleClick;
int wheelScrollLines;
int toolButtonStyle = Qt::ToolButtonTextBesideIcon;
int toolBarIconSize = 0;
bool singleClick = true;
bool showIconsOnPushButtons = true;
int wheelScrollLines = 3;
int doubleClickInterval = 400;
int startDragDist = 10;
int startDragTime = 500;
int cursorBlinkRate = 1000;
};
void QKdeThemePrivate::refresh()
@ -321,6 +322,10 @@ void QKdeThemePrivate::refresh()
if (singleClickValue.isValid())
singleClick = singleClickValue.toBool();
const QVariant showIconsOnPushButtonsValue = readKdeSetting(QStringLiteral("KDE/ShowIconsOnPushButtons"), kdeDirs, kdeVersion, kdeSettings);
if (showIconsOnPushButtonsValue.isValid())
showIconsOnPushButtons = showIconsOnPushButtonsValue.toBool();
const QVariant themeValue = readKdeSetting(QStringLiteral("Icons/Theme"), kdeDirs, kdeVersion, kdeSettings);
if (themeValue.isValid())
iconThemeName = themeValue.toString();
@ -344,6 +349,24 @@ void QKdeThemePrivate::refresh()
if (wheelScrollLinesValue.isValid())
wheelScrollLines = wheelScrollLinesValue.toInt();
const QVariant doubleClickIntervalValue = readKdeSetting(QStringLiteral("KDE/DoubleClickInterval"), kdeDirs, kdeVersion, kdeSettings);
if (doubleClickIntervalValue.isValid())
doubleClickInterval = doubleClickIntervalValue.toInt();
const QVariant startDragDistValue = readKdeSetting(QStringLiteral("KDE/StartDragDist"), kdeDirs, kdeVersion, kdeSettings);
if (startDragDistValue.isValid())
startDragDist = startDragDistValue.toInt();
const QVariant startDragTimeValue = readKdeSetting(QStringLiteral("KDE/StartDragTime"), kdeDirs, kdeVersion, kdeSettings);
if (startDragTimeValue.isValid())
startDragTime = startDragTimeValue.toInt();
const QVariant cursorBlinkRateValue = readKdeSetting(QStringLiteral("KDE/CursorBlinkRate"), kdeDirs, kdeVersion, kdeSettings);
if (cursorBlinkRateValue.isValid()) {
cursorBlinkRate = cursorBlinkRateValue.toInt();
cursorBlinkRate = cursorBlinkRate > 0 ? qBound(200, cursorBlinkRate, 2000) : 0;
}
// Read system font, ignore 'smallestReadableFont'
if (QFont *systemFont = kdeFont(readKdeSetting(QStringLiteral("font"), kdeDirs, kdeVersion, kdeSettings)))
resources.fonts[QPlatformTheme::SystemFont] = systemFont;
@ -519,7 +542,7 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
case QPlatformTheme::UseFullScreenForPopupMenu:
return QVariant(true);
case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
return QVariant(true);
return QVariant(d->showIconsOnPushButtons);
case QPlatformTheme::DialogButtonBoxLayout:
return QVariant(QPlatformDialogHelper::KdeLayout);
case QPlatformTheme::ToolButtonStyle:
@ -542,6 +565,14 @@ QVariant QKdeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
return QVariant(d->singleClick);
case QPlatformTheme::WheelScrollLines:
return QVariant(d->wheelScrollLines);
case QPlatformTheme::MouseDoubleClickInterval:
return QVariant(d->doubleClickInterval);
case QPlatformTheme::StartDragTime:
return QVariant(d->startDragTime);
case QPlatformTheme::StartDragDistance:
return QVariant(d->startDragDist);
case QPlatformTheme::CursorFlashTime:
return QVariant(d->cursorBlinkRate);
case QPlatformTheme::UiEffects:
return QVariant(int(HoverEffect));
default:

View File

@ -57,6 +57,7 @@
#include <QtGui/qpainter.h>
#include <QtFontDatabaseSupport/private/qcoretextfontdatabase_p.h>
#include <QtThemeSupport/private/qabstractfileiconengine_p.h>
#include <qpa/qplatformdialoghelper.h>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformnativeinterface.h>

View File

@ -88,9 +88,9 @@
*/
- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize
{
Q_UNUSED(window);
Q_ASSERT(NSEqualSizes(m_cocoaWindow->screen()->geometry().size().toCGSize(), proposedSize));
return proposedSize;
Q_UNUSED(proposedSize);
Q_ASSERT(window == m_cocoaWindow->nativeWindow());
return m_cocoaWindow->screen()->geometry().size().toCGSize();
}
#endif

View File

@ -126,18 +126,6 @@
"features": [
"disable_desktopgl"
]
},
{
"id": 11,
"description": "VMWare Workstation Player 12 has insufficient support for OpenGL",
"vendor_id": "0x15AD",
"device_id": [ "0x0405" ],
"os": {
"type": "win"
},
"features": [
"disable_desktopgl", "disable_d3d11"
]
}
]
}

View File

@ -89,7 +89,9 @@
#include <qstyleoption.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#if QT_CONFIG(treeview)
#include <qtreeview.h>
#endif
#if QT_CONFIG(tableview)
#include <qtableview.h>
#endif
@ -491,7 +493,7 @@ static QStyleHelper::WidgetSizePolicy getControlSize(const QStyleOption *option,
return wsp;
}
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
static inline bool isTreeView(const QWidget *widget)
{
return (widget && widget->parentWidget() &&
@ -1027,7 +1029,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
break;
#endif
case QStyle::CT_HeaderSection:
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
if (isTreeView(widg))
ret = QSize(-1, qt_mac_aqua_get_metric(ListHeaderHeight));
#endif

View File

@ -93,7 +93,9 @@
#include <qtextstream.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#if QT_CONFIG(treeview)
#include <qtreeview.h>
#endif
#if QT_CONFIG(tableview)
#include <qtableview.h>
#endif

View File

@ -75,7 +75,9 @@
#include <qprogressbar.h>
#include <qdockwidget.h>
#include <qlistview.h>
#if QT_CONFIG(treeview)
#include <qtreeview.h>
#endif
#include <qtextedit.h>
#include <qmessagebox.h>
#if QT_CONFIG(dialogbuttonbox)

View File

@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
/*
The BLACKLIST file format is a grouped listing of keywords.
Blank lines and lines starting with # are simply ignored. An initial #-line
Blank lines and everything after # is simply ignored. An initial #-line
referring to this documentation is kind to readers. Comments can also be used
to indicate the reasons for ignoring particular cases.
@ -253,8 +253,12 @@ void parseBlackList()
QByteArray function;
while (!ignored.atEnd()) {
QByteArray line = ignored.readLine().simplified();
if (line.isEmpty() || line.startsWith('#'))
QByteArray line = ignored.readLine();
const int commentPosition = line.indexOf('#');
if (commentPosition >= 0)
line.truncate(commentPosition);
line = line.simplified();
if (line.isEmpty())
continue;
if (line.startsWith('[')) {
function = line.mid(1, line.length() - 2);

View File

@ -62,7 +62,7 @@ static const char docTypeHeader[] =
#define PROGRAMNAME "qdbuscpp2xml"
#define PROGRAMVERSION "0.2"
#define PROGRAMCOPYRIGHT "Copyright (C) 2016 The Qt Company Ltd."
#define PROGRAMCOPYRIGHT "Copyright (C) 2017 The Qt Company Ltd."
static QString outputFile;
static int flags;

View File

@ -46,7 +46,7 @@
#define PROGRAMNAME "qdbusxml2cpp"
#define PROGRAMVERSION "0.8"
#define PROGRAMCOPYRIGHT "Copyright (C) 2016 The Qt Company Ltd."
#define PROGRAMCOPYRIGHT "Copyright (C) 2017 The Qt Company Ltd."
#define ANNOTATION_NO_WAIT "org.freedesktop.DBus.Method.NoReply"
@ -1134,6 +1134,11 @@ int main(int argc, char **argv)
QDBusIntrospection::Interfaces interfaces = readInput();
cleanInterfaces(interfaces);
QStringList args = app.arguments();
args.removeFirst();
commandLine = QLatin1String(PROGRAMNAME " ");
commandLine += args.join(QLatin1Char(' '));
if (!proxyFile.isEmpty() || adaptorFile.isEmpty())
writeProxy(proxyFile, interfaces);

View File

@ -53,7 +53,6 @@
#if QT_CONFIG(whatsthis)
#include <qwhatsthis.h>
#endif
#include <qtreeview.h>
#include <private/qtabbar_p.h>
#include <QAbstractScrollArea>
#include <QScrollArea>

View File

@ -44,8 +44,11 @@
#include <qtableview.h>
#endif
#include <qlistview.h>
#if QT_CONFIG(treeview)
#include <qtreeview.h>
#include <private/qtreeview_p.h>
#endif
#include <private/qwidget_p.h>
#ifndef QT_NO_ACCESSIBILITY
@ -88,7 +91,7 @@ QAccessibleTable::QAccessibleTable(QWidget *w)
m_role = QAccessible::Table;
} else
#endif
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
if (qobject_cast<const QTreeView*>(view())) {
m_role = QAccessible::Tree;
} else
@ -123,7 +126,7 @@ QHeaderView *QAccessibleTable::horizontalHeader() const
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view())) {
header = tv->horizontalHeader();
#endif
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
} else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view())) {
header = tv->header();
#endif
@ -647,7 +650,7 @@ void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event)
}
}
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
// TREE VIEW
@ -820,7 +823,7 @@ bool QAccessibleTree::selectRow(int row)
return true;
}
#endif // QT_NO_TREEVIEW
#endif // QT_CONFIG(treeview)
// TABLE CELL
@ -872,7 +875,7 @@ QHeaderView *QAccessibleTableCell::horizontalHeader() const
} else if (const QTableView *tv = qobject_cast<const QTableView*>(view)) {
header = tv->horizontalHeader();
#endif
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
} else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view)) {
header = tv->header();
#endif
@ -898,7 +901,7 @@ int QAccessibleTableCell::columnIndex() const
int QAccessibleTableCell::rowIndex() const
{
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
if (role() == QAccessible::TreeItem) {
const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
Q_ASSERT(treeView);
@ -1034,7 +1037,7 @@ QAccessible::State QAccessibleTableCell::state() const
if (view->selectionMode() == QAbstractItemView::ExtendedSelection)
st.extSelectable = true;
}
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
if (m_role == QAccessible::TreeItem) {
const QTreeView *treeView = qobject_cast<const QTreeView*>(view);
if (treeView->model()->hasChildren(m_index))
@ -1135,7 +1138,7 @@ QRect QAccessibleTableHeaderCell::rect() const
header = tv->verticalHeader();
}
#endif
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
} else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view)) {
header = tv->header();
#endif
@ -1202,7 +1205,7 @@ QHeaderView *QAccessibleTableHeaderCell::headerView() const
header = tv->verticalHeader();
}
#endif
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
} else if (const QTreeView *tv = qobject_cast<const QTreeView*>(view)) {
header = tv->header();
#endif

View File

@ -145,7 +145,7 @@ private:
QAccessible::Role m_role;
};
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
class QAccessibleTree :public QAccessibleTable
{
public:
@ -223,7 +223,7 @@ private:
void unselectCell();
friend class QAccessibleTable;
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
friend class QAccessibleTree;
#endif
};
@ -259,7 +259,7 @@ private:
Qt::Orientation orientation;
friend class QAccessibleTable;
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
friend class QAccessibleTree;
#endif
};

View File

@ -46,7 +46,9 @@
#include "itemviews_p.h"
#include <qtoolbutton.h>
#if QT_CONFIG(treeview)
#include <qtreeview.h>
#endif
#include <qvariant.h>
#include <qaccessible.h>
@ -140,10 +142,10 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QMenu")) {
iface = new QAccessibleMenu(widget);
#endif
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
} else if (classname == QLatin1String("QTreeView")) {
iface = new QAccessibleTree(widget);
#endif // QT_NO_TREEVIEW
#endif // QT_CONFIG(treeview)
#ifndef QT_NO_ITEMVIEWS
} else if (classname == QLatin1String("QTableView") || classname == QLatin1String("QListView")) {
iface = new QAccessibleTable(widget);

View File

@ -9,8 +9,6 @@ HEADERS += \
itemviews/qlistview.h \
itemviews/qlistview_p.h \
itemviews/qbsptree_p.h \
itemviews/qtreeview.h \
itemviews/qtreeview_p.h \
itemviews/qabstractitemdelegate.h \
itemviews/qabstractitemdelegate_p.h \
itemviews/qitemdelegate.h \
@ -26,7 +24,6 @@ SOURCES += \
itemviews/qheaderview.cpp \
itemviews/qlistview.cpp \
itemviews/qbsptree.cpp \
itemviews/qtreeview.cpp \
itemviews/qabstractitemdelegate.cpp \
itemviews/qitemdelegate.cpp \
itemviews/qdirmodel.cpp \
@ -70,6 +67,14 @@ qtConfig(tablewidget) {
SOURCES += itemviews/qtablewidget.cpp
}
qtConfig(treeview) {
HEADERS += \
itemviews/qtreeview.h \
itemviews/qtreeview_p.h
SOURCES += itemviews/qtreeview.cpp
}
qtConfig(treewidget) {
HEADERS += \
itemviews/qtreewidget.h \

View File

@ -52,7 +52,6 @@
#include <qdatetime.h>
#include <qlineedit.h>
#include <qspinbox.h>
#include <qtreeview.h>
#include <qheaderview.h>
#include <qstyleditemdelegate.h>
#include <private/qabstractitemview_p.h>

View File

@ -38,7 +38,6 @@
****************************************************************************/
#include "qtreeview.h"
#ifndef QT_NO_TREEVIEW
#include <qheaderview.h>
#include <qitemdelegate.h>
#include <qapplication.h>
@ -3996,5 +3995,3 @@ int QTreeView::visualIndex(const QModelIndex &index) const
QT_END_NAMESPACE
#include "moc_qtreeview.cpp"
#endif // QT_NO_TREEVIEW

View File

@ -45,11 +45,10 @@
class tst_QTreeView;
QT_REQUIRE_CONFIG(treeview);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_TREEVIEW
class QTreeViewPrivate;
class QHeaderView;
@ -237,8 +236,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_sortIndicatorChanged(int column, Qt::SortOrder order))
};
#endif // QT_NO_TREEVIEW
QT_END_NAMESPACE
#endif // QTREEVIEW_H

View File

@ -57,7 +57,7 @@
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qvector.h>
#ifndef QT_NO_TREEVIEW
QT_REQUIRE_CONFIG(treeview);
QT_BEGIN_NAMESPACE
@ -272,6 +272,4 @@ public:
QT_END_NAMESPACE
#endif // QT_NO_TREEVIEW
#endif // QTREEVIEW_P_H

View File

@ -41,6 +41,7 @@
#include "qcommonstyle_p.h"
#include <qfile.h>
#include <qabstractitemview.h>
#include <qapplication.h>
#include <private/qguiapplication_p.h>
#include <qpa/qplatformtheme.h>
@ -71,7 +72,9 @@
#if QT_CONFIG(rubberband)
#include <qrubberband.h>
#endif
#if QT_CONFIG(treeview)
#include "qtreeview.h"
#endif
#include <private/qcommonstylepixmaps_p.h>
#include <private/qmath_p.h>
#include <qdebug.h>
@ -5252,7 +5255,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_Widget_Animate:
// TODO Qt6: move this code in the SH_Widget_Animation_Duration case
// and replace false with 0 and true with 200.
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
if (qobject_cast<const QTreeView*>(widget)) {
ret = false;
} else

View File

@ -3668,7 +3668,6 @@ int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QW
case SH_ScrollView_FrameOnlyAroundContents:
case SH_Menu_AllowActiveAndDisabled:
case SH_MainWindow_SpaceBelowMenuBar:
case SH_DialogButtonBox_ButtonsHaveIcons:
case SH_MessageBox_CenterButtons:
case SH_RubberBand_Mask:
return 0;

View File

@ -55,7 +55,6 @@
#include <QComboBox>
#include <QAbstractItemView>
#include <QListView>
#include <QTreeView>
#include <QStyledItemDelegate>
#include <QAbstractScrollArea>
#include <QScrollBar>

View File

@ -57,7 +57,7 @@
#ifndef QT_NO_COMPLETER
#include "QtWidgets/qtreeview.h"
#include "QtWidgets/qabstractitemview.h"
#include "QtCore/qabstractproxymodel.h"
#include "qcompleter.h"
#include "QtWidgets/qitemdelegate.h"

View File

@ -56,7 +56,9 @@
#include <qevent.h>
#include <qlayout.h>
#include <qscrollbar.h>
#if QT_CONFIG(treeview)
#include <qtreeview.h>
#endif
#include <qheaderview.h>
#include <qmath.h>
#include <qmetaobject.h>
@ -2619,7 +2621,7 @@ void QComboBox::showPopup()
int count = 0;
QStack<QModelIndex> toCheck;
toCheck.push(view()->rootIndex());
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
QTreeView *treeView = qobject_cast<QTreeView*>(view());
if (treeView && treeView->header() && !treeView->header()->isHidden())
listHeight += treeView->header()->height();
@ -2631,7 +2633,7 @@ void QComboBox::showPopup()
if (!idx.isValid())
continue;
listHeight += view()->visualRect(idx).height();
#ifndef QT_NO_TREEVIEW
#if QT_CONFIG(treeview)
if (d->model->hasChildren(idx) && treeView && treeView->isExpanded(idx))
toCheck.push(idx);
#endif

View File

@ -411,7 +411,9 @@ QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardBut
else
addButton(button, static_cast<QDialogButtonBox::ButtonRole>(role), doLayout);
#if QT_CONFIG(shortcut)
button->setShortcut(QGuiApplicationPrivate::platformTheme()->standardButtonShortcut(sbutton));
const QKeySequence standardShortcut = QGuiApplicationPrivate::platformTheme()->standardButtonShortcut(sbutton);
if (!standardShortcut.isEmpty())
button->setShortcut(standardShortcut);
#endif
return button;
}

View File

@ -134,6 +134,33 @@ void tst_QAsn1Element::dateTime_data()
QTest::newRow("UTCTime - no trailing Z")
<< QByteArray::fromHex("170d30373034313730373430323659")
<< QDateTime();
QTest::newRow("UTCTime - year 1950")
<< QByteArray::fromHex("170d3530313232343035353530305a")
<< QDateTime(QDate(1950, 12, 24), QTime(5, 55), Qt::UTC);
QTest::newRow("UTCTime - year 1999")
<< QByteArray::fromHex("170d3939313232343035353530305a")
<< QDateTime(QDate(1999, 12, 24), QTime(5, 55), Qt::UTC);
QTest::newRow("UTCTime - year 2000")
<< QByteArray::fromHex("170d3030313232343035353530305a")
<< QDateTime(QDate(2000, 12, 24), QTime(5, 55), Qt::UTC);
QTest::newRow("UTCTime - year 2049")
<< QByteArray::fromHex("170d3439313232343035353530305a")
<< QDateTime(QDate(2049, 12, 24), QTime(5, 55), Qt::UTC);
QTest::newRow("UTCTime - invalid year ('-9')")
<< QByteArray::fromHex("170d2d39313232343035353530305a")
<< QDateTime();
QTest::newRow("UTCTime - invalid year ('*9')")
<< QByteArray::fromHex("170d2a39313232343035353530305a")
<< QDateTime();
QTest::newRow("UTCTime - invalid year ('5*')")
<< QByteArray::fromHex("170d352a313232343035353530305a")
<< QDateTime();
QTest::newRow("UTCTime - invalid year ('AB')")
<< QByteArray::fromHex("170d4142313232343035353530305a")
<< QDateTime();
QTest::newRow("UTCTime - invalid year ('+1')")
<< QByteArray::fromHex("170d2b31313232343035353530305a")
<< QDateTime();
QTest::newRow("GeneralizedTime - 20510829095341Z")
<< QByteArray::fromHex("180f32303531303832393039353334315a")
<< QDateTime(QDate(2051, 8, 29), QTime(9, 53, 41), Qt::UTC);

View File

@ -2341,7 +2341,11 @@ void tst_qmakelib::addTestFunctions(const QString &qindir)
QTest::newRow("include(): fail")
<< "include(include/nope.pri): OK = 1"
<< "OK = UNDEF"
#ifdef Q_OS_WIN
<< "Cannot read " + m_indir + "/include/nope.pri: The system cannot find the file specified."
#else
<< "Cannot read " + m_indir + "/include/nope.pri: No such file or directory"
#endif
<< true;
QTest::newRow("include(): silent fail")