Merge remote-tracking branch 'origin/5.6' into 5.7

Conflicts:
	configure
	src/plugins/platforms/winrt/qwinrtclipboard.cpp

Change-Id: Ic6d58be3d1ed2bb507f2ba06c82361afd9f9ddb9
This commit is contained in:
Liang Qi 2016-08-29 08:13:40 +02:00
commit cc74452d6d
20 changed files with 100 additions and 26 deletions

6
configure vendored
View File

@ -4238,8 +4238,12 @@ compileTest()
if [ "$CFG_SHARED" = "no" ]; then if [ "$CFG_SHARED" = "no" ]; then
test_config="$QMAKE_CONFIG static" test_config="$QMAKE_CONFIG static"
fi fi
TEST_CONFIG_FLAGS=
if [ -z "$PKG_CONFIG" ]; then
TEST_CONFIG_FLAGS="QT_CONFIG+=no-pkg-config"
fi
echo $ECHO_N "checking for $name... $ECHO_C" echo $ECHO_N "checking for $name... $ECHO_C"
"$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" "$CFG_QMAKE_PATH" "$QTCONFFILE" $I_FLAGS $D_FLAGS $L_FLAGS "$@" "$unixtests/compile.test" "$XQMAKESPEC" "$test_config" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" "$CFG_QMAKE_PATH" "$QTCONFFILE" $I_FLAGS $D_FLAGS $L_FLAGS $TEST_CONFIG_FLAGS "$@"
} }
compileTestWithPkgConfig() compileTestWithPkgConfig()

View File

@ -22,7 +22,9 @@
</Properties> </Properties>
<Dependencies> <Dependencies>
<TargetDeviceFamily Name=\"Windows.Universal\" MinVersion=\"10.0.10586.0\" MaxVersionTested=\"10.0.10586.0\" />$${WINRT_MANIFEST.dependencies} <TargetDeviceFamily Name=\"Windows.Universal\"
MinVersion=\"$${WINRT_MANIFEST.minVersion}\"
MaxVersionTested=\"$${WINRT_MANIFEST.maxVersionTested}\" />$${WINRT_MANIFEST.dependencies}
</Dependencies> </Dependencies>
<Resources> <Resources>

View File

@ -69,10 +69,10 @@ warnings_are_errors:warning_clean {
# compiler. # compiler.
clang:!ios { clang:!ios {
# Apple clang 4.0-4.2,5.0-5.1,6.0-6.4 # Apple clang 4.0-4.2,5.0-5.1,6.0-6.4
# Regular clang 3.3-3.8 # Regular clang 3.3-3.9
apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION} apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION}
reg_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION} reg_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION}
contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]")|contains(reg_ver, "3\\.[3-8]") { contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]")|contains(reg_ver, "3\\.[3-9]") {
QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=\\$${LITERAL_HASH}warnings -Wno-error=deprecated-declarations $$WERROR QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=\\$${LITERAL_HASH}warnings -Wno-error=deprecated-declarations $$WERROR
} }
} else:intel_icc:linux { } else:intel_icc:linux {

View File

@ -31,6 +31,8 @@
# WINRT_MANIFEST.capabilities: Specifies capabilities to add to the capability list. # WINRT_MANIFEST.capabilities: Specifies capabilities to add to the capability list.
# WINRT_MANIFEST.capabilities_device: Specifies device capabilities to add to the capability list. (location, webcam...) # WINRT_MANIFEST.capabilities_device: Specifies device capabilities to add to the capability list. (location, webcam...)
# WINRT_MANIFEST.dependencies: Specifies dependencies required by the package. # WINRT_MANIFEST.dependencies: Specifies dependencies required by the package.
# WINRT_MANIFEST.minVersion: Specifies the minimum required Windows version to run the package. Defaults to %UCRTVersion%
# WINRT_MANIFEST.maxVersionTested: Specifies the maximum Windows version the package has been tested against. Defaults to WINRT_MANIFEST.minVersion
# The manifest is generated for each build pass for normal apps, and only once for vcapps. # The manifest is generated for each build pass for normal apps, and only once for vcapps.
# - Normal apps have their package root directory in the same place as the target (one for each build pass). # - Normal apps have their package root directory in the same place as the target (one for each build pass).
@ -91,6 +93,11 @@
isEmpty(WINRT_MANIFEST.background): WINRT_MANIFEST.background = green isEmpty(WINRT_MANIFEST.background): WINRT_MANIFEST.background = green
isEmpty(WINRT_MANIFEST.foreground): WINRT_MANIFEST.foreground = light isEmpty(WINRT_MANIFEST.foreground): WINRT_MANIFEST.foreground = light
isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en
*-msvc2015 {
isEmpty(WINRT_MANIFEST.minVersion): WINRT_MANIFEST.minVersion = $$(UCRTVersion)
isEmpty(WINRT_MANIFEST.minVersion): error("No UCRTVersion found in environment."))
isEmpty(WINRT_MANIFEST.maxVersionTested): WINRT_MANIFEST.maxVersionTested = $$WINRT_MANIFEST.minVersion
}
INDENT = "$$escape_expand(\\r\\n) " INDENT = "$$escape_expand(\\r\\n) "

View File

@ -2693,6 +2693,13 @@
\row \row
\li version \li version
\li The version number of the package. Defaults to \c{1.0.0.0}. \li The version number of the package. Defaults to \c{1.0.0.0}.
\row
\li minVersion
\li The minimum required Windows version to run the package. Defaults to the environment variable \c UCRTVersion.
\row
\li maxVersionTested
\li The maximum Windows version the package has been tested against. Defaults to \c WINRT_MANIFEST.minVersion
\endtable \endtable
You can use any combination of those values. You can use any combination of those values.

View File

@ -183,7 +183,7 @@ void QOffscreenSurface::create()
if (QThread::currentThread() != qGuiApp->thread()) if (QThread::currentThread() != qGuiApp->thread())
qWarning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures."); qWarning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures.");
d->offscreenWindow = new QWindow(d->screen); 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. // 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. // The QOffscreenSurface has to be usable even after exiting the event loop.
QGuiApplicationPrivate::window_list.removeOne(d->offscreenWindow); QGuiApplicationPrivate::window_list.removeOne(d->offscreenWindow);

View File

@ -5753,9 +5753,9 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int
dg = gamma[dg]; dg = gamma[dg];
db = gamma[db]; db = gamma[db];
int nr = qt_div_255((sr - dr) * mr) + dr; int nr = qt_div_255(sr * mr + dr * (255 - mr));
int ng = qt_div_255((sg - dg) * mg) + dg; int ng = qt_div_255(sg * mg + dg * (255 - mg));
int nb = qt_div_255((sb - db) * mb) + db; int nb = qt_div_255(sb * mb + db * (255 - mb));
nr = invgamma[nr]; nr = invgamma[nr];
ng = invgamma[ng]; ng = invgamma[ng];
@ -5780,9 +5780,9 @@ static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, in
int alpha = coverage; int alpha = coverage;
int ialpha = 255 - alpha; int ialpha = 255 - alpha;
int nr = (sr * alpha + ialpha * dr) / 255; int nr = qt_div_255(sr * alpha + dr * ialpha);
int ng = (sg * alpha + ialpha * dg) / 255; int ng = qt_div_255(sg * alpha + dg * ialpha);
int nb = (sb * alpha + ialpha * db) / 255; int nb = qt_div_255(sb * alpha + db * ialpha);
nr = invgamma[nr]; nr = invgamma[nr];
ng = invgamma[ng]; ng = invgamma[ng];

View File

@ -760,6 +760,7 @@ static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) {
return t; 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 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; } static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; }

View File

@ -1315,7 +1315,7 @@ QTextCursor QTextDocument::find(const QString &subString, int from, FindFlags op
//do not include the character given in the position. //do not include the character given in the position.
if (options & FindBackward) { if (options & FindBackward) {
--pos ; --pos ;
if (pos < subString.size()) if (pos < 0)
return QTextCursor(); return QTextCursor();
} }

View File

@ -110,12 +110,12 @@
To close the socket, call disconnectFromHost(). QAbstractSocket enters To close the socket, call disconnectFromHost(). QAbstractSocket enters
QAbstractSocket::ClosingState. After all pending data has been written to QAbstractSocket::ClosingState. After all pending data has been written to
the socket, QAbstractSocket actually closes the socket, enters the socket, QAbstractSocket actually closes the socket, enters
QAbstractSocket::ClosedState, and emits disconnected(). If you want to QAbstractSocket::UnconnectedState, and emits disconnected(). If you want
abort a connection immediately, discarding all pending data, call abort() to abort a connection immediately, discarding all pending data, call
instead. If the remote host closes the connection, QAbstractSocket will abort() instead. If the remote host closes the connection,
emit error(QAbstractSocket::RemoteHostClosedError), during which the socket QAbstractSocket will emit error(QAbstractSocket::RemoteHostClosedError),
state will still be ConnectedState, and then the disconnected() signal during which the socket state will still be ConnectedState, and then the
will be emitted. disconnected() signal will be emitted.
The port and address of the connected peer is fetched by calling The port and address of the connected peer is fetched by calling
peerPort() and peerAddress(). peerName() returns the host name of peerPort() and peerAddress(). peerName() returns the host name of

View File

@ -59,6 +59,7 @@ typedef IEventHandler<IInspectable *> ContentChangedHandler;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QWinRTClipboard::QWinRTClipboard() QWinRTClipboard::QWinRTClipboard()
: m_mimeData(Q_NULLPTR)
{ {
#ifndef Q_OS_WINPHONE #ifndef Q_OS_WINPHONE
QEventDispatcherWinRT::runOnXamlThread([this]() { QEventDispatcherWinRT::runOnXamlThread([this]() {
@ -103,9 +104,16 @@ QMimeData *QWinRTClipboard::mimeData(QClipboard::Mode mode)
const wchar_t *textStr = result.GetRawBuffer(&size); const wchar_t *textStr = result.GetRawBuffer(&size);
QString text = QString::fromWCharArray(textStr, size); QString text = QString::fromWCharArray(textStr, size);
text.replace(QLatin1String("\r\n"), QLatin1String("\n")); 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 #else // Q_OS_WINPHONE
return QPlatformClipboard::mimeData(mode); return QPlatformClipboard::mimeData(mode);
#endif // Q_OS_WINPHONE #endif // Q_OS_WINPHONE
@ -146,6 +154,12 @@ void QWinRTClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
return; return;
#ifndef Q_OS_WINPHONE #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(); const QString text = data ? data->text() : QString();
HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([this, text]() { HRESULT hr = QEventDispatcherWinRT::runOnXamlThread([this, text]() {
HRESULT hr; HRESULT hr;
@ -164,7 +178,6 @@ void QWinRTClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
return S_OK; return S_OK;
}); });
RETURN_VOID_IF_FAILED("Could not set clipboard text."); RETURN_VOID_IF_FAILED("Could not set clipboard text.");
emitChanged(mode);
#else // Q_OS_WINPHONE #else // Q_OS_WINPHONE
QPlatformClipboard::setMimeData(data, mode); QPlatformClipboard::setMimeData(data, mode);
#endif // Q_OS_WINPHONE #endif // Q_OS_WINPHONE

View File

@ -73,7 +73,7 @@ private:
#ifndef Q_OS_WINPHONE #ifndef Q_OS_WINPHONE
Microsoft::WRL::ComPtr<ABI::Windows::ApplicationModel::DataTransfer::IClipboardStatics> m_nativeClipBoard; Microsoft::WRL::ComPtr<ABI::Windows::ApplicationModel::DataTransfer::IClipboardStatics> m_nativeClipBoard;
#endif #endif
QMimeData m_mimeData; QMimeData *m_mimeData;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -111,6 +111,9 @@ bool QWinRTMessageDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModa
Q_D(QWinRTMessageDialogHelper); Q_D(QWinRTMessageDialogHelper);
QSharedPointer<QMessageDialogOptions> options = this->options(); QSharedPointer<QMessageDialogOptions> options = this->options();
if (!options.data())
return false;
const QString informativeText = options->informativeText(); const QString informativeText = options->informativeText();
const QString title = options->windowTitle(); const QString title = options->windowTitle();
const QString text = informativeText.isEmpty() ? options->text() : (options->text() + QLatin1Char('\n') + informativeText); const QString text = informativeText.isEmpty() ? options->text() : (options->text() + QLatin1Char('\n') + informativeText);

View File

@ -3,6 +3,8 @@ QT += core-private gui-private platformsupport-private xcb_qpa_lib-private
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/../ INCLUDEPATH += $$PWD/../
load(qt_build_paths)
# needed by Xcursor ... # needed by Xcursor ...
contains(QT_CONFIG, xcb-xlib) { contains(QT_CONFIG, xcb-xlib) {
DEFINES += XCB_USE_XLIB DEFINES += XCB_USE_XLIB

View File

@ -38,6 +38,8 @@ HEADERS = \
qxcbxsettings.h \ qxcbxsettings.h \
qxcbsystemtraytracker.h qxcbsystemtraytracker.h
load(qt_build_paths)
DEFINES += QT_BUILD_XCB_PLUGIN DEFINES += QT_BUILD_XCB_PLUGIN
# needed by Xcursor ... # needed by Xcursor ...
contains(QT_CONFIG, xcb-xlib) { contains(QT_CONFIG, xcb-xlib) {

View File

@ -2180,7 +2180,8 @@ QColor QColorDialog::getColor(const QColor &initial, QWidget *parent, const QStr
QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent) 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; QRgb result = color.isValid() ? color.rgba() : initial;
if (ok) if (ok)
*ok = color.isValid(); *ok = color.isValid();

View File

@ -10372,14 +10372,13 @@ void QWidgetPrivate::setWindowFlags(Qt::WindowFlags flags)
// the old type was a window and/or the new type is a window // the old type was a window and/or the new type is a window
QPoint oldPos = q->pos(); QPoint oldPos = q->pos();
bool visible = q->isVisible(); bool visible = q->isVisible();
const bool windowFlagChanged = (q->data->window_flags ^ flags) & Qt::Window;
q->setParent(q->parentWidget(), flags); q->setParent(q->parentWidget(), flags);
// if both types are windows or neither of them are, we restore // if both types are windows or neither of them are, we restore
// the old position // the old position
if (!((q->data->window_flags ^ flags) & Qt::Window) if (!windowFlagChanged && (visible || q->testAttribute(Qt::WA_Moved)))
&& (visible || q->testAttribute(Qt::WA_Moved))) {
q->move(oldPos); q->move(oldPos);
}
// for backward-compatibility we change Qt::WA_QuitOnClose attribute value only when the window was recreated. // for backward-compatibility we change Qt::WA_QuitOnClose attribute value only when the window was recreated.
adjustQuitOnCloseAttribute(); adjustQuitOnCloseAttribute();
} else { } else {

View File

@ -1089,6 +1089,8 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
} }
d->edit->event(event); d->edit->event(event);
if (!d->edit->text().isEmpty())
d->cleared = false;
if (!isVisible()) if (!isVisible())
d->ignoreUpdateEdit = true; d->ignoreUpdateEdit = true;
} }

View File

@ -314,6 +314,8 @@ void tst_QTextDocument::find_data()
<< 15 << 6 << 11; << 15 << 6 << 11;
QTest::newRow("nbsp") << "Hello" + QString(QChar(QChar::Nbsp)) +"World" << " " << int(QTextDocument::FindCaseSensitively) << 0 << 5 << 6; QTest::newRow("nbsp") << "Hello" + QString(QChar(QChar::Nbsp)) +"World" << " " << int(QTextDocument::FindCaseSensitively) << 0 << 5 << 6;
QTest::newRow("from-the-end") << "Hello World" << "Hello World" << int(QTextDocument::FindCaseSensitively| QTextDocument::FindBackward) << 11 << 0 << 11;
} }
void tst_QTextDocument::find() void tst_QTextDocument::find()

View File

@ -138,6 +138,8 @@ private slots:
void positiveSign(); void positiveSign();
void interpretOnLosingFocus();
void setGroupSeparatorShown_data(); void setGroupSeparatorShown_data();
void setGroupSeparatorShown(); void setGroupSeparatorShown();
@ -1145,6 +1147,33 @@ void tst_QSpinBox::positiveSign()
QCOMPARE(spinBox.text(), QLatin1String("+20")); QCOMPARE(spinBox.text(), QLatin1String("+20"));
} }
void tst_QSpinBox::interpretOnLosingFocus()
{
// QTBUG-55249: When typing an invalid value after QSpinBox::clear(),
// it should be fixed up on losing focus.
static const int minimumValue = 10;
static const int maximumValue = 20;
QWidget widget;
widget.setWindowTitle(QTest::currentTestFunction());
QVBoxLayout *layout = new QVBoxLayout(&widget);
QLineEdit *focusDummy = new QLineEdit("focusDummy", &widget);
layout->addWidget(focusDummy);
SpinBox *spinBox = new SpinBox(&widget);
spinBox->setRange(minimumValue, maximumValue);
spinBox->setValue(minimumValue);
layout->addWidget(spinBox);
spinBox->clear();
spinBox->setFocus();
widget.show();
QVERIFY(QTest::qWaitForWindowActive(&widget));
QTest::keyClick(spinBox, Qt::Key_1); // Too small
focusDummy->setFocus();
QCOMPARE(spinBox->value(), minimumValue);
QCOMPARE(spinBox->lineEdit()->text().toInt(), minimumValue);
}
void tst_QSpinBox::setGroupSeparatorShown_data() void tst_QSpinBox::setGroupSeparatorShown_data()
{ {
QTest::addColumn<QLocale::Language>("lang"); QTest::addColumn<QLocale::Language>("lang");