diff options
| author | Sami Shalayel <sami.shalayel@qt.io> | 2024-07-25 11:39:11 +0200 |
|---|---|---|
| committer | Sami Shalayel <sami.shalayel@qt.io> | 2024-07-29 08:35:24 +0200 |
| commit | 0835b5d130054350e292dffae7f54294877c2dde (patch) | |
| tree | 9cf42c4658167f85889b6f62887a374c175fc7c1 /src/qmlcompiler/qqmljsimportvisitor.cpp | |
| parent | d799602d438dcbd38113497e269c7326e391bba7 (diff) | |
qmljsimportvisitor: remove Connections fix-it
Remove the fix-it as it is currently not possible to create a proper
fix-it replacement without breaking user code. Tracking in
QTBUG-127535 on how to solve it in the future by using the Dom.
Fixes: QTBUG-127474
Task-number: QTBUG-127535
Pick-to: 6.8 6.7
Change-Id: Ifb335545aa6af1f731281bdcce2ca24062b2c747
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsimportvisitor.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsimportvisitor.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp index 718eda9575..c516097ff1 100644 --- a/src/qmlcompiler/qqmljsimportvisitor.cpp +++ b/src/qmlcompiler/qqmljsimportvisitor.cpp @@ -1023,30 +1023,21 @@ void QQmlJSImportVisitor::checkSignal( } if (!signalMethod.has_value()) { // haven't found anything - std::optional<QQmlJSFixSuggestion> fix; - // There is a small chance of suggesting this fix for things that are not actually // QtQml/Connections elements, but rather some other thing that is also called // "Connections". However, I guess we can live with this. if (signalScope->baseTypeName() == QStringLiteral("Connections")) { - - // Cut to the end of the line to avoid hairy issues with pre-existing function() - // and the colon. - const qsizetype newLength = m_logger->code().indexOf(u'\n', location.end()) - - location.offset; - - fix = QQmlJSFixSuggestion{ - "Implicitly defining %1 as signal handler in Connections is deprecated. " - "Create a function instead."_L1.arg(handlerName), - QQmlJS::SourceLocation(location.offset, newLength, location.startLine, - location.startColumn), - "function %1(%2) { ... }"_L1.arg(handlerName, handlerParameters.join(u", ")) - }; + m_logger->log( + u"Implicitly defining \"%1\" as signal handler in Connections is deprecated. " + u"Create a function instead: \"function %2(%3) { ... }\"."_s.arg( + handlerName, handlerName, handlerParameters.join(u", ")), + qmlUnqualified, location, true, true); + return; } - m_logger->log(QStringLiteral("no matching signal found for handler \"%1\"") - .arg(handlerName), - qmlUnqualified, location, true, true, fix); + m_logger->log( + QStringLiteral("no matching signal found for handler \"%1\"").arg(handlerName), + qmlUnqualified, location, true, true); return; } |
