From 313c3cabe41001c19fa1db725db605ec95781cd4 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 5 Jul 2017 13:33:13 +0200 Subject: Prevent qmake to run moc on qobjectdefs.h Change-Id: Ic453c88c36cbeb24f3dc4fa6b6b20aabe5d24e09 Reviewed-by: Oswald Buddenhagen --- src/corelib/kernel/qobjectdefs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index ea4046df55..cec822ad14 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -206,6 +206,7 @@ private: \ QT_ANNOTATE_CLASS(qt_qgadget, "") \ /*end*/ +/* qmake ignore Q_NAMESPACE */ #define Q_NAMESPACE \ extern const QMetaObject staticMetaObject; \ QT_ANNOTATE_CLASS(qt_qnamespace, "") \ -- cgit v1.2.3 From 7d42293d2fcf466ebf2c99f49b4d15a73947691e Mon Sep 17 00:00:00 2001 From: Michael Winkelmann Date: Wed, 5 Jul 2017 14:43:30 +0200 Subject: QVariant: Print a warning when deserialized user type is unknown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The deserialized user type is now shown to the user to figure which QMetaType registration is missing. Change-Id: I4b7624827e479b1bea67065ce3542183b7355165 Reviewed-by: Jędrzej Nowacki --- src/corelib/kernel/qvariant.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 17c94e4e9d..f114a84d22 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2070,6 +2070,7 @@ void QVariant::load(QDataStream &s) typeId = QMetaType::type(name.constData()); if (typeId == QMetaType::UnknownType) { s.setStatus(QDataStream::ReadCorruptData); + qWarning("QVariant::load: unknown user type with name %s.", name.constData()); return; } } -- cgit v1.2.3 From 35096261282bfb2d66373d290dfa35b993158bb8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 5 Jul 2017 21:52:52 -0700 Subject: QDeadlineTimer: round milliseconds up instead of down Code like: QElapsedTimer timer; timer.start(); QTest::qWait(30); QVERIFY(timer.elapsed() >= 30); is failing, because qWait sleeps in increments of 10 ms and the last chunk may be off by less than one millisecond, so we end up sleeping too little and thus returning before 30 ms have elapsed. This matches the QElapsedTimer::elapsed() code that rounds down: return nsecsElapsed() / Q_INT64_C(1000000); Task-number: QTBUG-61741 Change-Id: Ic3a088f9f08a4fd7ae91fffd14cea4a91d3f51a8 Reviewed-by: Allan Sandfeld Jensen --- src/corelib/kernel/qdeadlinetimer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp index a2ec813f11..ae4ffdcefc 100644 --- a/src/corelib/kernel/qdeadlinetimer.cpp +++ b/src/corelib/kernel/qdeadlinetimer.cpp @@ -420,7 +420,7 @@ void QDeadlineTimer::setTimerType(Qt::TimerType timerType) qint64 QDeadlineTimer::remainingTime() const Q_DECL_NOTHROW { qint64 ns = remainingTimeNSecs(); - return ns <= 0 ? ns : ns / (1000 * 1000); + return ns <= 0 ? ns : (ns + 999999) / (1000 * 1000); } /*! -- cgit v1.2.3 From b3f7bea10525a0b05a61f151f684b63d66488193 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 10 Jul 2017 14:25:48 +0200 Subject: Handle conversion and comparison between qvarianthash and qvariantmap QVariant claims to be able to QVariantHash and QVariantMap, but the actual conversion implementation is missing. Task-number: QTBUG-61471 Change-Id: I0cba74642aa77dc423effed289bc7619922a89eb Reviewed-by: Thiago Macieira --- src/corelib/kernel/qvariant.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index f114a84d22..e6262124fb 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -855,6 +855,12 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) if (qstrcmp(QMetaType::typeName(d->type), "QMap") == 0) { *static_cast(result) = *static_cast *>(d->data.shared->ptr); + } else if (d->type == QVariant::Hash) { + QVariantMap *map = static_cast(result); + const QVariantHash *hash = v_cast(d); + const auto end = hash->end(); + for (auto it = hash->begin(); it != end; ++it) + map->insertMulti(it.key(), it.value()); #ifndef QT_BOOTSTRAPPED } else if (d->type == QMetaType::QJsonValue) { if (!v_cast(d)->isObject()) @@ -871,6 +877,12 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) if (qstrcmp(QMetaType::typeName(d->type), "QHash") == 0) { *static_cast(result) = *static_cast *>(d->data.shared->ptr); + } else if (d->type == QVariant::Map) { + QVariantHash *hash = static_cast(result); + const QVariantMap *map = v_cast(d); + const auto end = map->end(); + for (auto it = map->begin(); it != end; ++it) + hash->insertMulti(it.key(), it.value()); #ifndef QT_BOOTSTRAPPED } else if (d->type == QMetaType::QJsonValue) { if (!v_cast(d)->isObject()) -- cgit v1.2.3 From bdca35e8154d6a8cb2232bd32c64c9e0ba3775c4 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 12 Jul 2017 16:00:05 +0200 Subject: Fix documentation of QEvent::LanguageChange propagation The documentation claims that QGuiApplication forwards the top-level windows. However this appears to be a search & replace mistake from the QApplication <> QGuiApplication separation times. Only QApplication forwards the event to top-level widgets and changeEvent() is a virtual method of QWidget. Nothing is implemented for plain QGuiApplication and QWindow. Change-Id: I71b05ecebc90f7c28e150590764438ebaa90e88f Reviewed-by: Michael Brasser --- src/corelib/kernel/qcoreapplication.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/kernel') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 39e7c71a9c..cba279c184 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1896,8 +1896,8 @@ void QCoreApplication::quit() Installing or removing a QTranslator, or changing an installed QTranslator generates a \l{QEvent::LanguageChange}{LanguageChange} event for the - QCoreApplication instance. A QGuiApplication instance will propagate the event - to all toplevel windows, where a reimplementation of changeEvent can + QCoreApplication instance. A QApplication instance will propagate the event + to all toplevel widgets, where a reimplementation of changeEvent can re-translate the user interface by passing user-visible strings via the tr() function to the respective property setters. User-interface classes generated by Qt Designer provide a \c retranslateUi() function that can be -- cgit v1.2.3