From 143cf9e4675ff0f1317dce915aef009886307cf8 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 20 Apr 2018 13:41:04 -0700 Subject: QCocoaWindow: Fix handleMouseEvent() compilation warning qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm:408:53: warning: 'handleMouseEvent' is deprecated [-Wdeprecated-declarations] QWindowSystemInterface::handleMouseEvent(window(), window()->mapFromGlobal(localPoint.toPoint()), localPoint, Change-Id: Ifbf8c46e31a1de2089ce0e16cec087fdd9adb64e Reviewed-by: Erik Verbruggen --- src/plugins/platforms/cocoa/qcocoawindow.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 54254455e44..f9d16ab1c62 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -404,8 +404,10 @@ void QCocoaWindow::setVisible(bool visible) removeMonitor(); monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask|NSRightMouseDownMask|NSOtherMouseDownMask|NSMouseMovedMask handler:^(NSEvent *e) { QPointF localPoint = QCocoaScreen::mapFromNative([NSEvent mouseLocation]); + const auto eventType = e.type == NSMouseMoved ? QEvent::MouseMove : QEvent::MouseButtonPress; QWindowSystemInterface::handleMouseEvent(window(), window()->mapFromGlobal(localPoint.toPoint()), localPoint, - cocoaButton2QtButton([e buttonNumber])); + Qt::MouseButtons(uint(NSEvent.pressedMouseButtons & 0xFFFF)), + cocoaButton2QtButton(e.buttonNumber), eventType); }]; } } -- cgit v1.2.3 From e413874467c01cff63bb53e630d1e5d9d19fda53 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 23 Apr 2018 15:09:35 +0200 Subject: Fix division by zero in radial gradiants with NEON The NEON implementation uses rsqrt and thus can not be taken on 0, so replace the minimum with something close to zero instead of zero. Task-number: QTBUG-59961 Change-Id: Ia39e45be675b056c1e22900495ce9ba4e8b70e5f Reviewed-by: Erik Verbruggen --- src/gui/painting/qdrawhelper_p.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index b94fd34b51d..6f3c92ca644 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -520,7 +520,12 @@ public: const typename Simd::Float32x4 v_r0 = Simd::v_dup(data->gradient.radial.focal.radius); const typename Simd::Float32x4 v_dr = Simd::v_dup(op->radial.dr); +#if defined(__ARM_NEON__) + // NEON doesn't have SIMD sqrt, but uses rsqrt instead that can't be taken of 0. + const typename Simd::Float32x4 v_min = Simd::v_dup(std::numeric_limits::epsilon()); +#else const typename Simd::Float32x4 v_min = Simd::v_dup(0.0f); +#endif const typename Simd::Float32x4 v_max = Simd::v_dup(float(GRADIENT_STOPTABLE_SIZE-1)); const typename Simd::Float32x4 v_half = Simd::v_dup(0.5f); -- cgit v1.2.3 From a4e6117c53c3984585b3bbb74c00d6d863c98fcd Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 17 Dec 2015 16:29:08 -0800 Subject: Style sheets: detect and use font set on QHeaderViews We also ask the parent style to draw the header label instead of the base style which is more likely to respect other text related parameters. Change-Id: I6dd658fa4d016a76d7c450478dc42f07e4b807c4 Task-number: QTBUG-33855 Task-number: QTBUG-37153 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/styles/qstylesheetstyle.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index c4fc353803e..cdeb6a57687 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3837,7 +3837,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q if(hasStyleRule(w, PseudoElement_HeaderViewSection)) { QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection); if (!subRule.hasNativeBorder() || !subRule.baseStyleCanDraw() - || subRule.hasBackground() || subRule.hasPalette()) { + || subRule.hasBackground() || subRule.hasPalette() || subRule.hasFont) { ParentStyle::drawControl(ce, opt, p, w); return; } @@ -3874,12 +3874,14 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q QStyleOptionHeader hdr(*header); QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection); subRule.configurePalette(&hdr.palette, QPalette::ButtonText, QPalette::Button); - QFont oldFont = p->font(); - if (subRule.hasFont) + if (subRule.hasFont) { + QFont oldFont = p->font(); p->setFont(subRule.font.resolve(p->font())); - baseStyle()->drawControl(ce, &hdr, p, w); - if (subRule.hasFont) + ParentStyle::drawControl(ce, &hdr, p, w); p->setFont(oldFont); + } else { + baseStyle()->drawControl(ce, &hdr, p, w); + } return; } break; -- cgit v1.2.3 From c7eb2c173e79f2936985cd7589347e59b6005c7c Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 20 Apr 2018 12:22:35 -0700 Subject: QCocoaFontDialogHelper: Fix NSFontManager delegate warning According to Apple's documentation, there's no delegate in NSFontManager. We set its target instead. The action is changeFont: by default. Change-Id: I8c01bfa97c78dd8097f38c27353748d13f51489f Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index 9a96895d070..815882ab061 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -73,8 +73,6 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) return newFont; } -@class QT_MANGLE_NAMESPACE(QNSFontPanelDelegate); - @interface QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) : NSObject { @public @@ -110,7 +108,8 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); [mFontPanel setRestorable:NO]; [mFontPanel setDelegate:self]; - [[NSFontManager sharedFontManager] setDelegate:self]; + + [NSFontManager sharedFontManager].target = self; // Action is changeFont: [mFontPanel retain]; return self; @@ -120,7 +119,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); { [mStolenContentView release]; [mFontPanel setDelegate:nil]; - [[NSFontManager sharedFontManager] setDelegate:nil]; + [NSFontManager sharedFontManager].target = nil; [[NSNotificationCenter defaultCenter] removeObserver:self]; [super dealloc]; -- cgit v1.2.3 From 0f6a6b2bffb9b9d0a5db8b9473fda108d14e9915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 11 Apr 2018 12:31:11 +0200 Subject: =?UTF-8?q?Cocoa:=20Don=E2=80=99t=20starve=20the=20event=20loop=20?= =?UTF-8?q?on=20requestUpdate()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of our examples, and perhaps also some applications, call requestUpdate() immediately after producing a frame. This can cause Cocoa to immediately start (trying to) draw a new frame without processing e.g. input events. This should (and will) be handled by rate limiting updates with CVDisplayLink. In the mean time fall back to using the base class QPlatformWindow implementation, which is implemented using a timer, which will allow for input event processing. Change-Id: Ic2541f344b2f4018d785404a06274959a7bad2df Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index f9d16ab1c62..965a15a5486 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1336,7 +1336,7 @@ void QCocoaWindow::recreateWindowIfNeeded() void QCocoaWindow::requestUpdate() { qCDebug(lcQpaCocoaDrawing) << "QCocoaWindow::requestUpdate" << window(); - [qnsview_cast(m_view) requestUpdate]; + QPlatformWindow::requestUpdate(); } void QCocoaWindow::requestActivateWindow() -- cgit v1.2.3 From 18db0b49c61790e5a984ca93b9023a547fca8022 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 24 Apr 2018 15:47:15 +0200 Subject: Don't crash on
following a A
has a new-line but no text, so be able to handle no lines. Task-number: QTBUG-60853 Change-Id: I3d4dbd529114bbe8afe760c3622b52446202ec7c Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextdocumentlayout.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 9877a23fa6e..2957b8d5c05 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -2494,7 +2494,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout QTextTableData *td = static_cast(data(lastIt.currentFrame())); QTextLayout *layout = block.layout(); - QFixed height = QFixed::fromReal(layout->lineAt(0).height()); + QFixed height = layout->lineCount() > 0 ? QFixed::fromReal(layout->lineAt(0).height()) : QFixed(); if (layoutStruct->pageBottom == origPageBottom) { layoutStruct->y -= height; @@ -2506,10 +2506,12 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout layoutBlock(block, docPos, blockFormat, layoutStruct, layoutFrom, layoutTo, previousBlockFormatPtr); } - QPointF linePos((td->position.x + td->size.width).toReal(), - (td->position.y + td->size.height - height).toReal()); + if (layout->lineCount() > 0) { + QPointF linePos((td->position.x + td->size.width).toReal(), + (td->position.y + td->size.height - height).toReal()); - layout->lineAt(0).setPosition(linePos - layout->position()); + layout->lineAt(0).setPosition(linePos - layout->position()); + } } if (blockFormat.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysAfter) -- cgit v1.2.3 From f7980f4eda0ab2d7684357fd28b40bf6bbed260f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Apr 2018 08:38:01 +0200 Subject: Windows QPA: Fix handling of VK_DECIMAL/VK_SEPARATOR Remove the hardcoded mapping from the key table for fallback keys since the keys are locale-dependent. Task-number: QTBUG-57992 Change-Id: I016ab5f7f7e8abfd30f6416d2e7597db7deecb9b Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 2e446261127..5a8a45cbf63 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -317,9 +317,9 @@ static const uint KeyTbl[] = { // Keyboard mapping table Qt::Key_9, // 105 0x69 VK_NUMPAD9 | Numeric keypad 9 key Qt::Key_Asterisk, // 106 0x6A VK_MULTIPLY | Multiply key Qt::Key_Plus, // 107 0x6B VK_ADD | Add key - Qt::Key_Comma, // 108 0x6C VK_SEPARATOR | Separator key + Qt::Key_unknown, // 108 0x6C VK_SEPARATOR | Separator key (locale-dependent) Qt::Key_Minus, // 109 0x6D VK_SUBTRACT | Subtract key - Qt::Key_Period, // 110 0x6E VK_DECIMAL | Decimal key + Qt::Key_unknown, // 110 0x6E VK_DECIMAL | Decimal key (locale-dependent) Qt::Key_Slash, // 111 0x6F VK_DIVIDE | Divide key Qt::Key_F1, // 112 0x70 VK_F1 | F1 key Qt::Key_F2, // 113 0x71 VK_F2 | F2 key -- cgit v1.2.3 From 1b1fd81a811297414d0e7d8090fbc7a682c85313 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Apr 2018 08:46:28 +0200 Subject: Windows QPA: Add missing calls to keyboard initialization Add calls to changeKeyboard() to the QWindowsKeyMapper constructor and the handling of WM_INPUTLANGCHANGE so that the locale is correctly initialized and changes are processed. Change-Id: Ia30d8c6434ca85165e4882240ae16f9a75dcf4ff Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 5a8a45cbf63..35f81f01658 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -102,6 +102,7 @@ QWindowsKeyMapper::QWindowsKeyMapper() QGuiApplication *app = static_cast(QGuiApplication::instance()); QObject::connect(app, &QGuiApplication::applicationStateChanged, app, clearKeyRecorderOnApplicationInActive); + changeKeyboard(); } QWindowsKeyMapper::~QWindowsKeyMapper() @@ -810,7 +811,7 @@ bool QWindowsKeyMapper::translateKeyEvent(QWindow *widget, HWND hwnd, // Reset layout map when system keyboard layout is changed if (msg.message == WM_INPUTLANGCHANGE) { - deleteLayouts(); + changeKeyboard(); return true; } -- cgit v1.2.3 From 7917305aa5acdad117632bc2723d9bec85daa0e0 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 30 Jan 2018 14:52:14 +0100 Subject: Doc: Show more examples on how to have multiple logging rules Task-number: QTBUG-66050 Change-Id: I6872cd64f9b27b9849e4166af7aa6414c372cd5e Reviewed-by: Leena Miettinen Reviewed-by: hjk --- src/corelib/io/qloggingcategory.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index b0292743295..a6c27d19c01 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -147,9 +147,15 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift) Rules are evaluated in text order, from first to last. That is, if two rules apply to a category/type, the rule that comes later is applied. - Rules can be set via \l setFilterRules(). Since Qt 5.3, logging rules can also - be set in the \c QT_LOGGING_RULES environment variable, and - are automatically loaded from the \c [Rules] section of a logging + Rules can be set via \l setFilterRules(): + + \code + QLoggingCategory::setFilterRules("*.debug=false\n" + "driver.usb.debug=true"); + \endcode + + Since Qt 5.3, logging rules are also + automatically loaded from the \c [Rules] section of a logging configuration file. Such configuration files are looked up in the QtProject configuration directory, or explicitly set in a \c QT_LOGGING_CONF environment variable: @@ -160,19 +166,18 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift) driver.usb.debug=true \endcode - Rules set by \l setFilterRules() take precedence over rules specified - in the QtProject configuration directory, and can, in turn, be - overwritten by rules from the configuration file specified by - \c QT_LOGGING_CONF, and rules set by \c QT_LOGGING_RULES. - - - Since Qt 5.6, \c QT_LOGGING_RULES may contain multiple rules separated - by semicolons: + Since Qt 5.3, logging rules can also be specified in a \c QT_LOGGING_RULES + environment variable. And since Qt 5.6, multiple rules can also be + separated by semicolons: \code QT_LOGGING_RULES="*.debug=false;driver.usb.debug=true" \endcode + Rules set by \l setFilterRules() take precedence over rules specified + in the QtProject configuration directory, and can, in turn, be + overwritten by rules from the configuration file specified by + \c QT_LOGGING_CONF, and rules set by \c QT_LOGGING_RULES. Order of evaluation: \list -- cgit v1.2.3 From 3d863ae798ecea87eaf02b2364d45cb79d90c3f5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 16 Apr 2018 11:12:58 +0200 Subject: Fix build with -no-feature-graphicsview Change-Id: Idddd353695d2a24ed90c29f557abfedf11d82fbc Reviewed-by: Richard Moe Gustavsen Reviewed-by: Oswald Buddenhagen --- src/widgets/kernel/qwindowcontainer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index d388327687a..097931913eb 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -48,6 +48,7 @@ #include #endif #include +#include QT_BEGIN_NAMESPACE -- cgit v1.2.3 From 395a19f0325e883749dde76849bd1092a711d802 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 12 Apr 2018 21:10:59 +0200 Subject: improve documentation, mostly of the QT_TR*_NOOP macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I65ccddec84a01945a6aee2a859d4f92ea830785b Reviewed-by: Paul Wicking Reviewed-by: Topi Reiniƶ Reviewed-by: Mateusz Starzycki Reviewed-by: Martin Smith --- .../snippets/code/src_corelib_global_qglobal.cpp | 16 +++--- src/corelib/global/qglobal.cpp | 58 +++++++++++----------- src/corelib/global/qglobal.h | 2 +- 3 files changed, 38 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp index ceb3f8adf3c..2d7b9a9ac84 100644 --- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp @@ -387,11 +387,11 @@ CONFIG += no_keywords //! [34] QString FriendlyConversation::greeting(int type) { -static const char *greeting_strings[] = { - QT_TR_NOOP("Hello"), - QT_TR_NOOP("Goodbye") -}; -return tr(greeting_strings[type]); + static const char *greeting_strings[] = { + QT_TR_NOOP("Hello"), + QT_TR_NOOP("Goodbye") + }; + return tr(greeting_strings[type]); } //! [34] @@ -410,7 +410,7 @@ QString FriendlyConversation::greeting(int type) QString global_greeting(int type) { return qApp->translate("FriendlyConversation", - greeting_strings[type]); + greeting_strings[type]); } //! [35] @@ -434,8 +434,8 @@ QString FriendlyConversation::greeting(int type) QString global_greeting(int type) { return qApp->translate("FriendlyConversation", - greeting_strings[type].source, - greeting_strings[type].comment); + greeting_strings[type].source, + greeting_strings[type].comment); } //! [36] diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 30c80b8b6fc..21f22a32bae 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -648,10 +648,10 @@ Q_STATIC_ASSERT((std::is_same::value)); compiler or platform specific code to their application. The remaining macros are convenience macros for larger operations: - The QT_TRANSLATE_NOOP() and QT_TR_NOOP() macros provide the - possibility of marking text for dynamic translation, - i.e. translation without changing the stored source text. The - Q_ASSERT() and Q_ASSERT_X() enables warning messages of various + The QT_TR_NOOP(), QT_TRANSLATE_NOOP(), and QT_TRANSLATE_NOOP3() + macros provide the possibility of marking strings for delayed + translation. + The Q_ASSERT() and Q_ASSERT_X() enables warning messages of various level of refinement. The Q_FOREACH() and foreach() macros implement Qt's foreach loop. @@ -662,11 +662,11 @@ Q_STATIC_ASSERT((std::is_same::value)); memory, if the pointer is 0. The qPrintable() and qUtf8Printable() macros represent an easy way of printing text. - Finally, the QT_POINTER_SIZE macro expands to the size of a - pointer in bytes, and the QT_VERSION and QT_VERSION_STR macros - expand to a numeric value or a string, respectively, specifying - Qt's version number, i.e the version the application is compiled - against. + The QT_POINTER_SIZE macro expands to the size of a pointer in bytes. + + The macros QT_VERSION and QT_VERSION_STR expand to a numeric value + or a string, respectively, that specifies the version of Qt that the + application is compiled against. \sa , QSysInfo */ @@ -3676,19 +3676,18 @@ bool qunsetenv(const char *varName) \macro QT_TR_NOOP(sourceText) \relates - Marks the string literal \a sourceText for dynamic translation in - the current context (class), i.e the stored \a sourceText will not - be altered. + Marks the UTF-8 encoded string literal \a sourceText for delayed + translation in the current context (class). - The macro expands to \a sourceText. + The macro tells lupdate to collect the string, and expands to + \a sourceText itself. Example: \snippet code/src_corelib_global_qglobal.cpp 34 - The macro QT_TR_NOOP_UTF8() is identical except that it tells lupdate - that the source string is encoded in UTF-8. Corresponding variants - exist in the QT_TRANSLATE_NOOP() family of macros, too. + The macro QT_TR_NOOP_UTF8() is identical and obsolete; this applies + to all other _UTF8 macros as well. \sa QT_TRANSLATE_NOOP(), {Internationalization with Qt} */ @@ -3697,12 +3696,12 @@ bool qunsetenv(const char *varName) \macro QT_TRANSLATE_NOOP(context, sourceText) \relates - Marks the string literal \a sourceText for dynamic translation in - the given \a context; i.e, the stored \a sourceText will not be - altered. The \a context is typically a class and also needs to - be specified as string literal. + Marks the UTF-8 encoded string literal \a sourceText for delayed + translation in the given \a context. The \a context is typically + a class name and also needs to be specified as a string literal. - The macro expands to \a sourceText. + The macro tells lupdate to collect the string, and expands to + \a sourceText itself. Example: @@ -3712,18 +3711,19 @@ bool qunsetenv(const char *varName) */ /*! - \macro QT_TRANSLATE_NOOP3(context, sourceText, comment) + \macro QT_TRANSLATE_NOOP3(context, sourceText, disambiguation) \relates \since 4.4 - Marks the string literal \a sourceText for dynamic translation in the - given \a context and with \a comment, i.e the stored \a sourceText will - not be altered. The \a context is typically a class and also needs to - be specified as string literal. The string literal \a comment - will be available for translators using e.g. Qt Linguist. + Marks the UTF-8 encoded string literal \a sourceText for delayed + translation in the given \a context with the given \a disambiguation. + The \a context is typically a class and also needs to be specified + as a string literal. The string literal \a disambiguation should be + a short semantic tag to tell apart otherwise identical strings. - The macro expands to anonymous struct of the two string - literals passed as \a sourceText and \a comment. + The macro tells lupdate to collect the string, and expands to an + anonymous struct of the two string literals passed as \a sourceText + and \a disambiguation. Example: diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index e31d4d9ad74..3684c6b5dea 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1062,7 +1062,7 @@ template static inline typename Wrapper::pointer qGetPtrHelpe #define QT_TRANSLATE_NOOP3(scope, x, comment) {x, comment} #define QT_TRANSLATE_NOOP3_UTF8(scope, x, comment) {x, comment} -#ifndef QT_NO_TRANSLATION // ### This should enclose the NOOPs above +#ifndef QT_NO_TRANSLATION // ### Qt6: This should enclose the NOOPs above // Defined in qcoreapplication.cpp // The better name qTrId() is reserved for an upcoming function which would -- cgit v1.2.3