diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/qmlcompiler/qcoloroutput.cpp | 22 | ||||
-rw-r--r-- | src/qmlcompiler/qqmljslinter.cpp | 17 | ||||
-rw-r--r-- | src/qmlcompiler/qqmljslogger.cpp | 14 | ||||
-rw-r--r-- | src/qmlls/documentSymbolSupport/qqmldocumentsymbolsupport.cpp | 2 | ||||
-rw-r--r-- | src/quick/accessible/qaccessiblequickitem.cpp | 3 | ||||
-rw-r--r-- | src/quickcontrols/material/impl/qquickmaterialtextcontainer_p.h | 3 | ||||
-rw-r--r-- | src/quicklayouts/qquickflexboxlayout.cpp | 7 |
7 files changed, 37 insertions, 31 deletions
diff --git a/src/qmlcompiler/qcoloroutput.cpp b/src/qmlcompiler/qcoloroutput.cpp index f3f5b86d7a..6a99a8007e 100644 --- a/src/qmlcompiler/qcoloroutput.cpp +++ b/src/qmlcompiler/qcoloroutput.cpp @@ -6,7 +6,9 @@ #include <QtCore/qfile.h> #include <QtCore/qhash.h> -#ifndef Q_OS_WIN +#ifdef Q_OS_WIN +#include <qt_windows.h> +#else #include <unistd.h> #endif @@ -75,17 +77,25 @@ private: */ inline bool isColoringPossible() const { + static std::optional<bool> canColor; + if (canColor.has_value()) + return canColor.value(); + #if defined(Q_OS_WIN) - /* Windows doesn't at all support ANSI escape codes, unless - * the user install a "device driver". See the Wikipedia links in the - * class documentation for details. */ - return false; + HANDLE hErr = GetStdHandle(STD_ERROR_HANDLE); + DWORD mode = 0; + + if (GetConsoleMode(hErr, &mode)) + canColor = SetConsoleMode(hErr, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING); + else + canColor = false; #else /* We use QFile::handle() to get the file descriptor. It's a bit unsure * whether it's 2 on all platforms and in all cases, so hopefully this layer * of abstraction helps handle such cases. */ - return isatty(fileno(stderr)); + canColor = isatty(fileno(stderr)); #endif + return canColor.value(); } }; diff --git a/src/qmlcompiler/qqmljslinter.cpp b/src/qmlcompiler/qqmljslinter.cpp index 3031d82bf7..c177968220 100644 --- a/src/qmlcompiler/qqmljslinter.cpp +++ b/src/qmlcompiler/qqmljslinter.cpp @@ -471,31 +471,18 @@ static void addJsonWarning(QJsonArray &warnings, const QQmlJS::DiagnosticMessage QJsonObject jsonFix { { "message"_L1, suggestion->fixDescription() }, { "replacement"_L1, suggestion->replacement() }, - { "isHint"_L1, !suggestion->isAutoApplicable() }, + { "isAutoApplicable"_L1, suggestion->isAutoApplicable() }, + { "hint"_L1, suggestion->hint() }, }; convertLocation(suggestion->location(), &jsonFix); const QString filename = suggestion->filename(); if (!filename.isEmpty()) jsonFix.insert("fileName"_L1, filename); suggestions << jsonFix; - - const QString hint = suggestion->hint(); - if (!hint.isEmpty()) { - // We need to keep compatibility with the JSON format. - // Therefore the overly verbose encoding of the hint. - QJsonObject jsonHint { - { "message"_L1, hint }, - { "replacement"_L1, QString() }, - { "isHint"_L1, true } - }; - convertLocation(QQmlJS::SourceLocation(), &jsonHint); - suggestions << jsonHint; - } } jsonMessage[u"suggestions"] = suggestions; warnings << jsonMessage; - } void QQmlJSLinter::processMessages(QJsonArray &warnings) diff --git a/src/qmlcompiler/qqmljslogger.cpp b/src/qmlcompiler/qqmljslogger.cpp index 8410032f48..6d42e4f545 100644 --- a/src/qmlcompiler/qqmljslogger.cpp +++ b/src/qmlcompiler/qqmljslogger.cpp @@ -477,13 +477,15 @@ void QQmlJSLogger::printFix(const QQmlJSFixSuggestion &fixItem) int tabCount = issueLocationWithContext.beforeText().count(u'\t'); // Do not draw location indicator for multiline replacement strings - if (replacementString.contains(u'\n')) - return; + if (!replacementString.contains(u'\n')) { + m_output.write(u" "_s.repeated( + issueLocationWithContext.beforeText().size() - tabCount) + + u"\t"_s.repeated(tabCount) + + u"^"_s.repeated(replacement.size()) + u'\n'); + } - m_output.write(u" "_s.repeated( - issueLocationWithContext.beforeText().size() - tabCount) - + u"\t"_s.repeated(tabCount) - + u"^"_s.repeated(replacement.size()) + u'\n'); + if (!fixItem.hint().isEmpty()) + m_output.write(" "_L1 + fixItem.hint()); } QQmlJSFixSuggestion::QQmlJSFixSuggestion(const QString &fixDescription, diff --git a/src/qmlls/documentSymbolSupport/qqmldocumentsymbolsupport.cpp b/src/qmlls/documentSymbolSupport/qqmldocumentsymbolsupport.cpp index 68cc8ff973..57e474f652 100644 --- a/src/qmlls/documentSymbolSupport/qqmldocumentsymbolsupport.cpp +++ b/src/qmlls/documentSymbolSupport/qqmldocumentsymbolsupport.cpp @@ -37,7 +37,7 @@ void QQmlDocumentSymbolSupport::process(QQmlDocumentSymbolSupport::RequestPointe const auto qmlFileItem = doc.snapshot.validDoc.fileObject(QQmlJS::Dom::GoTo::MostLikely); QList<QLspSpecification::DocumentSymbol> results; ResponseScopeGuard guard(results, request->m_response); - if (!qmlFileItem) + if (qmlFileItem.internalKind() != QQmlJS::Dom::DomType::QmlFile) return; results = DocumentSymbolUtils::assembleSymbolsForQmlFile(qmlFileItem); DocumentSymbolUtils::reorganizeForOutlineView(results); diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp index f88f82648b..8a46ad3f91 100644 --- a/src/quick/accessible/qaccessiblequickitem.cpp +++ b/src/quick/accessible/qaccessiblequickitem.cpp @@ -723,7 +723,8 @@ void *QAccessibleQuickItem::interface_cast(QAccessible::InterfaceType t) if (t == QAccessible::TextInterface) { if (r == QAccessible::EditableText || - r == QAccessible::StaticText) + r == QAccessible::StaticText || + r == QAccessible::Heading) return static_cast<QAccessibleTextInterface*>(this); } diff --git a/src/quickcontrols/material/impl/qquickmaterialtextcontainer_p.h b/src/quickcontrols/material/impl/qquickmaterialtextcontainer_p.h index c4087d950e..f056fddf87 100644 --- a/src/quickcontrols/material/impl/qquickmaterialtextcontainer_p.h +++ b/src/quickcontrols/material/impl/qquickmaterialtextcontainer_p.h @@ -15,7 +15,8 @@ // We mean it. // -#include <QPropertyAnimation> +#include <QtCore/qpointer.h> +#include <QtCore/qpropertyanimation.h> #include <QtCore/private/qglobal_p.h> #include <QtGui/qcolor.h> #include <QtQuick/qquickpainteditem.h> diff --git a/src/quicklayouts/qquickflexboxlayout.cpp b/src/quicklayouts/qquickflexboxlayout.cpp index 87cbf2cc64..2dad441652 100644 --- a/src/quicklayouts/qquickflexboxlayout.cpp +++ b/src/quicklayouts/qquickflexboxlayout.cpp @@ -8,7 +8,7 @@ /*! \qmltype FlexboxLayout //! \nativetype QQuickFlexboxLayout - \inherits Layout + \inherits Item \inqmlmodule QtQuick.Layouts \ingroup layouts \since 6.10 @@ -47,6 +47,11 @@ \li \l{Layout::maximumHeight}{Layout.maximumHeight} \li \l{Layout::fillWidth}{Layout.fillWidth} \li \l{Layout::fillHeight}{Layout.fillHeight} + \li \l{Layout::margins}{Layout.margins} + \li \l{Layout::leftMargin}{Layout.leftMargin} + \li \l{Layout::rightMargin}{Layout.rightMargin} + \li \l{Layout::topMargin}{Layout.topMargin} + \li \l{Layout::bottomMargin}{Layout.bottomMargin} \endlist Read more about attached properties \l{QML Object Attributes}{here}. |