diff --git a/mkspecs/common/g++-win32.conf b/mkspecs/common/g++-win32.conf index 6369436863..c3a1f3a373 100644 --- a/mkspecs/common/g++-win32.conf +++ b/mkspecs/common/g++-win32.conf @@ -17,7 +17,7 @@ include(g++-base.conf) MAKEFILE_GENERATOR = MINGW QMAKE_PLATFORM = win32 mingw -CONFIG += precompile_header +CONFIG += debug_and_release debug_and_release_target precompile_header DEFINES += UNICODE _UNICODE WIN32 MINGW_HAS_SECURE_API=1 QMAKE_COMPILER_DEFINES += __GNUC__ _WIN32 # can't add 'DEFINES += WIN64' and 'QMAKE_COMPILER_DEFINES += _WIN64' defines for diff --git a/mkspecs/features/qt_helper_lib.prf b/mkspecs/features/qt_helper_lib.prf index 216c24c7aa..8a9672e603 100644 --- a/mkspecs/features/qt_helper_lib.prf +++ b/mkspecs/features/qt_helper_lib.prf @@ -60,7 +60,7 @@ win32|CONFIG(static, static|shared) { "QMAKE_DEFINES_$${ucmodule} = $$val_escape(MODULE_DEFINES)" android { MODULE_PRI_CONT += "QMAKE_LIBS_$${ucmodule} =" - } else: debug_and_release { + } else: qtConfig(debug_and_release): { win32: \ MODULE_DEBUG_LIBS = $$DESTDIR/$$prefix$${TARGET}d.$$suffix else: darwin: \ diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index 31ecc8b20d..aed50d6c5a 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -285,11 +285,15 @@ namespace QtPrivate { { }; + template + using is_bool = std::is_same::type>; + template struct AreArgumentsNarrowedBase::type> : std::integral_constant::value && std::is_integral::value) || (std::is_floating_point::value && std::is_floating_point::value && sizeof(From) > sizeof(To)) || + ((std::is_pointer::value || std::is_member_pointer::value) && QtPrivate::is_bool::value) || ((std::is_integral::value || std::is_enum::value) && std::is_floating_point::value) || (std::is_integral::value && std::is_integral::value && (sizeof(From) > sizeof(To) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 3ca9e9bbde..bffe1a10e0 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -663,6 +663,9 @@ glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs) QFixed ymax = 0; QFixed xmax = 0; for (int i = 0; i < glyphs.numGlyphs; i++) { + // If shaping has found this should be ignored, ignore it. + if (!glyphs.advances[i] || glyphs.attributes[i].dontPrint) + continue; glyph_metrics_t bb = boundingBox(glyphs.glyphs[i]); QFixed x = overall.xoff + glyphs.offsets[i].x + bb.x; QFixed y = overall.yoff + glyphs.offsets[i].y + bb.y; diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index ac39a8cf69..81ed8fa97a 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -712,9 +712,8 @@ struct QBidiAlgorithm { analysis[pos].bidiDirection = QChar::DirEN; ++it; } - } else { - lastETPosition.clear(); } + lastETPosition.clear(); } last = current; lastPos = pos; diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index 8273041549..e65f67d4f1 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -1678,6 +1678,9 @@ glyph_metrics_t QFontEngineFT::boundingBox(const QGlyphLayout &glyphs) QFixed ymax = 0; QFixed xmax = 0; for (int i = 0; i < glyphs.numGlyphs; i++) { + // If shaping has found this should be ignored, ignore it. + if (!glyphs.advances[i] || glyphs.attributes[i].dontPrint) + continue; Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs.glyphs[i]) : nullptr; if (!g) { if (!face) diff --git a/src/plugins/platforms/wasm/qwasmbackingstore.cpp b/src/plugins/platforms/wasm/qwasmbackingstore.cpp index 7e8a382512..6ac685083d 100644 --- a/src/plugins/platforms/wasm/qwasmbackingstore.cpp +++ b/src/plugins/platforms/wasm/qwasmbackingstore.cpp @@ -36,7 +36,7 @@ #include #include #include - +#include #include QT_BEGIN_NAMESPACE @@ -53,12 +53,29 @@ QWasmBackingStore::QWasmBackingStore(QWasmCompositor *compositor, QWindow *windo QWasmBackingStore::~QWasmBackingStore() { + auto window = this->window(); + QWasmIntegration::get()->removeBackingStore(window); + destroy(); + QWasmWindow *wasmWindow = static_cast(window->handle()); + if (wasmWindow) + wasmWindow->setBackingStore(nullptr); } void QWasmBackingStore::destroy() { - if (m_texture->isCreated()) - m_texture->destroy(); + if (m_texture->isCreated()) { + auto context = m_compositor->context(); + auto currentContext = QOpenGLContext::currentContext(); + if (!currentContext || !QOpenGLContext::areSharing(context, currentContext)) { + QOffscreenSurface offScreenSurface(m_compositor->screen()->screen()); + offScreenSurface.setFormat(context->format()); + offScreenSurface.create(); + context->makeCurrent(&offScreenSurface); + m_texture->destroy(); + } else { + m_texture->destroy(); + } + } } QPaintDevice *QWasmBackingStore::paintDevice() @@ -81,9 +98,9 @@ void QWasmBackingStore::updateTexture() if (m_dirty.isNull()) return; - if (m_recreateTexture && m_texture->isCreated()) { + if (m_recreateTexture) { m_recreateTexture = false; - m_texture->destroy(); + destroy(); } if (!m_texture->isCreated()) { diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp index e9c4559971..2f0b0414d9 100644 --- a/src/plugins/platforms/wasm/qwasmcompositor.cpp +++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp @@ -59,7 +59,6 @@ QWasmCompositedWindow::QWasmCompositedWindow() QWasmCompositor::QWasmCompositor(QWasmScreen *screen) :QObject(screen) - , m_frameBuffer(nullptr) , m_blitter(new QOpenGLTextureBlitter) , m_needComposit(false) , m_inFlush(false) @@ -71,7 +70,6 @@ QWasmCompositor::QWasmCompositor(QWasmScreen *screen) QWasmCompositor::~QWasmCompositor() { - delete m_frameBuffer; destroy(); } @@ -748,3 +746,8 @@ QWasmScreen *QWasmCompositor::screen() { return static_cast(parent()); } + +QOpenGLContext *QWasmCompositor::context() +{ + return m_context.data(); +} diff --git a/src/plugins/platforms/wasm/qwasmcompositor.h b/src/plugins/platforms/wasm/qwasmcompositor.h index 98f4a79b27..422f990175 100644 --- a/src/plugins/platforms/wasm/qwasmcompositor.h +++ b/src/plugins/platforms/wasm/qwasmcompositor.h @@ -125,11 +125,13 @@ public: static QWasmTitleBarOptions makeTitleBarOptions(const QWasmWindow *window); static QRect titlebarRect(QWasmTitleBarOptions tb, QWasmCompositor::SubControls subcontrol); + QWasmScreen *screen(); + QOpenGLContext *context(); + private slots: void frame(); private: - QWasmScreen *screen(); void notifyTopWindowChanged(QWasmWindow *window); void drawWindow(QOpenGLTextureBlitter *blitter, QWasmScreen *screen, QWasmWindow *window); void drawWindowContent(QOpenGLTextureBlitter *blitter, QWasmScreen *screen, QWasmWindow *window); @@ -138,7 +140,6 @@ private: void drawWindowDecorations(QOpenGLTextureBlitter *blitter, QWasmScreen *screen, QWasmWindow *window); void drwPanelButton(); - QImage *m_frameBuffer; QScopedPointer m_context; QScopedPointer m_blitter; diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp index 45bc49e382..4b42b5788f 100644 --- a/src/plugins/platforms/wasm/qwasmintegration.cpp +++ b/src/plugins/platforms/wasm/qwasmintegration.cpp @@ -187,6 +187,11 @@ QPlatformBackingStore *QWasmIntegration::createPlatformBackingStore(QWindow *win #endif } +void QWasmIntegration::removeBackingStore(QWindow* window) +{ + m_backingStores.remove(window); +} + #ifndef QT_NO_OPENGL QPlatformOpenGLContext *QWasmIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { diff --git a/src/plugins/platforms/wasm/qwasmintegration.h b/src/plugins/platforms/wasm/qwasmintegration.h index 08b68cb5f7..cb8639086a 100644 --- a/src/plugins/platforms/wasm/qwasmintegration.h +++ b/src/plugins/platforms/wasm/qwasmintegration.h @@ -89,6 +89,7 @@ public: void resizeScreen(const emscripten::val &canvas); void resizeAllScreens(); void updateDpi(); + void removeBackingStore(QWindow* window); private: mutable QWasmFontDatabase *m_fontDb; diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc index e77cc772e6..7736591ae9 100644 --- a/src/sql/doc/src/sql-driver.qdoc +++ b/src/sql/doc/src/sql-driver.qdoc @@ -183,7 +183,7 @@ Run the installer, select custom installation and install the MySQL C Connector which matches your Qt installation (x86 or x64). - After installation make sure that the needed files are there: + After installation check that the needed files are there: \list \li \c {/lib/libmysql.lib} \li \c {/lib/libmysql.dll} @@ -196,16 +196,20 @@ \li \c {/include/mysql.h} \endlist - Build the plugin as follows (here it is assumed that the MySQL - C Connector is installed in + \note As of MySQL 8.0.19, the C Connector is no longer offered as a standalone + installable component. Instead, you can get \c{mysql.h} and \c{libmysql.*} by + installing the full MySQL Server (x64 only) or the + \l{https://downloads.mariadb.org/connector-c/}{MariaDB C Connector}. + + Build the plugin as follows (here it is assumed that \c{} is \c{C:/Program Files/MySQL/MySQL Connector C 6.1}): \snippet code/doc_src_sql-driver.qdoc 5 If you are not using a Microsoft compiler, replace \c nmake with \c - mingw32-make in the line above. + mingw32-make above. - When you distribute your application, remember to include libmysql.dll / libmariadb.dll + When you distribute your application, remember to include \e libmysql.dll / \e libmariadb.dll in your installation package. It must be placed in the same folder as the application executable. \e libmysql.dll additionally needs the MSVC runtime libraries which can be installed with diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index c89cef99b5..c52bb89f28 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -677,7 +677,8 @@ void QDateTimeEdit::setTimeRange(const QTime &min, const QTime &max) \brief The currently displayed fields of the date time edit. Returns a bit set of the displayed sections for this format. - \a setDisplayFormat(), displayFormat() + + \sa setDisplayFormat(), displayFormat() */ QDateTimeEdit::Sections QDateTimeEdit::displayedSections() const @@ -690,7 +691,8 @@ QDateTimeEdit::Sections QDateTimeEdit::displayedSections() const \property QDateTimeEdit::currentSection \brief The current section of the spinbox. - \a setCurrentSection() + + \sa setCurrentSection() */ QDateTimeEdit::Section QDateTimeEdit::currentSection() const @@ -770,8 +772,7 @@ int QDateTimeEdit::sectionCount() const the cursorPosition is 5, currentSectionIndex returns 1. If the cursorPosition is 3, currentSectionIndex is 0, and so on. - \a setCurrentSection() - \sa currentSection() + \sa setCurrentSection(), currentSection() */ int QDateTimeEdit::currentSectionIndex() const diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 675f09d283..06b40f9644 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -1200,8 +1200,8 @@ QMargins QLineEdit::textMargins() const The input mask is an input template string. It can contain the following elements: \table - \row \li Mask Characters \li Defines the class of input characters that are - considered valid in this position + \row \li Mask Characters \li Defines the \l {QChar::} {Category} of input characters + that are considered valid in this position \row \li Meta Characters \li Various special meanings \row \li Separators \li All other characters are regarded as immutable separators \endtable @@ -1210,17 +1210,21 @@ QMargins QLineEdit::textMargins() const \table \header \li Mask Character \li Meaning - \row \li \c A \li ASCII alphabetic character required. A-Z, a-z. - \row \li \c a \li ASCII alphabetic character permitted but not required. - \row \li \c N \li ASCII alphanumeric character required. A-Z, a-z, 0-9. - \row \li \c n \li ASCII alphanumeric character permitted but not required. + \row \li \c A \li character of the Letter category required, such as A-Z, a-z. + \row \li \c a \li character of the Letter category permitted but not required. + \row \li \c N \li character of the Letter or Number category required, such as + A-Z, a-z, 0-9. + \row \li \c n \li character of the Letter or Number category permitted but not required. \row \li \c X \li Any non-blank character required. \row \li \c x \li Any non-blank character permitted but not required. - \row \li \c 9 \li ASCII digit required. 0-9. - \row \li \c 0 \li ASCII digit permitted but not required. - \row \li \c D \li ASCII digit required. 1-9. - \row \li \c d \li ASCII digit permitted but not required (1-9). - \row \li \c # \li ASCII digit or plus/minus sign permitted but not required. + \row \li \c 9 \li character of the Number category required, e.g 0-9. + \row \li \c 0 \li character of the Number category permitted but not required. + \row \li \c D \li character of the Number category and larger than zero required, + such as 1-9 + \row \li \c d \li character of the Number category and larger than zero permitted but not + required, such as 1-9. + \row \li \c # \li character of the Number category, or plus/minus sign permitted but not + required. \row \li \c H \li Hexadecimal character required. A-F, a-f, 0-9. \row \li \c h \li Hexadecimal character permitted but not required. \row \li \c B \li Binary character required. 0-1. @@ -1262,7 +1266,7 @@ QMargins QLineEdit::textMargins() const To get range control (e.g., for an IP address) use masks together with \l{setValidator()}{validators}. - \sa maxLength + \sa maxLength, QChar::isLetter(), QChar::isNumber(), QChar::digitValue() */ QString QLineEdit::inputMask() const { diff --git a/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp b/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp index 4e105d7dc7..35c5e7cb75 100644 --- a/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp +++ b/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp @@ -580,11 +580,26 @@ void tst_QDeadlineTimer::stdchrono() auto now = QDeadlineTimer::current(timerType); QTest::qSleep(minResolution); + auto sampling_start = steady_clock::now(); + auto steady_deadline = now.deadline(); + auto system_deadline = now.deadline(); auto steady_after = steady_clock::now(); auto system_after = system_clock::now(); + auto sampling_end = steady_clock::now(); + + auto sampling_diff = duration_cast(sampling_end - sampling_start).count(); + if (sampling_diff > minResolution/2) { + qWarning() << "Sampling clock took" << sampling_diff << "ms"; + QSKIP("Sampling clock took too long, aborting test", Abort); + } + auto total_diff = duration_cast(steady_after - steady_before).count(); + if (total_diff >= 3*minResolution) { + qWarning() << "Measurement took" << total_diff << "ms"; + QSKIP("Measurement took too long, aborting test", Abort); + } { - auto diff = duration_cast(steady_after - now.deadline()); + auto diff = duration_cast(steady_after - steady_deadline); QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count()))); QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count()))); QDeadlineTimer dt_after(steady_after, timerType); @@ -592,7 +607,7 @@ void tst_QDeadlineTimer::stdchrono() ("now = " + QLocale().toString(now.deadlineNSecs()) + "; after = " + QLocale().toString(dt_after.deadlineNSecs())).toLatin1()); - diff = duration_cast(now.deadline() - steady_before); + diff = duration_cast(steady_deadline - steady_before); QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count()))); QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count()))); QDeadlineTimer dt_before(steady_before, timerType); @@ -601,7 +616,7 @@ void tst_QDeadlineTimer::stdchrono() "; before = " + QLocale().toString(dt_before.deadlineNSecs())).toLatin1()); } { - auto diff = duration_cast(system_after - now.deadline()); + auto diff = duration_cast(system_after - system_deadline); QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count()))); QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count()))); QDeadlineTimer dt_after(system_after, timerType); @@ -609,7 +624,7 @@ void tst_QDeadlineTimer::stdchrono() ("now = " + QLocale().toString(now.deadlineNSecs()) + "; after = " + QLocale().toString(dt_after.deadlineNSecs())).toLatin1()); - diff = duration_cast(now.deadline() - system_before); + diff = duration_cast(system_deadline - system_before); QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count()))); QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count()))); QDeadlineTimer dt_before(system_before, timerType); diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 21615d6ec4..63d06497ce 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -7462,6 +7462,12 @@ void tst_QObject::checkArgumentsForNarrowing() FITS(bool, const QObject *&); FITS(int (*)(bool), void (QObject::*)()); + { + // wg21.link/P1957 + NARROWS(char*, bool); + NARROWS(void (QObject::*)(), bool); + } + #undef IS_UNSCOPED_ENUM_SIGNED #undef NARROWS_IF diff --git a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp index a0e8525268..6fe3e20083 100644 --- a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp @@ -59,6 +59,7 @@ private slots: void mnemonicTextWidth(); void leadingBelowLine(); void elidedMetrics(); + void zeroWidthMetrics(); }; void tst_QFontMetrics::same() @@ -358,5 +359,28 @@ void tst_QFontMetrics::elidedMetrics() QFontDatabase::removeApplicationFont(id); } +void tst_QFontMetrics::zeroWidthMetrics() +{ + QString zwnj(QChar(0x200c)); + QString zwsp(QChar(0x200b)); + + QFont font; + QFontMetricsF fm(font); + QCOMPARE(fm.horizontalAdvance(zwnj), 0); + QCOMPARE(fm.horizontalAdvance(zwsp), 0); + QCOMPARE(fm.boundingRect(zwnj).width(), 0); + QCOMPARE(fm.boundingRect(zwsp).width(), 0); + + QString string1 = QStringLiteral("(") + zwnj + QStringLiteral(")"); + QString string2 = QStringLiteral("(") + zwnj + zwnj + QStringLiteral(")"); + QString string3 = QStringLiteral("(") + zwsp + QStringLiteral(")"); + QString string4 = QStringLiteral("(") + zwsp + zwsp + QStringLiteral(")"); + + QCOMPARE(fm.horizontalAdvance(string1), fm.horizontalAdvance(string2)); + QCOMPARE(fm.horizontalAdvance(string3), fm.horizontalAdvance(string4)); + QCOMPARE(fm.boundingRect(string1).width(), fm.boundingRect(string2).width()); + QCOMPARE(fm.boundingRect(string3).width(), fm.boundingRect(string4).width()); +} + QTEST_MAIN(tst_QFontMetrics) #include "tst_qfontmetrics.moc"