Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/5.6' into 5.7
Browse files Browse the repository at this point in the history
Conflicts:
	configure
	src/plugins/platforms/winrt/qwinrtclipboard.cpp

Change-Id: Ic6d58be3d1ed2bb507f2ba06c82361afd9f9ddb9
  • Loading branch information
liangqi committed Aug 29, 2016
2 parents 6cbd982 + e52fcb7 commit cc74452
Show file tree
Hide file tree
Showing 20 changed files with 100 additions and 26 deletions.
6 changes: 5 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -4238,8 +4238,12 @@ compileTest()
if [ "$CFG_SHARED" = "no" ]; then
test_config="$QMAKE_CONFIG static"
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"
"$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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
</Properties>

<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>

<Resources>
Expand Down
4 changes: 2 additions & 2 deletions mkspecs/features/qt_common.prf
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ warnings_are_errors:warning_clean {
# compiler.
clang:!ios {
# 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}
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
}
} else:intel_icc:linux {
Expand Down
7 changes: 7 additions & 0 deletions mkspecs/features/winrt/package_manifest.prf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
# 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.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.
# - Normal apps have their package root directory in the same place as the target (one for each build pass).
Expand Down Expand Up @@ -91,6 +93,11 @@
isEmpty(WINRT_MANIFEST.background): WINRT_MANIFEST.background = green
isEmpty(WINRT_MANIFEST.foreground): WINRT_MANIFEST.foreground = light
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) "

Expand Down
7 changes: 7 additions & 0 deletions qmake/doc/src/qmake-manual.qdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2693,6 +2693,13 @@
\row
\li version
\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

You can use any combination of those values.
Expand Down
2 changes: 1 addition & 1 deletion src/gui/kernel/qoffscreensurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions src/gui/painting/qdrawhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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];
Expand Down
1 change: 1 addition & 0 deletions src/gui/painting/qdrawhelper_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down
2 changes: 1 addition & 1 deletion src/gui/text/qtextdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
12 changes: 6 additions & 6 deletions src/network/socket/qabstractsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 16 additions & 3 deletions src/plugins/platforms/winrt/qwinrtclipboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ typedef IEventHandler<IInspectable *> ContentChangedHandler;
QT_BEGIN_NAMESPACE

QWinRTClipboard::QWinRTClipboard()
: m_mimeData(Q_NULLPTR)
{
#ifndef Q_OS_WINPHONE
QEventDispatcherWinRT::runOnXamlThread([this]() {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/platforms/winrt/qwinrtclipboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class QWinRTClipboard: public QPlatformClipboard
#ifndef Q_OS_WINPHONE
Microsoft::WRL::ComPtr<ABI::Windows::ApplicationModel::DataTransfer::IClipboardStatics> m_nativeClipBoard;
#endif
QMimeData m_mimeData;
QMimeData *m_mimeData;
};

QT_END_NAMESPACE
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/platforms/winrt/qwinrtmessagedialoghelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/platforms/xcb/xcb_qpa_lib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/widgets/dialogs/qcolordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 2 additions & 3 deletions src/widgets/kernel/qwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/widgets/qabstractspinbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ void tst_QTextDocument::find_data()
<< 15 << 6 << 11;

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()
Expand Down
29 changes: 29 additions & 0 deletions tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ private slots:

void positiveSign();

void interpretOnLosingFocus();

void setGroupSeparatorShown_data();
void setGroupSeparatorShown();

Expand Down Expand Up @@ -1145,6 +1147,33 @@ void tst_QSpinBox::positiveSign()
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()
{
QTest::addColumn<QLocale::Language>("lang");
Expand Down

0 comments on commit cc74452

Please sign in to comment.