summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-09 01:00:19 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-09 01:00:20 +0100
commitfbc9fb233dfb1959924632b428048d5f6a3401d9 (patch)
treeb9c2acc3fa61789f84a78ad7144beda53ccc0570
parentcaa74f16d41ebe65e1edbea219f799cf246d6067 (diff)
parente4749e798585ffe43159fc32a10bf33843c6c5ed (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
-rw-r--r--src/corelib/tools/qcollator_win.cpp34
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp5
-rw-r--r--src/widgets/dialogs/qdialog.cpp7
-rw-r--r--src/widgets/styles/qcommonstyle.cpp25
-rw-r--r--tests/baselineserver/shared/baselineprotocol.cpp2
-rw-r--r--tests/manual/gestures/graphicsview/gestures.cpp2
-rw-r--r--tests/manual/qgraphicsitemgroup/widget.cpp2
-rw-r--r--tests/manual/qsysinfo/main.cpp22
-rw-r--r--tests/manual/qtabletevent/regular_widgets/main.cpp2
-rw-r--r--tests/manual/widgets/widgets/widgets.pro5
10 files changed, 92 insertions, 14 deletions
diff --git a/src/corelib/tools/qcollator_win.cpp b/src/corelib/tools/qcollator_win.cpp
index 35142bb8b8..10cfdaa264 100644
--- a/src/corelib/tools/qcollator_win.cpp
+++ b/src/corelib/tools/qcollator_win.cpp
@@ -72,6 +72,8 @@ void QCollatorPrivate::init()
if (caseSensitivity == Qt::CaseInsensitive)
collator |= NORM_IGNORECASE;
+ // WINE does not support SORT_DIGITSASNUMBERS :-(
+ // (and its std::sort() crashes on bad comparisons, QTBUG-74209)
if (numericMode)
collator |= SORT_DIGITSASNUMBERS;
@@ -98,16 +100,36 @@ int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) con
// Returns one of the following values if successful. To maintain the C runtime convention of
// comparing strings, the value 2 can be subtracted from a nonzero return value. Then, the
// meaning of <0, ==0, and >0 is consistent with the C runtime.
+ // [...] The function returns 0 if it does not succeed.
+ // https://docs.microsoft.com/en-us/windows/desktop/api/stringapiset/nf-stringapiset-comparestringex#return-value
#ifndef USE_COMPARESTRINGEX
- return CompareString(d->localeID, d->collator,
- reinterpret_cast<const wchar_t*>(s1), len1,
- reinterpret_cast<const wchar_t*>(s2), len2) - 2;
+ const int ret = CompareString(d->localeID, d->collator,
+ reinterpret_cast<const wchar_t*>(s1), len1,
+ reinterpret_cast<const wchar_t*>(s2), len2);
#else
- return CompareStringEx(LPCWSTR(d->localeName.utf16()), d->collator,
- reinterpret_cast<LPCWSTR>(s1), len1,
- reinterpret_cast<LPCWSTR>(s2), len2, NULL, NULL, 0) - 2;
+ const int ret = CompareStringEx(LPCWSTR(d->localeName.utf16()), d->collator,
+ reinterpret_cast<LPCWSTR>(s1), len1,
+ reinterpret_cast<LPCWSTR>(s2), len2,
+ nullptr, nullptr, 0);
#endif
+ if (Q_LIKELY(ret))
+ return ret - 2;
+
+ switch (DWORD error = GetLastError()) {
+ case ERROR_INVALID_FLAGS:
+ qWarning("Unsupported flags (%d) used in QCollator", int(d->collator));
+ break;
+ case ERROR_INVALID_PARAMETER:
+ qWarning("Invalid parameter for QCollator::compare()");
+ break;
+ default:
+ qWarning("Failed (%ld) comparison in QCollator::compare()", long(error));
+ break;
+ }
+ // We have no idea what to return, so pretend we think they're equal.
+ // At least that way we'll be consistent if we get the same values swapped ...
+ return 0;
}
int QCollator::compare(const QString &str1, const QString &str2) const
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 9df3d73dd7..f79a4d1dc6 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -967,7 +967,10 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
} else if (state != QHttpNetworkConnectionChannel::IdleState && state != QHttpNetworkConnectionChannel::ReadingState) {
// Try to reconnect/resend before sending an error.
// While "Reading" the _q_disconnected() will handle this.
- if (reconnectAttempts-- > 0) {
+ // If we're using ssl then the protocolHandler is not initialized until
+ // "encrypted" has been emitted, since retrying requires the protocolHandler (asserted)
+ // we will not try if encryption is not done.
+ if (!pendingEncrypt && reconnectAttempts-- > 0) {
resendCurrentRequest();
return;
} else {
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index 609430fba6..caab6c16ba 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -246,6 +246,13 @@ void QDialogPrivate::deletePlatformHelper()
window-system properties for the widget (in particular it will
reset the Qt::Dialog flag).
+ \note The parent relationship of the dialog does \e{not} imply
+ that the dialog will always be stacked on top of the parent
+ window. To ensure that the dialog is always on top, make the
+ dialog modal. This also applies for child windows of the dialog
+ itself. To ensure that child windows of the dialog stay on top
+ of the dialog, make the child windows modal as well.
+
\section1 Modal Dialogs
A \b{modal} dialog is a dialog that blocks input to other
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index b064b2eff2..a3461d8848 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -846,11 +846,14 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
}
#endif // QT_CONFIG(toolbutton)
-static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth)
+static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth, int maxHeight = -1, int *lastVisibleLine = nullptr)
{
+ if (lastVisibleLine)
+ *lastVisibleLine = -1;
qreal height = 0;
qreal widthUsed = 0;
textLayout.beginLayout();
+ int i = 0;
while (true) {
QTextLine line = textLayout.createLine();
if (!line.isValid())
@@ -859,6 +862,13 @@ static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth)
line.setPosition(QPointF(0, height));
height += line.height();
widthUsed = qMax(widthUsed, line.naturalTextWidth());
+ // we assume that the height of the next line is the same as the current one
+ if (maxHeight > 0 && lastVisibleLine && height + line.height() > maxHeight) {
+ const QTextLine nextLine = textLayout.createLine();
+ *lastVisibleLine = nextLine.isValid() ? i : -1;
+ break;
+ }
+ ++i;
}
textLayout.endLayout();
return QSizeF(widthUsed, height);
@@ -872,7 +882,13 @@ QString QCommonStylePrivate::calculateElidedText(const QString &text, const QTex
QTextLayout textLayout(text, font);
textLayout.setTextOption(textOption);
- viewItemTextLayout(textLayout, textRect.width());
+ // In AlignVCenter mode when more than one line is displayed and the height only allows
+ // some of the lines it makes no sense to display those. From a users perspective it makes
+ // more sense to see the start of the text instead something inbetween.
+ const bool vAlignmentOptimization = paintStartPosition && valign.testFlag(Qt::AlignVCenter);
+
+ int lastVisibleLine = -1;
+ viewItemTextLayout(textLayout, textRect.width(), vAlignmentOptimization ? textRect.height() : -1, &lastVisibleLine);
const QRectF boundingRect = textLayout.boundingRect();
// don't care about LTR/RTL here, only need the height
@@ -899,7 +915,7 @@ QString QCommonStylePrivate::calculateElidedText(const QString &text, const QTex
const int start = line.textStart();
const int length = line.textLength();
const bool drawElided = line.naturalTextWidth() > textRect.width();
- bool elideLastVisibleLine = false;
+ bool elideLastVisibleLine = lastVisibleLine == i;
if (!drawElided && i + 1 < lineCount && lastVisibleLineShouldBeElided) {
const QTextLine nextLine = textLayout.lineAt(i + 1);
const int nextHeight = height + nextLine.height() / 2;
@@ -930,7 +946,8 @@ QString QCommonStylePrivate::calculateElidedText(const QString &text, const QTex
}
// below visible text, can stop
- if (height + layoutRect.top() >= textRect.bottom())
+ if ((height + layoutRect.top() >= textRect.bottom()) ||
+ (lastVisibleLine >= 0 && lastVisibleLine == i))
break;
}
return ret;
diff --git a/tests/baselineserver/shared/baselineprotocol.cpp b/tests/baselineserver/shared/baselineprotocol.cpp
index 80e269ee2a..c9f9cd9bd2 100644
--- a/tests/baselineserver/shared/baselineprotocol.cpp
+++ b/tests/baselineserver/shared/baselineprotocol.cpp
@@ -366,7 +366,7 @@ bool BaselineProtocol::connect(const QString &testCase, bool *dryrun, const Plat
if (!socket.waitForConnected(Timeout)) {
sysSleep(3000); // Wait a bit and try again, the server might just be restarting
if (!socket.waitForConnected(Timeout)) {
- errMsg += QLS("TCP connectToHost failed. Host:") + serverName + QLS(" port:") + QString::number(ServerPort);
+ errMsg += QLS("TCP connectToHost failed. Host:") + QLS(serverName) + QLS(" port:") + QString::number(ServerPort);
return false;
}
}
diff --git a/tests/manual/gestures/graphicsview/gestures.cpp b/tests/manual/gestures/graphicsview/gestures.cpp
index cc0ff3e1aa..6e5b07bf18 100644
--- a/tests/manual/gestures/graphicsview/gestures.cpp
+++ b/tests/manual/gestures/graphicsview/gestures.cpp
@@ -44,11 +44,13 @@ QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::recognize(QGesture
switch (event->type()) {
case QEvent::TouchBegin:
result = QGestureRecognizer::MayBeGesture;
+ break;
case QEvent::TouchEnd:
if (d->gestureFired)
result = QGestureRecognizer::FinishGesture;
else
result = QGestureRecognizer::CancelGesture;
+ break;
case QEvent::TouchUpdate:
if (d->state() != Qt::NoGesture) {
QTouchEvent *ev = static_cast<QTouchEvent*>(event);
diff --git a/tests/manual/qgraphicsitemgroup/widget.cpp b/tests/manual/qgraphicsitemgroup/widget.cpp
index b0e7a47cf8..ba9ed815fa 100644
--- a/tests/manual/qgraphicsitemgroup/widget.cpp
+++ b/tests/manual/qgraphicsitemgroup/widget.cpp
@@ -224,7 +224,7 @@ void Widget::updateUngroupButton()
CustomItem * Widget::checkedItem() const
{
- CustomItem *item;
+ CustomItem *item = nullptr;
if (ui->blue->isChecked())
item = rectBlue;
diff --git a/tests/manual/qsysinfo/main.cpp b/tests/manual/qsysinfo/main.cpp
index 62d0c51416..1d39514236 100644
--- a/tests/manual/qsysinfo/main.cpp
+++ b/tests/manual/qsysinfo/main.cpp
@@ -57,6 +57,11 @@ QByteArray windowsVersionToString(QSysInfo::WinVersion v)
CASE_VERSION(WV_WINDOWS8_1);
CASE_VERSION(WV_WINDOWS10);
case QSysInfo::WV_NT_based: // shouldn't happen
+ case QSysInfo::WV_CE:
+ case QSysInfo::WV_CENET:
+ case QSysInfo::WV_CE_5:
+ case QSysInfo::WV_CE_6:
+ case QSysInfo::WV_CE_based:
break;
}
@@ -82,6 +87,7 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
CASE_VERSION(MV_10_9);
CASE_VERSION(MV_10_10);
CASE_VERSION(MV_10_11);
+ CASE_VERSION(MV_10_12);
CASE_VERSION(MV_IOS_4_3);
CASE_VERSION(MV_IOS_5_0);
@@ -96,8 +102,24 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
CASE_VERSION(MV_IOS_8_3);
CASE_VERSION(MV_IOS_8_4);
CASE_VERSION(MV_IOS_9_0);
+ CASE_VERSION(MV_IOS_9_1);
+ CASE_VERSION(MV_IOS_9_2);
+ CASE_VERSION(MV_IOS_9_3);
+ CASE_VERSION(MV_IOS_10_0);
case QSysInfo::MV_IOS: // shouldn't happen:
+ case QSysInfo::MV_TVOS:
+ case QSysInfo::MV_WATCHOS:
break;
+
+ CASE_VERSION(MV_TVOS_9_0);
+ CASE_VERSION(MV_TVOS_9_1);
+ CASE_VERSION(MV_TVOS_9_2);
+ CASE_VERSION(MV_TVOS_10_0);
+
+ CASE_VERSION(MV_WATCHOS_2_0);
+ CASE_VERSION(MV_WATCHOS_2_1);
+ CASE_VERSION(MV_WATCHOS_2_2);
+ CASE_VERSION(MV_WATCHOS_3_0);
}
if (v & QSysInfo::MV_IOS) {
diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp
index c0366dea63..4816e2f3b9 100644
--- a/tests/manual/qtabletevent/regular_widgets/main.cpp
+++ b/tests/manual/qtabletevent/regular_widgets/main.cpp
@@ -284,7 +284,7 @@ int main(int argc, char *argv[])
mainWindow.setWindowTitle(QString::fromLatin1("Tablet Test %1").arg(QT_VERSION_STR));
EventReportWidget *widget = new EventReportWidget;
QObject::connect(proximityEventFilter, &ProximityEventFilter::proximityChanged,
- widget, QOverload<void>::of(&QWidget::update));
+ widget, QOverload<>::of(&QWidget::update));
widget->setMinimumSize(640, 480);
QMenu *fileMenu = mainWindow.menuBar()->addMenu("File");
fileMenu->addAction("Clear", widget, &EventReportWidget::clearPoints);
diff --git a/tests/manual/widgets/widgets/widgets.pro b/tests/manual/widgets/widgets/widgets.pro
new file mode 100644
index 0000000000..1fccb09d79
--- /dev/null
+++ b/tests/manual/widgets/widgets/widgets.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+SUBDIRS = bigmenucreator \
+ defaultUpMenuBar \
+ multiscreen-menus \
+ qtoolbutton/menuOnMultiScreens