Merge "Merge remote-tracking branch 'origin/5.14' into 5.15"

bb10
Qt Forward Merge Bot 2020-02-06 01:00:58 +01:00 committed by Edward Welbourne
commit d37f58e75b
13 changed files with 126 additions and 24 deletions

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2013 Aleix Pol Gonzalez <aleixpol@kde.org>
** Contact: https://www.qt.io/licensing/
**
@ -109,6 +109,11 @@ void QCollatorPrivate::cleanup()
int QCollator::compare(QStringView s1, QStringView s2) const
{
if (!s1.size())
return s2.size() ? -1 : 0;
if (!s2.size())
return +1;
if (d->dirty)
d->init();

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Aleix Pol Gonzalez <aleixpol@kde.org>
** Copyright (C) 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -94,6 +94,11 @@ void QCollatorPrivate::cleanup()
int QCollator::compare(QStringView s1, QStringView s2) const
{
if (!s1.size())
return s2.size() ? -1 : 0;
if (!s2.size())
return +1;
if (d->dirty)
d->init();
if (!d->collator)

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Aleix Pol Gonzalez <aleixpol@kde.org>
** Copyright (C) 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -75,6 +75,11 @@ static void stringToWCharArray(QVarLengthArray<wchar_t> &ret, QStringView string
int QCollator::compare(QStringView s1, QStringView s2) const
{
if (!s1.size())
return s2.size() ? -1 : 0;
if (!s2.size())
return +1;
if (d->isC())
return s1.compare(s2, caseSensitivity());
if (d->dirty)

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Aleix Pol Gonzalez <aleixpol@kde.org>
** Copyright (C) 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -89,6 +89,11 @@ void QCollatorPrivate::cleanup()
int QCollator::compare(QStringView s1, QStringView s2) const
{
if (!s1.size())
return s2.size() ? -1 : 0;
if (!s2.size())
return +1;
if (d->isC())
return s1.compare(s2, d->caseSensitivity);

View File

@ -219,7 +219,8 @@ int QDateTimeParser::absoluteMax(int s, const QDateTime &cur) const
const SectionNode &sn = sectionNode(s);
switch (sn.type) {
#if QT_CONFIG(timezone)
case TimeZoneSection: return QTimeZone::MaxUtcOffsetSecs;
case TimeZoneSection:
return QTimeZone::MaxUtcOffsetSecs;
#endif
case Hour24Section:
case Hour12Section:
@ -227,20 +228,25 @@ int QDateTimeParser::absoluteMax(int s, const QDateTime &cur) const
// We want it to be 23 for the stepBy case.
return 23;
case MinuteSection:
case SecondSection: return 59;
case MSecSection: return 999;
case SecondSection:
return 59;
case MSecSection:
return 999;
case YearSection2Digits:
case YearSection:
// sectionMaxSize will prevent people from typing in a larger number in
// count == 2 sections; stepBy() will work on real years anyway.
return 9999;
case MonthSection: return calendar.maximumMonthsInYear();
case MonthSection:
return calendar.maximumMonthsInYear();
case DaySection:
case DayOfWeekSectionShort:
case DayOfWeekSectionLong:
return cur.isValid() ? cur.date().daysInMonth(calendar) : calendar.maximumDaysInMonth();
case AmPmSection: return 1;
default: break;
case AmPmSection:
return 1;
default:
break;
}
qWarning("QDateTimeParser::absoluteMax() Internal error (%ls)",
qUtf16Printable(sn.name()));
@ -620,7 +626,8 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const
switch (s) {
case FirstSection:
case NoSection:
case LastSection: return 0;
case LastSection:
return 0;
case AmPmSection: {
const int lowerMax = qMax(getAmPmText(AmText, LowerCase).size(),
@ -634,7 +641,9 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const
case Hour12Section:
case MinuteSection:
case SecondSection:
case DaySection: return 2;
case DaySection:
return 2;
case DayOfWeekSectionShort:
case DayOfWeekSectionLong:
#if !QT_CONFIG(textdate)
@ -663,11 +672,15 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const
return ret;
}
#endif
case MSecSection: return 3;
case YearSection: return 4;
case YearSection2Digits: return 2;
case MSecSection:
return 3;
case YearSection:
return 4;
case YearSection2Digits:
return 2;
case TimeZoneSection:
// Arbitrarily many tokens (each up to 14 bytes) joined with / separators:
case TimeZoneSection: return std::numeric_limits<int>::max();
return std::numeric_limits<int>::max();
case CalendarPopupSection:
case Internal:

View File

@ -110,6 +110,8 @@ public:
static AssetItem::Type fileType(const QString &filePath)
{
if (filePath.isEmpty())
return AssetItem::Type::Folder;
const QStringList paths = filePath.split(QLatin1Char('/'));
QString fullPath;
AssetItem::Type res = AssetItem::Type::Invalid;
@ -399,7 +401,8 @@ public:
private:
AAsset *m_assetFile = nullptr;
AAssetManager *m_assetManager = nullptr;
QString m_fileName;
// initialize with a name that can't be used as a file name
QString m_fileName = QLatin1String(".");
bool m_isFolder = false;
};

View File

@ -104,6 +104,7 @@ void QAndroidPlatformFileDialogHelper::exec()
void QAndroidPlatformFileDialogHelper::hide()
{
QtAndroidPrivate::unregisterActivityResultListener(this);
}
QString QAndroidPlatformFileDialogHelper::selectedNameFilter() const

View File

@ -1174,7 +1174,7 @@ void WriteInitialization::writeProperties(const QString &varName,
m_output << m_indent << "if (" << varName << "->objectName().isEmpty())\n";
break;
case Language::Python:
m_output << m_indent << "if " << varName << ".objectName():\n";
m_output << m_indent << "if not " << varName << ".objectName():\n";
break;
}
}

View File

@ -2350,7 +2350,9 @@ QWidget *QWidget::find(WId id)
*/
WId QWidget::winId() const
{
if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) {
if (!data->in_destructor
&& (!testAttribute(Qt::WA_WState_Created) || !internalWinId()))
{
#ifdef ALIEN_DEBUG
qDebug() << "QWidget::winId: creating native window for" << this;
#endif

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -105,6 +105,8 @@ void tst_QCollator::compare_data()
QTest::newRow("english6") << QString("en_US") << QString("test 9") << QString("test_19") << -1 << -1 << true << true << -1;
QTest::newRow("english7") << QString("en_US") << QString("test_19") << QString("test 19") << 1 << 1 << true << false << 1;
QTest::newRow("english8") << QString("en_US") << QString("test.19") << QString("test,19") << 1 << 1 << true << true << 0;
QTest::newRow("en-empty-word") << QString("en_US") << QString() << QString("non-empty") << -1 << -1 << false << true << -1;
QTest::newRow("en-empty-number") << QString("en_US") << QString() << QString("42") << -1 << -1 << true << true << -1;
/*
In Swedish, a with ring above (E5) comes before a with
@ -119,6 +121,8 @@ void tst_QCollator::compare_data()
QTest::newRow("swedish6") << QString("sv_SE") << QString("Test 9") << QString("Test_19") << -1 << -1 << true << true << -1;
QTest::newRow("swedish7") << QString("sv_SE") << QString("test_19") << QString("test 19") << 1 << 1 << true << false << 1;
QTest::newRow("swedish8") << QString("sv_SE") << QString("test.19") << QString("test,19") << 1 << 1 << true << true << 0;
QTest::newRow("sv-empty-word") << QString("sv_SE") << QString() << QString("mett") << -1 << -1 << false << true << -1;
QTest::newRow("sv-empty-number") << QString("sv_SE") << QString() << QString("42") << -1 << -1 << true << true << -1;
/*
@ -133,6 +137,8 @@ void tst_QCollator::compare_data()
QTest::newRow("norwegian6") << QString("no_NO") << QString("Test 9") << QString("Test_19") << -1 << -1 << true << true << -1;
QTest::newRow("norwegian7") << QString("no_NO") << QString("test_19") << QString("test 19") << 1 << 1 << true << false << 1;
QTest::newRow("norwegian8") << QString("no_NO") << QString("test.19") << QString("test,19") << 1 << 1 << true << true << 0;
QTest::newRow("nb-empty-word") << QString("nb_NO") << QString() << QString("mett") << -1 << -1 << false << true << -1;
QTest::newRow("nb-empty-number") << QString("nb_NO") << QString() << QString("42") << -1 << -1 << true << true << -1;
/*
In German, z comes *after* a with diaresis (E4),
@ -151,6 +157,8 @@ void tst_QCollator::compare_data()
QTest::newRow("german11") << QString("de_DE") << QString("Test 9") << QString("Test_19") << -1 << -1 << true << true << -1;
QTest::newRow("german12") << QString("de_DE") << QString("test_19") << QString("test 19") << 1 << 1 << true << false << 1;
QTest::newRow("german13") << QString("de_DE") << QString("test.19") << QString("test,19") << 1 << 1 << true << true << 0;
QTest::newRow("de-empty-word") << QString("de_DE") << QString() << QString("satt") << -1 << -1 << false << true << -1;
QTest::newRow("de-empty-number") << QString("de_DE") << QString() << QString("42") << -1 << -1 << true << true << -1;
/*
French sorting of e and e with acute accent
@ -163,11 +171,15 @@ void tst_QCollator::compare_data()
QTest::newRow("french6") << QString("fr_FR") << QString("Test 9") << QString("Test_19") << -1 << -1 << true << true << -1;
QTest::newRow("french7") << QString("fr_FR") << QString("test_19") << QString("test 19") << 1 << 1 << true << false << 1;
QTest::newRow("french8") << QString("fr_FR") << QString("test.19") << QString("test,19") << 1 << 1 << true << true << 0;
QTest::newRow("fr-empty-word") << QString("fr_FR") << QString() << QString("plein") << -1 << -1 << false << true << -1;
QTest::newRow("fr-empty-number") << QString("fr_FR") << QString() << QString("42") << -1 << -1 << true << true << -1;
// C locale: case sensitive [A-Z] < [a-z] but case insensitive [Aa] < [Bb] <...< [Zz]
const QString C = QStringLiteral("C");
QTest::newRow("C:ABBA:AaaA") << C << QStringLiteral("ABBA") << QStringLiteral("AaaA") << -1 << 1 << false << false << 1;
QTest::newRow("C:AZa:aAZ") << C << QStringLiteral("AZa") << QStringLiteral("aAZ") << -1 << 1 << false << false << 1;
QTest::newRow("C-empty-word") << QString(C) << QString() << QString("non-empty") << -1 << -1 << false << true << -1;
QTest::newRow("C-empty-number") << QString(C) << QString() << QString("42") << -1 << -1 << true << true << -1;
}
void tst_QCollator::compare()

View File

@ -1316,9 +1316,9 @@ tst_QNetworkReply::tst_QNetworkReply()
"+socksauth", true);
} else {
#endif // !QT_NO_NETWORKPROXY
printf("==================================================================\n");
printf("Proxy could not be looked up. No proxy will be used while testing!\n");
printf("==================================================================\n");
fprintf(stderr, "==================================================================\n");
fprintf(stderr, "Proxy could not be looked up. No proxy will be used while testing!\n");
fprintf(stderr, "==================================================================\n");
#ifndef QT_NO_NETWORKPROXY
}
#endif // !QT_NO_NETWORKPROXY

View File

@ -48,7 +48,7 @@ from gammaview import GammaView
class Ui_Config(object):
def setupUi(self, Config):
if Config.objectName():
if not Config.objectName():
Config.setObjectName(u"Config")
Config.resize(600, 650)
Config.setSizeGripEnabled(True)

View File

@ -409,6 +409,8 @@ private slots:
void closeEvent();
void closeWithChildWindow();
void winIdAfterClose();
private:
bool ensureScreenSize(int width, int height);
@ -11309,5 +11311,54 @@ void tst_QWidget::closeWithChildWindow()
QVERIFY(!childWidget->isVisible());
}
class WinIdChangeSpy : public QObject
{
Q_OBJECT
public:
QWidget *widget = nullptr;
WId winId = 0;
explicit WinIdChangeSpy(QWidget *w, QObject *parent = nullptr)
: QObject(parent)
, widget(w)
, winId(widget->winId())
{
}
public slots:
bool eventFilter(QObject *obj, QEvent *event) override
{
if (obj == widget) {
if (event->type() == QEvent::WinIdChange) {
winId = widget->winId();
return true;
}
}
return false;
}
};
void tst_QWidget::winIdAfterClose()
{
auto widget = new QWidget;
auto notifier = new QObject(widget);
auto deleteWidget = new QWidget(new QWidget(widget));
auto spy = new WinIdChangeSpy(deleteWidget);
deleteWidget->installEventFilter(spy);
connect(notifier, &QObject::destroyed, [&] { delete deleteWidget; });
widget->setAttribute(Qt::WA_NativeWindow);
widget->windowHandle()->create();
widget->show();
QVERIFY(QTest::qWaitForWindowExposed(widget));
QVERIFY(spy->winId);
widget->windowHandle()->close();
delete widget;
QCOMPARE(spy->winId, WId(0));
delete spy;
}
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"