Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: Ica3f89ace33585ad7854417a328156f5a68e2a00
This commit is contained in:
commit
fbc9fb233d
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -224,7 +224,7 @@ void Widget::updateUngroupButton()
|
||||
|
||||
CustomItem * Widget::checkedItem() const
|
||||
{
|
||||
CustomItem *item;
|
||||
CustomItem *item = nullptr;
|
||||
|
||||
if (ui->blue->isChecked())
|
||||
item = rectBlue;
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
5
tests/manual/widgets/widgets/widgets.pro
Normal file
5
tests/manual/widgets/widgets/widgets.pro
Normal file
@ -0,0 +1,5 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = bigmenucreator \
|
||||
defaultUpMenuBar \
|
||||
multiscreen-menus \
|
||||
qtoolbutton/menuOnMultiScreens
|
Loading…
x
Reference in New Issue
Block a user