diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-29 08:13:40 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-29 08:13:40 +0200 |
commit | cc74452d6d259d36ac47c536f11a5efb269e8e44 (patch) | |
tree | e43ac89e9edde354d12fbddffcbb6e40108cc643 /src | |
parent | 6cbd982836266a59e926d8f149ad0013bd8162a3 (diff) | |
parent | e52fcb7dc78c83586c813f55f087a98bae4eaa0e (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
configure
src/plugins/platforms/winrt/qwinrtclipboard.cpp
Change-Id: Ic6d58be3d1ed2bb507f2ba06c82361afd9f9ddb9
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qoffscreensurface.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 12 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_p.h | 1 | ||||
-rw-r--r-- | src/gui/text/qtextdocument.cpp | 2 | ||||
-rw-r--r-- | src/network/socket/qabstractsocket.cpp | 12 | ||||
-rw-r--r-- | src/plugins/platforms/winrt/qwinrtclipboard.cpp | 19 | ||||
-rw-r--r-- | src/plugins/platforms/winrt/qwinrtclipboard.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp | 3 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/xcb_qpa_lib.pro | 2 | ||||
-rw-r--r-- | src/widgets/dialogs/qcolordialog.cpp | 3 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 5 | ||||
-rw-r--r-- | src/widgets/widgets/qabstractspinbox.cpp | 2 |
13 files changed, 45 insertions, 22 deletions
diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp index 41f7251277..a9535a6ad7 100644 --- a/src/gui/kernel/qoffscreensurface.cpp +++ b/src/gui/kernel/qoffscreensurface.cpp @@ -183,7 +183,7 @@ void QOffscreenSurface::create() if (QThread::currentThread() != qGuiApp->thread()) qWarning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures."); d->offscreenWindow = new QWindow(d->screen); - d->offscreenWindow->setObjectName("QOffscreenSurface"); + d->offscreenWindow->setObjectName(QLatin1String("QOffscreenSurface")); // Remove this window from the global list since we do not want it to be destroyed when closing the app. // The QOffscreenSurface has to be usable even after exiting the event loop. QGuiApplicationPrivate::window_list.removeOne(d->offscreenWindow); diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 8729640a80..30d3dee473 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5753,9 +5753,9 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int dg = gamma[dg]; db = gamma[db]; - int nr = qt_div_255((sr - dr) * mr) + dr; - int ng = qt_div_255((sg - dg) * mg) + dg; - int nb = qt_div_255((sb - db) * mb) + db; + int nr = qt_div_255(sr * mr + dr * (255 - mr)); + int ng = qt_div_255(sg * mg + dg * (255 - mg)); + int nb = qt_div_255(sb * mb + db * (255 - mb)); nr = invgamma[nr]; ng = invgamma[ng]; @@ -5780,9 +5780,9 @@ static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, in int alpha = coverage; int ialpha = 255 - alpha; - int nr = (sr * alpha + ialpha * dr) / 255; - int ng = (sg * alpha + ialpha * dg) / 255; - int nb = (sb * alpha + ialpha * db) / 255; + int nr = qt_div_255(sr * alpha + dr * ialpha); + int ng = qt_div_255(sg * alpha + dg * ialpha); + int nb = qt_div_255(sb * alpha + db * ialpha); nr = invgamma[nr]; ng = invgamma[ng]; diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 21af6039f8..fa3e6396ec 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -760,6 +760,7 @@ static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) { return t; } +// qt_div_255 is a fast rounded division by 255 using an approximation that is accurate for all positive 16-bit integers static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; } static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; } diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 723918ae69..bb44c19557 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1315,7 +1315,7 @@ QTextCursor QTextDocument::find(const QString &subString, int from, FindFlags op //do not include the character given in the position. if (options & FindBackward) { --pos ; - if (pos < subString.size()) + if (pos < 0) return QTextCursor(); } diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 5a51017264..96021f45f4 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -110,12 +110,12 @@ To close the socket, call disconnectFromHost(). QAbstractSocket enters QAbstractSocket::ClosingState. After all pending data has been written to the socket, QAbstractSocket actually closes the socket, enters - QAbstractSocket::ClosedState, and emits disconnected(). If you want to - abort a connection immediately, discarding all pending data, call abort() - instead. If the remote host closes the connection, QAbstractSocket will - emit error(QAbstractSocket::RemoteHostClosedError), during which the socket - state will still be ConnectedState, and then the disconnected() signal - will be emitted. + QAbstractSocket::UnconnectedState, and emits disconnected(). If you want + to abort a connection immediately, discarding all pending data, call + abort() instead. If the remote host closes the connection, + QAbstractSocket will emit error(QAbstractSocket::RemoteHostClosedError), + during which the socket state will still be ConnectedState, and then the + disconnected() signal will be emitted. The port and address of the connected peer is fetched by calling peerPort() and peerAddress(). peerName() returns the host name of diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.cpp b/src/plugins/platforms/winrt/qwinrtclipboard.cpp index 4eb2517e14..0a38b3df34 100644 --- a/src/plugins/platforms/winrt/qwinrtclipboard.cpp +++ b/src/plugins/platforms/winrt/qwinrtclipboard.cpp @@ -59,6 +59,7 @@ typedef IEventHandler<IInspectable *> ContentChangedHandler; QT_BEGIN_NAMESPACE QWinRTClipboard::QWinRTClipboard() + : m_mimeData(Q_NULLPTR) { #ifndef Q_OS_WINPHONE QEventDispatcherWinRT::runOnXamlThread([this]() { @@ -103,9 +104,16 @@ QMimeData *QWinRTClipboard::mimeData(QClipboard::Mode mode) const wchar_t *textStr = result.GetRawBuffer(&size); QString text = QString::fromWCharArray(textStr, size); text.replace(QLatin1String("\r\n"), QLatin1String("\n")); - m_mimeData.setText(text); - return &m_mimeData; + if (m_mimeData) { + if (m_mimeData->text() == text) + return m_mimeData; + delete m_mimeData; + } + m_mimeData = new QMimeData(); + m_mimeData->setText(text); + + return m_mimeData; #else // Q_OS_WINPHONE return QPlatformClipboard::mimeData(mode); #endif // Q_OS_WINPHONE @@ -146,6 +154,12 @@ void QWinRTClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) return; #ifndef Q_OS_WINPHONE + const bool newData = !m_mimeData || m_mimeData != data; + if (newData) { + if (m_mimeData) + delete m_mimeData; + m_mimeData = data; + } const QString text = data ? data->text() : QString(); HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([this, text]() { HRESULT hr; @@ -164,7 +178,6 @@ void QWinRTClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) return S_OK; }); RETURN_VOID_IF_FAILED("Could not set clipboard text."); - emitChanged(mode); #else // Q_OS_WINPHONE QPlatformClipboard::setMimeData(data, mode); #endif // Q_OS_WINPHONE diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.h b/src/plugins/platforms/winrt/qwinrtclipboard.h index f88a92956e..3e6ee109fd 100644 --- a/src/plugins/platforms/winrt/qwinrtclipboard.h +++ b/src/plugins/platforms/winrt/qwinrtclipboard.h @@ -73,7 +73,7 @@ private: #ifndef Q_OS_WINPHONE Microsoft::WRL::ComPtr<ABI::Windows::ApplicationModel::DataTransfer::IClipboardStatics> m_nativeClipBoard; #endif - QMimeData m_mimeData; + QMimeData *m_mimeData; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp index 3f400e1342..d69c63e9a4 100644 --- a/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp +++ b/src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp @@ -111,6 +111,9 @@ bool QWinRTMessageDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModa Q_D(QWinRTMessageDialogHelper); QSharedPointer<QMessageDialogOptions> options = this->options(); + if (!options.data()) + return false; + const QString informativeText = options->informativeText(); const QString title = options->windowTitle(); const QString text = informativeText.isEmpty() ? options->text() : (options->text() + QLatin1Char('\n') + informativeText); diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index c2d3849d8e..68cb91ff3d 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -3,6 +3,8 @@ QT += core-private gui-private platformsupport-private xcb_qpa_lib-private INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD/../ +load(qt_build_paths) + # needed by Xcursor ... contains(QT_CONFIG, xcb-xlib) { DEFINES += XCB_USE_XLIB diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index db9ea32cd8..9ca8872cb2 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -38,6 +38,8 @@ HEADERS = \ qxcbxsettings.h \ qxcbsystemtraytracker.h +load(qt_build_paths) + DEFINES += QT_BUILD_XCB_PLUGIN # needed by Xcursor ... contains(QT_CONFIG, xcb-xlib) { diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 23436d1bf0..274785660b 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -2180,7 +2180,8 @@ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QStr QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent) { - QColor color(getColor(QColor(initial), parent, QString(), ShowAlphaChannel)); + const QColor color = getColor(QColor::fromRgba(initial), parent, QString(), + ShowAlphaChannel); QRgb result = color.isValid() ? color.rgba() : initial; if (ok) *ok = color.isValid(); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index ba02728d7c..0d9cff01c4 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -10372,14 +10372,13 @@ void QWidgetPrivate::setWindowFlags(Qt::WindowFlags flags) // the old type was a window and/or the new type is a window QPoint oldPos = q->pos(); bool visible = q->isVisible(); + const bool windowFlagChanged = (q->data->window_flags ^ flags) & Qt::Window; q->setParent(q->parentWidget(), flags); // if both types are windows or neither of them are, we restore // the old position - if (!((q->data->window_flags ^ flags) & Qt::Window) - && (visible || q->testAttribute(Qt::WA_Moved))) { + if (!windowFlagChanged && (visible || q->testAttribute(Qt::WA_Moved))) q->move(oldPos); - } // for backward-compatibility we change Qt::WA_QuitOnClose attribute value only when the window was recreated. adjustQuitOnCloseAttribute(); } else { diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 5778d16456..494e30c7c7 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -1089,6 +1089,8 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) } d->edit->event(event); + if (!d->edit->text().isEmpty()) + d->cleared = false; if (!isVisible()) d->ignoreUpdateEdit = true; } |