diff options
author | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2016-07-05 19:20:05 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-07-05 20:51:40 +0000 |
commit | 6c935dc74fa9e997144499d7aa34ef5aad389fbb (patch) | |
tree | 7d34363555f5aa115d850c02279d02646348731a /src | |
parent | b073ba57f821b2e79c553f974d9fba2cbb034ee9 (diff) | |
parent | b5695bd5be908970244919bcd7c19cbf7ccca2c4 (diff) |
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
Diffstat (limited to 'src')
23 files changed, 106 insertions, 46 deletions
diff --git a/src/angle/README.qt b/src/angle/README.qt index ce5b6332bc..2d484a0280 100644 --- a/src/angle/README.qt +++ b/src/angle/README.qt @@ -1,6 +1,6 @@ This is the ANGLE project from: -http://code.google.com/p/angleproject/ +https://chromium.googlesource.com/angle/angle/+/master/README.md The upstream version used here can be found in: diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 9efe2fb90e..f8fae711f2 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -692,7 +692,7 @@ QString QDir::filePath(const QString &fileName) const { const QDirPrivate* d = d_ptr.constData(); if (isAbsolutePath(fileName)) - return QString(fileName); + return fileName; QString ret = d->dirEntry.filePath(); if (!fileName.isEmpty()) { diff --git a/src/corelib/io/qsettings_winrt.cpp b/src/corelib/io/qsettings_winrt.cpp index 0a87e7ce66..708287ce5e 100644 --- a/src/corelib/io/qsettings_winrt.cpp +++ b/src/corelib/io/qsettings_winrt.cpp @@ -92,7 +92,7 @@ static IApplicationDataContainer *subContainer(IApplicationDataContainer *parent if (FAILED(hr)) return 0; - while (SUCCEEDED(S_OK) && current) { + while (SUCCEEDED(hr) && current) { ComPtr<ContainerItem> item; hr = iterator->get_Current(&item); if (FAILED(hr)) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 451e3b2967..bd2f9de66c 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -984,10 +984,12 @@ inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetErro needsLowercasing = i; continue; } - if (p[i] >= '0' && p[i] <= '9' && i > 0) - continue; - if (p[i] == '+' || p[i] == '-' || p[i] == '.') - continue; + if (i) { + if (p[i] >= '0' && p[i] <= '9') + continue; + if (p[i] == '+' || p[i] == '-' || p[i] == '.') + continue; + } // found something else // don't call setError needlessly: diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp index b2fa16d22a..6eca54bdf0 100644 --- a/src/corelib/json/qjsondocument.cpp +++ b/src/corelib/json/qjsondocument.cpp @@ -357,16 +357,14 @@ QByteArray QJsonDocument::toJson(JsonFormat format) const #endif /*! - Parses a UTF-8 encoded JSON document and creates a QJsonDocument + Parses \a json as a UTF-8 encoded JSON document, and creates a QJsonDocument from it. - \a json contains the json document to be parsed. + Returns a valid (non-null) QJsonDocument if the parsing succeeds. If it fails, + the returned document will be null, and the optional \a error variable will contain + further details about the error. - The optional \a error variable can be used to pass in a QJsonParseError data - structure that will contain information about possible errors encountered during - parsing. - - \sa toJson(), QJsonParseError + \sa toJson(), QJsonParseError, isNull() */ QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error) { diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 53f2a50191..125ced6fc9 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -79,6 +79,10 @@ #include <errno.h> #include <fcntl.h> +#if !defined(QT_POSIX_IPC) && !defined(QT_NO_SHAREDMEMORY) && !defined(Q_OS_ANDROID) +# include <sys/ipc.h> +#endif + #if defined(Q_OS_VXWORKS) # include <ioLib.h> #endif diff --git a/src/corelib/kernel/qeventloop.cpp b/src/corelib/kernel/qeventloop.cpp index e960d355e1..e4b819d9d2 100644 --- a/src/corelib/kernel/qeventloop.cpp +++ b/src/corelib/kernel/qeventloop.cpp @@ -188,8 +188,10 @@ int QEventLoop::exec(ProcessEventsFlags flags) { if (exceptionCaught) { qWarning("Qt has caught an exception thrown from an event handler. Throwing\n" - "exceptions from an event handler is not supported in Qt. You must\n" - "reimplement QApplication::notify() and catch all exceptions there.\n"); + "exceptions from an event handler is not supported in Qt.\n" + "You must not let any exception whatsoever propagate through Qt code.\n" + "If that is not possible, in Qt 5 you must at least reimplement\n" + "QCoreApplication::notify() and catch all exceptions there.\n"); } locker.relock(); QEventLoop *eventLoop = d->threadData->eventLoops.pop(); diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index b539bef5db..b296361146 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2721,7 +2721,7 @@ qint64 QDateTimePrivate::toMSecsSinceEpoch() const case Qt::TimeZone: #ifdef QT_BOOTSTRAPPED - break; + return 0; #else return zoneMSecsToEpochMSecs(m_msecs, m_timeZone); #endif @@ -4782,7 +4782,12 @@ QDataStream &operator>>(QDataStream &in, QDate &date) QDataStream &operator<<(QDataStream &out, const QTime &time) { - return out << quint32(time.mds); + if (out.version() >= QDataStream::Qt_4_0) { + return out << quint32(time.mds); + } else { + // Qt3 had no support for reading -1, QTime() was valid and serialized as 0 + return out << quint32(time.isNull() ? 0 : time.mds); + } } /*! @@ -4797,7 +4802,12 @@ QDataStream &operator>>(QDataStream &in, QTime &time) { quint32 ds; in >> ds; - time.mds = int(ds); + if (in.version() >= QDataStream::Qt_4_0) { + time.mds = int(ds); + } else { + // Qt3 would write 0 for a null time + time.mds = (ds == 0) ? QTime::NullTime : int(ds); + } return in; } diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 7ef9d7f26b..fcb8a60c8f 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -902,10 +902,7 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS if (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_RECVIF && cmsgptr->cmsg_len >= CMSG_LEN(sizeof(sockaddr_dl))) { sockaddr_dl *sdl = reinterpret_cast<sockaddr_dl *>(CMSG_DATA(cmsgptr)); -# if defined(Q_OS_OPENBSD) -# define LLINDEX(s) ((s)->sdl_index) -# endif - header->ifindex = LLINDEX(sdl); + header->ifindex = sdl->sdl_index; } # endif #endif diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 472db3aa81..591d635162 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -55,7 +55,8 @@ QSslSocket establishes a secure, encrypted TCP connection you can use for transmitting encrypted data. It can operate in both client and server mode, and it supports modern SSL protocols, including - SSLv3 and TLSv1_0. By default, QSslSocket uses TLSv1_0, but you can + SSL 3 and TLS 1.2. By default, QSslSocket uses only SSL protocols + which are considered to be secure (QSsl::SecureProtocols), but you can change the SSL protocol by calling setProtocol() as long as you do it before the handshake has started. diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index c164342166..3845a3d455 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -617,7 +617,7 @@ void QSslSocketBackendPrivate::transmit() if (connectionEncrypted && !writeBuffer.isEmpty()) { qint64 totalBytesWritten = 0; - while (writeBuffer.nextDataBlockSize() > 0) { + while (writeBuffer.nextDataBlockSize() > 0 && context) { const size_t nextDataBlockSize = writeBuffer.nextDataBlockSize(); size_t writtenBytes = 0; const OSStatus err = SSLWrite(context, writeBuffer.readPointer(), nextDataBlockSize, &writtenBytes); @@ -652,7 +652,7 @@ void QSslSocketBackendPrivate::transmit() if (connectionEncrypted) { QVarLengthArray<char, 4096> data; - while (true) { + while (context) { size_t readBytes = 0; data.resize(4096); const OSStatus err = SSLRead(context, data.data(), data.size(), &readBytes); @@ -1296,7 +1296,10 @@ bool QSslSocketBackendPrivate::verifyPeerTrust() // report errors if (!errors.isEmpty() && !canIgnoreVerify) { sslErrors = errors; - if (!checkSslErrors()) + // checkSslErrors unconditionally emits sslErrors: + // a user's slot can abort/close/disconnect on this + // signal, so we also test the socket's state: + if (!checkSslErrors() || q->state() != QAbstractSocket::ConnectedState) return false; } else { sslErrors.clear(); diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index efeb1f5f05..fda3f51a48 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -415,7 +415,9 @@ void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiA qCDebug(lcQpaWindows) << __FUNCTION__ << dpiAwareness; if (QWindowsContext::shcoredll.isValid()) { const HRESULT hr = QWindowsContext::shcoredll.setProcessDpiAwareness(dpiAwareness); - if (FAILED(hr)) { + // E_ACCESSDENIED means set externally (MSVC manifest or external app loading Qt plugin). + // Silence warning in that case unless debug is enabled. + if (FAILED(hr) && (hr != E_ACCESSDENIED || lcQpaWindows().isDebugEnabled())) { qWarning().noquote().nospace() << "SetProcessDpiAwareness(" << dpiAwareness << ") failed: " << QWindowsContext::comErrorString(hr) << ", using " << QWindowsContext::processDpiAwareness(); @@ -849,6 +851,9 @@ QByteArray QWindowsContext::comErrorString(HRESULT hr) case E_UNEXPECTED: result += QByteArrayLiteral("E_UNEXPECTED"); break; + case E_ACCESSDENIED: + result += QByteArrayLiteral("E_ACCESSDENIED"); + break; case CO_E_ALREADYINITIALIZED: result += QByteArrayLiteral("CO_E_ALREADYINITIALIZED"); break; diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index 0ce4e87e52..4261c01ac8 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -371,7 +371,7 @@ QSurfaceFormat QWindowsEGLStaticContext::formatFromConfig(EGLDisplay display, EG \list \o Install the Direct X SDK \o Checkout and build ANGLE (SVN repository) as explained here: - \l{http://code.google.com/p/angleproject/wiki/DevSetup}{ANGLE-Project}. + \l{https://chromium.googlesource.com/angle/angle/+/master/README.md} When building for 64bit, de-activate the "WarnAsError" option in every project file (as otherwise integer conversion warnings will break the build). diff --git a/src/plugins/platforms/winrt/qwinrtdrag.cpp b/src/plugins/platforms/winrt/qwinrtdrag.cpp index 2ef50aa4e2..055aacbf56 100644 --- a/src/plugins/platforms/winrt/qwinrtdrag.cpp +++ b/src/plugins/platforms/winrt/qwinrtdrag.cpp @@ -504,8 +504,8 @@ static HRESULT qt_drop(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventA class QtDragEventHandler##name : public IDragEventHandler \ { \ public: \ - virtual HRESULT STDMETHODCALLTYPE Invoke(IInspectable *sender, \ - ABI::Windows::UI::Xaml::IDragEventArgs *e) \ + STDMETHODIMP Invoke(IInspectable *sender, \ + ABI::Windows::UI::Xaml::IDragEventArgs *e) \ { \ return qt_##func(sender, e);\ } \ diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 7168e6e3bd..811ef4251a 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -979,10 +979,21 @@ QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const xkb_layout_index_t lockedLayout = xkb_state_serialize_layout(xkb_state, XKB_STATE_LAYOUT_LOCKED); xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED); xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED); + xkb_mod_mask_t depressedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_DEPRESSED); - xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods, 0, 0, lockedLayout); - + xkb_state_update_mask(kb_state, depressedMods, latchedMods, lockedMods, 0, 0, lockedLayout); quint32 keycode = event->nativeScanCode(); + // handle shortcuts for level three and above + xkb_layout_index_t layoutIndex = xkb_state_key_get_layout(kb_state, keycode); + xkb_level_index_t levelIndex = 0; + if (layoutIndex != XKB_LAYOUT_INVALID) { + levelIndex = xkb_state_key_get_level(kb_state, keycode, layoutIndex); + if (levelIndex == XKB_LEVEL_INVALID) + levelIndex = 0; + } + if (levelIndex <= 1) + xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods, 0, 0, lockedLayout); + xkb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, keycode); if (sym == XKB_KEY_NoSymbol) { xkb_state_unref(kb_state); diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp index 825a8acd1f..f7244739a5 100644 --- a/src/plugins/platforms/xcb/qxcbmime.cpp +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -131,6 +131,11 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa ret = true; } else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) { ret = true; + } else if (atomName == QLatin1String("text/plain") + && mimeData->hasFormat(QLatin1String("text/uri-list"))) { + // Return URLs also as plain text. + *data = QInternalMimeData::renderDataHelper(atomName, mimeData); + ret = true; } return ret; } @@ -149,8 +154,10 @@ QVector<xcb_atom_t> QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, con } // special cases for uris - if (format == QLatin1String("text/uri-list")) + if (format == QLatin1String("text/uri-list")) { atoms.append(connection->internAtom("text/x-moz-url")); + atoms.append(connection->internAtom("text/plain")); + } //special cases for images if (format == QLatin1String("image/ppm")) diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index edf4dcb164..228607d7e3 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -394,6 +394,9 @@ int QWin32PrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const case QPaintDevice::PdmDevicePixelRatio: val = 1; break; + case QPaintDevice::PdmDevicePixelRatioScaled: + val = 1 * QPaintDevice::devicePixelRatioFScale(); + break; default: qWarning("QPrinter::metric: Invalid metric command"); return 0; diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 81c8fbe229..7fc51f4262 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -87,7 +87,7 @@ QT_BEGIN_NAMESPACE about the underlying files and directories related to items in the model. Directories can be created and removed using mkdir(), rmdir(). - \note QFileSystemModel requires an instance of a GUI application. + \note QFileSystemModel requires an instance of \l QApplication. \section1 Example Usage diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp index 58e586980f..1546037c2c 100644 --- a/src/widgets/itemviews/qdirmodel.cpp +++ b/src/widgets/itemviews/qdirmodel.cpp @@ -212,7 +212,7 @@ void QDirModelPrivate::invalidate() Directories can be created and removed using mkdir(), rmdir(), and the model will be automatically updated to take the changes into account. - \note QDirModel requires an instance of a GUI application. + \note QDirModel requires an instance of \l QApplication. \sa nameFilters(), setFilter(), filter(), QListView, QTreeView, QFileSystemModel, {Dir View Example}, {Model Classes} diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index e8062e9f9e..cf81f53ad0 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5237,6 +5237,13 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm) return result; } +#ifndef QT_NO_IMAGEFORMAT_PNG +static inline QString clearText16IconPath() +{ + return QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png"); +} +#endif // !QT_NO_IMAGEFORMAT_PNG + static QIcon clearTextIcon(bool rtl) { const QString directionalThemeName = rtl @@ -5249,7 +5256,7 @@ static QIcon clearTextIcon(bool rtl) QIcon icon; #ifndef QT_NO_IMAGEFORMAT_PNG - QPixmap clearText16(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png")); + QPixmap clearText16(clearText16IconPath()); Q_ASSERT(!clearText16.size().isEmpty()); icon.addPixmap(clearText16); QPixmap clearText32(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-32.png")); @@ -5564,6 +5571,8 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png")); case SP_MediaVolumeMuted: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png")); + case SP_LineEditClearButton: + return QPixmap(clearText16IconPath()); #endif // QT_NO_IMAGEFORMAT_PNG default: break; diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 8229028dac..d664727d89 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -811,7 +811,8 @@ void QDockWidgetPrivate::endDrag(bool abort) } else { setResizerActive(false); } - undockedGeometry = q->geometry(); + if (q->isFloating()) // Might not be floating when dragging a QDockWidgetGroupWindow + undockedGeometry = q->geometry(); q->activateWindow(); } else { // The tab was not plugged back in the QMainWindow but the QDockWidget cannot diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index f86244172d..f7d4f780ac 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -1717,10 +1717,20 @@ QMenu *QMainWindow::createPopupMenu() menu = new QMenu(this); for (int i = 0; i < dockwidgets.size(); ++i) { QDockWidget *dockWidget = dockwidgets.at(i); - if (dockWidget->parentWidget() == this - && !d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty()) { - menu->addAction(dockwidgets.at(i)->toggleViewAction()); + // filter to find out if we own this QDockWidget + if (dockWidget->parentWidget() == this) { + if (d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty()) + continue; + } else if (QDockWidgetGroupWindow *dwgw = + qobject_cast<QDockWidgetGroupWindow *>(dockWidget->parentWidget())) { + if (dwgw->parentWidget() != this) + continue; + if (dwgw->layoutInfo()->indexOf(dockWidget).isEmpty()) + continue; + } else { + continue; } + menu->addAction(dockwidgets.at(i)->toggleViewAction()); } menu->addSeparator(); } diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 6c05887705..b2c7225e8a 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2380,13 +2380,10 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos) QWidget *w = qobject_cast<QWidget*>(c); if (!w) continue; - if (w == widget) - continue; - if (!w->isTopLevel() || !w->isVisible() || w->isMinimized()) - continue; if (!qobject_cast<QDockWidget*>(w) && !qobject_cast<QDockWidgetGroupWindow *>(w)) continue; - candidates << w; + if (w != widget && w->isTopLevel() && w->isVisible() && !w->isMinimized()) + candidates << w; if (QDockWidgetGroupWindow *group = qobject_cast<QDockWidgetGroupWindow *>(w)) { // Sometimes, there are floating QDockWidget that have a QDockWidgetGroupWindow as a parent. foreach (QObject *c, group->children()) { |