diff options
author | Liang Qi <liang.qi@qt.io> | 2016-11-24 09:36:06 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-11-24 11:18:22 +0000 |
commit | 3966ab51ff140f173f1f0c23fa3a9ef985c73d27 (patch) | |
tree | f30302c2c40e8d1b30e3ab589917eca5883aa3a2 /src | |
parent | 0861c2176c6dc1c69b733c1a843c2db5ec8ea786 (diff) | |
parent | 4783de0473a288fdff7e5354c12315ba025ec7e0 (diff) |
Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8
Diffstat (limited to 'src')
27 files changed, 153 insertions, 130 deletions
diff --git a/src/corelib/codecs/qsimplecodec_p.h b/src/corelib/codecs/qsimplecodec_p.h index d268a9f5b8..188c3f3cb4 100644 --- a/src/corelib/codecs/qsimplecodec_p.h +++ b/src/corelib/codecs/qsimplecodec_p.h @@ -67,12 +67,12 @@ public: explicit QSimpleTextCodec(int); ~QSimpleTextCodec(); - QString convertToUnicode(const char *, int, ConverterState *) const; - QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const; + QString convertToUnicode(const char *, int, ConverterState *) const override; + QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override; - QByteArray name() const; - QList<QByteArray> aliases() const; - int mibEnum() const; + QByteArray name() const override; + QList<QByteArray> aliases() const override; + int mibEnum() const override; private: int forwardIndex; diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 0b2345f8d4..d1d5373146 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -986,6 +986,9 @@ # define Q_COMPILER_THREADSAFE_STATICS # define Q_COMPILER_UNIFORM_INIT # endif +# if _MSC_VER >= 1910 +# define Q_COMPILER_CONSTEXPR +# endif # endif /* __cplusplus */ #endif /* Q_CC_MSVC */ diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 1469f5776b..27fe10a79e 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -318,8 +318,10 @@ QLibraryInfo::buildDate() # define COMPILER_STRING "MSVC 2012" # elif _MSC_VER < 1900 # define COMPILER_STRING "MSVC 2013" -# elif _MSC_VER < 2000 +# elif _MSC_VER < 1910 # define COMPILER_STRING "MSVC 2015" +# elif _MSC_VER < 2000 +# define COMPILER_STRING "MSVC 2017" # else # define COMPILER_STRING "MSVC _MSC_VER " QT_STRINGIFY(_MSC_VER) # endif diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 0ca6829564..f344873276 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1779,7 +1779,7 @@ void qErrnoWarning(int code, const char *msg, ...) \snippet code/src_corelib_global_qglobal.cpp 23 - \sa QtMessageHandler, QtMsgType, qDebug(), qWarning(), qCritical(), qFatal(), + \sa QtMessageHandler, QtMsgType, qDebug(), qInfo(), qWarning(), qCritical(), qFatal(), {Debugging Techniques} */ diff --git a/src/corelib/io/qfile_p.h b/src/corelib/io/qfile_p.h index fd7db3c120..545890c6b3 100644 --- a/src/corelib/io/qfile_p.h +++ b/src/corelib/io/qfile_p.h @@ -70,7 +70,7 @@ protected: bool openExternalFile(int flags, int fd, QFile::FileHandleFlags handleFlags); bool openExternalFile(int flags, FILE *fh, QFile::FileHandleFlags handleFlags); - virtual QAbstractFileEngine *engine() const; + QAbstractFileEngine *engine() const override; QString fileName; }; diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 5de85f9811..1b908eac55 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -65,6 +65,13 @@ #include <MobileCoreServices/MobileCoreServices.h> #endif +#if defined(Q_OS_DARWIN) +// We cannot include <Foundation/Foundation.h> (it's an Objective-C header), but +// we need these declarations: +Q_FORWARD_DECLARE_OBJC_CLASS(NSString); +extern "C" NSString *NSTemporaryDirectory(); +#endif + QT_BEGIN_NAMESPACE #if defined(Q_OS_DARWIN) @@ -703,8 +710,17 @@ QString QFileSystemEngine::tempPath() return QLatin1String(QT_UNIX_TEMP_PATH_OVERRIDE); #else QString temp = QFile::decodeName(qgetenv("TMPDIR")); - if (temp.isEmpty()) - temp = QLatin1String("/tmp"); + if (temp.isEmpty()) { +#if defined(Q_OS_DARWIN) && !defined(QT_BOOTSTRAPPED) + if (NSString *nsPath = NSTemporaryDirectory()) { + temp = QString::fromCFString((CFStringRef)nsPath); + } else { +#else + { +#endif + temp = QLatin1String("/tmp"); + } + } return QDir::cleanPath(temp); #endif } diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h index d057603034..7f365f0e8a 100644 --- a/src/corelib/io/qtemporaryfile_p.h +++ b/src/corelib/io/qtemporaryfile_p.h @@ -70,7 +70,7 @@ protected: explicit QTemporaryFilePrivate(const QString &templateNameIn); ~QTemporaryFilePrivate(); - QAbstractFileEngine *engine() const; + QAbstractFileEngine *engine() const override; void resetFileEngine() const; bool autoRemove = true; @@ -99,14 +99,14 @@ public: ~QTemporaryFileEngine(); bool isReallyOpen() const; - void setFileName(const QString &file); + void setFileName(const QString &file) override; void setFileTemplate(const QString &fileTemplate); - bool open(QIODevice::OpenMode flags); - bool remove(); - bool rename(const QString &newName); - bool renameOverwrite(const QString &newName); - bool close(); + bool open(QIODevice::OpenMode flags) override; + bool remove() override; + bool rename(const QString &newName) override; + bool renameOverwrite(const QString &newName) override; + bool close() override; quint32 fileMode; bool filePathIsTemplate; diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 5b34813a71..60ce752eb6 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3690,6 +3690,9 @@ bool QUrl::matches(const QUrl &url, FormattingOptions options) const if ((d->sectionIsPresent & mask) != (url.d->sectionIsPresent & mask)) return false; + if (options & QUrl::RemovePath) + return true; + // Compare paths, after applying path-related options QString path1; d->appendPath(path1, options, QUrlPrivate::Path); diff --git a/src/corelib/mimetypes/qmimetypeparser_p.h b/src/corelib/mimetypes/qmimetypeparser_p.h index a502439419..0ce39e701c 100644 --- a/src/corelib/mimetypes/qmimetypeparser_p.h +++ b/src/corelib/mimetypes/qmimetypeparser_p.h @@ -108,19 +108,19 @@ public: explicit QMimeTypeParser(QMimeXMLProvider &provider) : m_provider(provider) {} protected: - inline bool process(const QMimeType &t, QString *) + inline bool process(const QMimeType &t, QString *) override { m_provider.addMimeType(t); return true; } - inline bool process(const QMimeGlobPattern &glob, QString *) + inline bool process(const QMimeGlobPattern &glob, QString *) override { m_provider.addGlobPattern(glob); return true; } - inline void processParent(const QString &child, const QString &parent) + inline void processParent(const QString &child, const QString &parent) override { m_provider.addParent(child, parent); } - inline void processAlias(const QString &alias, const QString &name) + inline void processAlias(const QString &alias, const QString &name) override { m_provider.addAlias(alias, name); } - inline void processMagicMatcher(const QMimeMagicRuleMatcher &matcher) + inline void processMagicMatcher(const QMimeMagicRuleMatcher &matcher) override { m_provider.addMagicMatcher(matcher); } private: diff --git a/src/corelib/statemachine/qhistorystate_p.h b/src/corelib/statemachine/qhistorystate_p.h index 4a4442d7dd..d22e5c4aaf 100644 --- a/src/corelib/statemachine/qhistorystate_p.h +++ b/src/corelib/statemachine/qhistorystate_p.h @@ -88,8 +88,8 @@ protected: // state, it will handle this transition as a special case. The history state itself is never // entered either: either the stored configuration will be used, or the target(s) of this // transition are used. - virtual bool eventTest(QEvent *event) { Q_UNUSED(event); return false; } - virtual void onTransition(QEvent *event) { Q_UNUSED(event); } + bool eventTest(QEvent *event) override { Q_UNUSED(event); return false; } + void onTransition(QEvent *event) override { Q_UNUSED(event); } }; QT_END_NAMESPACE diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index 447fca44c0..24218e833a 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -61,6 +61,9 @@ # error "Qt requires C++11 support" #endif +QT_WARNING_PUSH +QT_WARNING_DISABLE_MSVC(4522) + QT_BEGIN_NAMESPACE #if 0 @@ -323,4 +326,6 @@ public: QT_END_NAMESPACE +QT_WARNING_POP + #endif // QBASICATOMIC_H diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp index ce31fe9270..c62b8fd36b 100644 --- a/src/corelib/thread/qfutureinterface.cpp +++ b/src/corelib/thread/qfutureinterface.cpp @@ -83,13 +83,33 @@ QFutureInterfaceBase::~QFutureInterfaceBase() delete d; } +static inline int switch_on(QAtomicInt &a, int which) +{ + return a.fetchAndOrRelaxed(which) | which; +} + +static inline int switch_off(QAtomicInt &a, int which) +{ + return a.fetchAndAndRelaxed(~which) & ~which; +} + +static inline int switch_from_to(QAtomicInt &a, int from, int to) +{ + int newValue; + int expected = a.load(); + do { + newValue = (expected & ~from) | to; + } while (!a.testAndSetRelaxed(expected, newValue, expected)); + return newValue; +} + void QFutureInterfaceBase::cancel() { QMutexLocker locker(&d->m_mutex); - if (d->state & Canceled) + if (d->state.load() & Canceled) return; - d->state = State((d->state & ~Paused) | Canceled); + switch_from_to(d->state, Paused, Canceled); d->waitCondition.wakeAll(); d->pausedWaitCondition.wakeAll(); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Canceled)); @@ -99,10 +119,10 @@ void QFutureInterfaceBase::setPaused(bool paused) { QMutexLocker locker(&d->m_mutex); if (paused) { - d->state = State(d->state | Paused); + switch_on(d->state, Paused); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Paused)); } else { - d->state = State(d->state & ~Paused); + switch_off(d->state, Paused); d->pausedWaitCondition.wakeAll(); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Resumed)); } @@ -111,29 +131,24 @@ void QFutureInterfaceBase::setPaused(bool paused) void QFutureInterfaceBase::togglePaused() { QMutexLocker locker(&d->m_mutex); - if (d->state & Paused) { - d->state = State(d->state & ~Paused); + if (d->state.load() & Paused) { + switch_off(d->state, Paused); d->pausedWaitCondition.wakeAll(); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Resumed)); } else { - d->state = State(d->state | Paused); + switch_on(d->state, Paused); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Paused)); } } void QFutureInterfaceBase::setThrottled(bool enable) { - // bail out if we are not changing the state - if ((enable && (d->state & Throttled)) || (!enable && !(d->state & Throttled))) - return; - - // lock and change the state QMutexLocker lock(&d->m_mutex); if (enable) { - d->state = State(d->state | Throttled); + switch_on(d->state, Throttled); } else { - d->state = State(d->state & ~Throttled); - if (!(d->state & Paused)) + switch_off(d->state, Throttled); + if (!(d->state.load() & Paused)) d->pausedWaitCondition.wakeAll(); } } @@ -184,11 +199,15 @@ bool QFutureInterfaceBase::waitForNextResult() void QFutureInterfaceBase::waitForResume() { // return early if possible to avoid taking the mutex lock. - if ((d->state & Paused) == false || (d->state & Canceled)) - return; + { + const int state = d->state.load(); + if (!(state & Paused) || (state & Canceled)) + return; + } QMutexLocker lock(&d->m_mutex); - if ((d->state & Paused) == false || (d->state & Canceled)) + const int state = d->state.load(); + if (!(state & Paused) || (state & Canceled)) return; // decrease active thread count since this thread will wait. @@ -236,7 +255,7 @@ bool QFutureInterfaceBase::isProgressUpdateNeeded() const void QFutureInterfaceBase::reportStarted() { QMutexLocker locker(&d->m_mutex); - if ((d->state & Started) || (d->state & Canceled) || (d->state & Finished)) + if (d->state.load() & (Started|Canceled|Finished)) return; d->setState(State(Started | Running)); @@ -252,11 +271,11 @@ void QFutureInterfaceBase::reportCanceled() void QFutureInterfaceBase::reportException(const QException &exception) { QMutexLocker locker(&d->m_mutex); - if ((d->state & Canceled) || (d->state & Finished)) + if (d->state.load() & (Canceled|Finished)) return; d->m_exceptionStore.setException(exception); - d->state = State(d->state | Canceled); + switch_on(d->state, Canceled); d->waitCondition.wakeAll(); d->pausedWaitCondition.wakeAll(); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Canceled)); @@ -266,8 +285,8 @@ void QFutureInterfaceBase::reportException(const QException &exception) void QFutureInterfaceBase::reportFinished() { QMutexLocker locker(&d->m_mutex); - if (!(d->state & Finished)) { - d->state = State((d->state & ~Running) | Finished); + if (!isFinished()) { + switch_from_to(d->state, Running, Finished); d->waitCondition.wakeAll(); d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Finished)); } @@ -287,7 +306,7 @@ int QFutureInterfaceBase::expectedResultCount() bool QFutureInterfaceBase::queryState(State state) const { - return (d->state & state); + return d->state.load() & state; } void QFutureInterfaceBase::waitForResult(int resultIndex) @@ -295,7 +314,7 @@ void QFutureInterfaceBase::waitForResult(int resultIndex) d->m_exceptionStore.throwPossibleException(); QMutexLocker lock(&d->m_mutex); - if (!(d->state & Running)) + if (!isRunning()) return; lock.unlock(); @@ -305,11 +324,9 @@ void QFutureInterfaceBase::waitForResult(int resultIndex) lock.relock(); - if (d->state & Running) { - const int waitIndex = (resultIndex == -1) ? INT_MAX : resultIndex; - while ((d->state & Running) && d->internal_isResultReadyAt(waitIndex) == false) - d->waitCondition.wait(&d->m_mutex); - } + const int waitIndex = (resultIndex == -1) ? INT_MAX : resultIndex; + while (isRunning() && !d->internal_isResultReadyAt(waitIndex)) + d->waitCondition.wait(&d->m_mutex); d->m_exceptionStore.throwPossibleException(); } @@ -317,7 +334,7 @@ void QFutureInterfaceBase::waitForResult(int resultIndex) void QFutureInterfaceBase::waitForFinished() { QMutexLocker lock(&d->m_mutex); - const bool alreadyFinished = !(d->state & Running); + const bool alreadyFinished = !isRunning(); lock.unlock(); if (!alreadyFinished) { @@ -325,7 +342,7 @@ void QFutureInterfaceBase::waitForFinished() lock.relock(); - while (d->state & Running) + while (isRunning()) d->waitCondition.wait(&d->m_mutex); } @@ -334,7 +351,7 @@ void QFutureInterfaceBase::waitForFinished() void QFutureInterfaceBase::reportResultsReady(int beginIndex, int endIndex) { - if ((d->state & Canceled) || (d->state & Finished) || beginIndex == endIndex) + if (beginIndex == endIndex || (d->state.load() & (Canceled|Finished))) return; d->waitCondition.wakeAll(); @@ -396,7 +413,7 @@ void QFutureInterfaceBase::setProgressValueAndText(int progressValue, if (d->m_progressValue >= progressValue) return; - if ((d->state & Canceled) || (d->state & Finished)) + if (d->state.load() & (Canceled|Finished)) return; if (d->internal_updateProgress(progressValue, progressText)) { @@ -468,10 +485,10 @@ bool QFutureInterfaceBasePrivate::internal_waitForNextResult() if (m_results.hasNextResult()) return true; - while ((state & QFutureInterfaceBase::Running) && m_results.hasNextResult() == false) + while ((state.load() & QFutureInterfaceBase::Running) && m_results.hasNextResult() == false) waitCondition.wait(&m_mutex); - return (!(state & QFutureInterfaceBase::Canceled) && m_results.hasNextResult()); + return !(state.load() & QFutureInterfaceBase::Canceled) && m_results.hasNextResult(); } bool QFutureInterfaceBasePrivate::internal_updateProgress(int progress, @@ -494,16 +511,16 @@ bool QFutureInterfaceBasePrivate::internal_updateProgress(int progress, void QFutureInterfaceBasePrivate::internal_setThrottled(bool enable) { // bail out if we are not changing the state - if ((enable && (state & QFutureInterfaceBase::Throttled)) - || (!enable && !(state & QFutureInterfaceBase::Throttled))) + if ((enable && (state.load() & QFutureInterfaceBase::Throttled)) + || (!enable && !(state.load() & QFutureInterfaceBase::Throttled))) return; // change the state if (enable) { - state = QFutureInterfaceBase::State(state | QFutureInterfaceBase::Throttled); + switch_on(state, QFutureInterfaceBase::Throttled); } else { - state = QFutureInterfaceBase::State(state & ~QFutureInterfaceBase::Throttled); - if (!(state & QFutureInterfaceBase::Paused)) + switch_off(state, QFutureInterfaceBase::Throttled); + if (!(state.load() & QFutureInterfaceBase::Paused)) pausedWaitCondition.wakeAll(); } } @@ -538,7 +555,7 @@ void QFutureInterfaceBasePrivate::connectOutputInterface(QFutureCallOutInterface { QMutexLocker locker(&m_mutex); - if (state & QFutureInterfaceBase::Started) { + if (state.load() & QFutureInterfaceBase::Started) { interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Started)); interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::ProgressRange, m_progressMinimum, @@ -558,13 +575,13 @@ void QFutureInterfaceBasePrivate::connectOutputInterface(QFutureCallOutInterface it.batchedAdvance(); } - if (state & QFutureInterfaceBase::Paused) + if (state.load() & QFutureInterfaceBase::Paused) interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Paused)); - if (state & QFutureInterfaceBase::Canceled) + if (state.load() & QFutureInterfaceBase::Canceled) interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Canceled)); - if (state & QFutureInterfaceBase::Finished) + if (state.load() & QFutureInterfaceBase::Finished) interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Finished)); outputConnections.append(interface); @@ -583,7 +600,7 @@ void QFutureInterfaceBasePrivate::disconnectOutputInterface(QFutureCallOutInterf void QFutureInterfaceBasePrivate::setState(QFutureInterfaceBase::State newState) { - state = newState; + state.store(newState); } QT_END_NAMESPACE diff --git a/src/corelib/thread/qfutureinterface_p.h b/src/corelib/thread/qfutureinterface_p.h index ee8dfe1354..cf882dd9b4 100644 --- a/src/corelib/thread/qfutureinterface_p.h +++ b/src/corelib/thread/qfutureinterface_p.h @@ -162,7 +162,7 @@ public: int m_progressValue; // TQ int m_progressMinimum; // TQ int m_progressMaximum; // TQ - QFutureInterfaceBase::State state; + QAtomicInt state; // reads and writes can happen unprotected, both must be atomic QElapsedTimer progressTime; QWaitCondition pausedWaitCondition; QtPrivate::ResultStoreBase m_results; diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index 3271e2a8c4..621c877174 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -888,12 +888,12 @@ QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPos State state = Acceptable; QDateTime newCurrentValue; - int pos = 0; bool conflicts = false; const int sectionNodesCount = sectionNodes.size(); QDTPDEBUG << "parse" << input; { + int pos = 0; int year, month, day; const QDate currentDate = currentValue.date(); const QTime currentTime = currentValue.time(); diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp index eda816f0f2..19015c5dcd 100644 --- a/src/gui/image/qxbmhandler.cpp +++ b/src/gui/image/qxbmhandler.cpp @@ -124,17 +124,18 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage) qint64 readBytes = 0; + char *p; + // scan for database - for (;;) { + do { if ((readBytes = device->readLine(buf, buflen)) <= 0) { // end of file return false; } buf[readBytes] = '\0'; - if (QByteArray::fromRawData(buf, readBytes).contains("0x")) - break; - } + p = strstr(buf, "0x"); + } while (!p); if (outImage->size() != QSize(w, h) || outImage->format() != QImage::Format_MonoLSB) { *outImage = QImage(w, h, QImage::Format_MonoLSB); @@ -148,7 +149,6 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage) int x = 0, y = 0; uchar *b = outImage->scanLine(0); - char *p = buf + QByteArray::fromRawData(buf, readBytes).indexOf("0x"); w = (w+7)/8; // byte width while (y < h) { // for all encoded bytes... @@ -163,7 +163,8 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage) } else { // read another line if ((readBytes = device->readLine(buf,buflen)) <= 0) // EOF ==> truncated image break; - p = buf + QByteArray::fromRawData(buf, readBytes).indexOf("0x"); + buf[readBytes] = '\0'; + p = strstr(buf, "0x"); } } diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index d59bd63caf..a6bc7d4d9c 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1528,7 +1528,9 @@ bool QKeySequence::isDetached() const If the key sequence has no keys, an empty string is returned. On \macos, the string returned resembles the sequence that is - shown in the menu bar. + shown in the menu bar if \a format is + QKeySequence::NativeText; otherwise, the string uses the + "portable" format, suitable for writing to a file. \sa fromString() */ diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 31d832a9ce..a0438bd458 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -2211,6 +2211,7 @@ void Parser::init(const QString &css, bool isFile) bool Parser::parse(StyleSheet *styleSheet, Qt::CaseSensitivity nameCaseSensitivity) { if (testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("charset"))) { + while (test(S) || test(CDO) || test(CDC)) {} if (!next(STRING)) return false; if (!next(SEMICOLON)) return false; } diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 5145385fdc..43648d0f7f 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -952,8 +952,8 @@ QFontEngine *loadSingleEngine(int script, return 0; } + engine->isSmoothlyScalable = style->smoothScalable; fontCache->insertEngine(key, engine); - return engine; } } @@ -978,6 +978,7 @@ QFontEngine *loadSingleEngine(int script, return 0; } + engine->isSmoothlyScalable = style->smoothScalable; fontCache->insertEngine(key, engine); if (Q_LIKELY(cacheForCommonScript && !engine->symbol)) { diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index a7d7185a7e..0b2972f189 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -257,6 +257,7 @@ QFontEngine::QFontEngine(Type type) cache_cost = 0; fsType = 0; symbol = false; + isSmoothlyScalable = false; glyphFormat = Format_None; m_subPixelPositionCount = 0; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 42610e9b70..c0e350f755 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -325,6 +325,7 @@ public: uint cache_cost; // amount of mem used in bytes by the font uint fsType : 16; bool symbol; + bool isSmoothlyScalable; struct KernPair { uint left_right; QFixed adjust; diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index d0b8bff7f9..8257eec9ea 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -358,25 +358,23 @@ bool QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket:: // Start processing incoming data if (d->socketType == QAbstractSocket::TcpSocket) { - HRESULT hr; - QEventDispatcherWinRT::runOnXamlThread([&hr, socket, socketState, this]() { - Q_D(QNativeSocketEngine); + HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([d, socket, socketState, this]() { ComPtr<IBuffer> buffer; HRESULT hr = g->bufferFactory->Create(READ_BUFFER_SIZE, &buffer); - RETURN_OK_IF_FAILED("initialize(): Could not create buffer"); + RETURN_HR_IF_FAILED("initialize(): Could not create buffer"); ComPtr<IInputStream> stream; hr = socket->get_InputStream(&stream); - RETURN_OK_IF_FAILED("initialize(): Could not obtain input stream"); + RETURN_HR_IF_FAILED("initialize(): Could not obtain input stream"); ComPtr<IAsyncBufferOperation> readOp; hr = stream->ReadAsync(buffer.Get(), READ_BUFFER_SIZE, InputStreamOptions_Partial, readOp.GetAddressOf()); - RETURN_OK_IF_FAILED_WITH_ARGS("initialize(): Failed to read from the socket buffer (%s).", - socketDescription(this).constData()); + RETURN_HR_IF_FAILED_WITH_ARGS("initialize(): Failed to read from the socket buffer (%s).", + socketDescription(this).constData()); QMutexLocker locker(&d->readOperationsMutex); d->pendingReadOps.append(readOp); d->socketState = socketState; hr = readOp->put_Completed(Callback<SocketReadCompletedHandler>(d, &QNativeSocketEnginePrivate::handleReadyRead).Get()); - RETURN_OK_IF_FAILED_WITH_ARGS("initialize(): Failed to set socket read callback (%s).", - socketDescription(this).constData()); + RETURN_HR_IF_FAILED_WITH_ARGS("initialize(): Failed to set socket read callback (%s).", + socketDescription(this).constData()); return S_OK; }); if (FAILED(hr)) diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index 7c88c73cc2..8cf6660c44 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -188,7 +188,7 @@ QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *wi QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const { - QWindowSystemInterface::flushWindowSystemEvents(); + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); QEglFSWindow *w = qt_egl_device_integration()->createWindow(window); w->create(); if (window->type() != Qt::ToolTip) diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index e79b377d40..639fc56d2b 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -215,7 +215,7 @@ void QEglFSWindow::setVisible(bool visible) QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size())); if (visible) - QWindowSystemInterface::flushWindowSystemEvents(); + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); } void QEglFSWindow::setGeometry(const QRect &r) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp index cd468c989f..8eb07d727b 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE -struct fbdev_window { +struct shadow_fbdev_window { unsigned short width; unsigned short height; }; @@ -91,7 +91,7 @@ EGLNativeWindowType QEglFSMaliIntegration::createNativeWindow(QPlatformWindow *w Q_UNUSED(window); Q_UNUSED(format); - fbdev_window *fbwin = reinterpret_cast<fbdev_window *>(malloc(sizeof(fbdev_window))); + shadow_fbdev_window *fbwin = reinterpret_cast<shadow_fbdev_window *>(malloc(sizeof(shadow_fbdev_window))); if (NULL == fbwin) return 0; diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index 09eba76fbd..db5af4fd7c 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -564,20 +564,8 @@ void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event) QAccessible::Id id = iter.value(); QAccessibleInterface *iface = QAccessible::accessibleInterface(id); Q_ASSERT(iface); - if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) { - Q_ASSERT(iface->tableCellInterface()); - QAccessibleTableCell *cell = static_cast<QAccessibleTableCell*>(iface->tableCellInterface()); - if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsInserted - && cell->m_index.row() >= event->firstRow()) { - int newRow = cell->m_index.row() + newRows; - cell->m_index = cell->m_index.sibling(newRow, cell->m_index.column()); - } else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::ColumnsInserted - && cell->m_index.column() >= event->firstColumn()) { - int newColumn = cell->m_index.column() + newColumns; - cell->m_index = cell->m_index.sibling(cell->m_index.row(), newColumn); - } - } else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsInserted - && iface->role() == QAccessible::RowHeader) { + if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsInserted + && iface->role() == QAccessible::RowHeader) { QAccessibleTableHeaderCell *cell = static_cast<QAccessibleTableHeaderCell*>(iface); if (cell->index >= event->firstRow()) { cell->index += newRows; @@ -616,27 +604,11 @@ void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event) if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) { Q_ASSERT(iface->tableCellInterface()); QAccessibleTableCell *cell = static_cast<QAccessibleTableCell*>(iface->tableCellInterface()); - if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsRemoved) { - if (cell->m_index.row() < event->firstRow()) { - newCache.insert(indexOfChild(cell), id); - } else if (cell->m_index.row() > event->lastRow()) { - int newRow = cell->m_index.row() - deletedRows; - cell->m_index = cell->m_index.sibling(newRow, cell->m_index.column()); - newCache.insert(indexOfChild(cell), id); - } else { - QAccessible::deleteAccessibleInterface(id); - } - } else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::ColumnsRemoved) { - if (cell->m_index.column() < event->firstColumn()) { - newCache.insert(indexOfChild(cell), id); - } else if (cell->m_index.column() > event->lastColumn()) { - int newColumn = cell->m_index.column() - deletedColumns; - cell->m_index = cell->m_index.sibling(cell->m_index.row(), newColumn); - newCache.insert(indexOfChild(cell), id); - } else { - QAccessible::deleteAccessibleInterface(id); - } - } + // Since it is a QPersistentModelIndex, we only need to check if it is valid + if (cell->m_index.isValid()) + newCache.insert(indexOfChild(cell), id); + else + QAccessible::deleteAccessibleInterface(id); } else if (event->modelChangeType() == QAccessibleTableModelChangeEvent::RowsRemoved && iface->role() == QAccessible::RowHeader) { QAccessibleTableHeaderCell *cell = static_cast<QAccessibleTableHeaderCell*>(iface); diff --git a/src/widgets/accessible/itemviews_p.h b/src/widgets/accessible/itemviews_p.h index 5b73444c67..1b3869f2fa 100644 --- a/src/widgets/accessible/itemviews_p.h +++ b/src/widgets/accessible/itemviews_p.h @@ -216,7 +216,7 @@ private: QHeaderView *verticalHeader() const; QHeaderView *horizontalHeader() const; QPointer<QAbstractItemView > view; - QModelIndex m_index; + QPersistentModelIndex m_index; QAccessible::Role m_role; void selectCell(); diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index dd5f5325b1..ffe1ca1c66 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -603,7 +603,7 @@ const QValidator * QLineEdit::validator() const The initial setting is to have no input validator (i.e. any input is accepted up to maxLength()). - \sa validator(), QIntValidator, QDoubleValidator, QRegExpValidator + \sa validator(), hasAcceptableInput(), QIntValidator, QDoubleValidator, QRegExpValidator */ void QLineEdit::setValidator(const QValidator *v) |