diff options
-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 | ||||
-rw-r--r-- | tests/auto/quick/qquicktextinput/BLACKLIST | 4 | ||||
-rw-r--r-- | tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp | 1 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/LottieAnimation.qml | 1 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/VectorImage.qml | 1 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/mainwindow.cpp | 13 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/mainwindow.h | 1 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/mainwindow.ui | 55 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/svgpainter.cpp | 3 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/svgpainter.h | 17 | ||||
-rw-r--r-- | tests/manual/vectorimagetest/vectorimagemanager.h | 16 | ||||
-rw-r--r-- | tools/qmllint/main.cpp | 2 |
17 files changed, 109 insertions, 51 deletions
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}. diff --git a/tests/auto/quick/qquicktextinput/BLACKLIST b/tests/auto/quick/qquicktextinput/BLACKLIST index 87df955e9a..7510e44426 100644 --- a/tests/auto/quick/qquicktextinput/BLACKLIST +++ b/tests/auto/quick/qquicktextinput/BLACKLIST @@ -1,7 +1,3 @@ -# QTBUG-78162 -[mouseSelectionMode] -opensuse-leap - # QTQAINFRA-4127 [passwordCharacter] ci b2qt 32bit diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index d2c68382d0..c12edf5a1c 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -1336,7 +1336,6 @@ void tst_qquicktextinput::mouseSelectionMode() QQuickView window(QUrl::fromLocalFile(qmlfile)); window.show(); - window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(window.rootObject() != nullptr); diff --git a/tests/manual/vectorimagetest/LottieAnimation.qml b/tests/manual/vectorimagetest/LottieAnimation.qml index 8463234393..28c14706cc 100644 --- a/tests/manual/vectorimagetest/LottieAnimation.qml +++ b/tests/manual/vectorimagetest/LottieAnimation.qml @@ -12,5 +12,6 @@ Item { id: lottieAnimation textureSize: Qt.size(width * parent.scale, height * parent.scale) source: VectorImageManager.currentSource.toString().endsWith("json") ? VectorImageManager.currentSource : "" + loops: VectorImageManager.looping ? LottieAnimation.Infinite : 1 } } diff --git a/tests/manual/vectorimagetest/VectorImage.qml b/tests/manual/vectorimagetest/VectorImage.qml index dfd5473ed6..4a3fedf832 100644 --- a/tests/manual/vectorimagetest/VectorImage.qml +++ b/tests/manual/vectorimagetest/VectorImage.qml @@ -14,5 +14,6 @@ Item { source: VectorImageManager.currentSource preferredRendererType: VectorImage.CurveRenderer assumeTrustedSource: true + animations.loops: VectorImageManager.looping ? Animation.Infinite : 1 } } diff --git a/tests/manual/vectorimagetest/mainwindow.cpp b/tests/manual/vectorimagetest/mainwindow.cpp index a1580d7f8b..c3b11c04b8 100644 --- a/tests/manual/vectorimagetest/mainwindow.cpp +++ b/tests/manual/vectorimagetest/mainwindow.cpp @@ -12,6 +12,7 @@ #include <QQuickWidget> #include <QQmlEngine> #include <QSlider> +#include <QCheckBox> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) @@ -58,9 +59,16 @@ MainWindow::MainWindow(QWidget *parent) connect(ui->hsScale, &QAbstractSlider::valueChanged, m_manager, &VectorImageManager::setScale); connect(ui->hsScale, &QAbstractSlider::valueChanged, m_svgPainter, &SvgPainter::setScale); connect(ui->hsScale, &QAbstractSlider::valueChanged, this, &MainWindow::setScale); + + connect(ui->cbLooping, &QCheckBox::toggled, m_manager, &VectorImageManager::setLooping); + connect(ui->cbLooping, &QCheckBox::toggled, this, &MainWindow::setLooping); + connect(ui->cbLooping, &QCheckBox::toggled, m_svgPainter, &SvgPainter::setLooping); + int scale = m_settings->value(QStringLiteral("scale"), 10).toInt(); ui->hsScale->setValue(scale); + ui->cbLooping->setChecked(m_settings->value(QStringLiteral("looping")).toBool()); + ui->tbNext->setShortcut(QKeySequence(QKeySequence::MoveToNextChar)); ui->tbPrev->setShortcut(QKeySequence(QKeySequence::MoveToPreviousChar)); } @@ -175,3 +183,8 @@ void MainWindow::previous() m_manager->setCurrentIndex(m_manager->currentIndex() - 1); } + +void MainWindow::setLooping(bool looping) +{ + m_settings->setValue(QStringLiteral("looping"), looping); +} diff --git a/tests/manual/vectorimagetest/mainwindow.h b/tests/manual/vectorimagetest/mainwindow.h index cc0fe83ab5..865893b847 100644 --- a/tests/manual/vectorimagetest/mainwindow.h +++ b/tests/manual/vectorimagetest/mainwindow.h @@ -34,6 +34,7 @@ private slots: void previous(); void loadDirectory(const QString &newDir); void updateIndex(int newIndex); + void setLooping(bool looping); private: void updateCurrentDir(const QString &newDir); diff --git a/tests/manual/vectorimagetest/mainwindow.ui b/tests/manual/vectorimagetest/mainwindow.ui index dd5a32dc8d..f7e16d0585 100644 --- a/tests/manual/vectorimagetest/mainwindow.ui +++ b/tests/manual/vectorimagetest/mainwindow.ui @@ -55,7 +55,7 @@ <x>0</x> <y>0</y> <width>263</width> - <height>790</height> + <height>788</height> </rect> </property> </widget> @@ -98,7 +98,7 @@ <x>0</x> <y>0</y> <width>264</width> - <height>790</height> + <height>788</height> </rect> </property> </widget> @@ -141,7 +141,7 @@ <x>0</x> <y>0</y> <width>263</width> - <height>790</height> + <height>788</height> </rect> </property> </widget> @@ -167,7 +167,7 @@ <item> <widget class="QScrollArea" name="saVectorImage"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -184,7 +184,7 @@ <x>0</x> <y>0</y> <width>263</width> - <height>790</height> + <height>788</height> </rect> </property> </widget> @@ -254,20 +254,37 @@ </widget> </item> <item> - <widget class="QSlider" name="hsScale"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>100</number> - </property> - <property name="value"> - <number>10</number> - </property> - <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> - </property> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QSlider" name="hsScale"> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>10</number> + </property> + <property name="orientation"> + <enum>Qt::Orientation::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbLooping"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Looping animations</string> + </property> + </widget> + </item> + </layout> </item> </layout> </widget> diff --git a/tests/manual/vectorimagetest/svgpainter.cpp b/tests/manual/vectorimagetest/svgpainter.cpp index 7de39e5a4d..3deec5a2ee 100644 --- a/tests/manual/vectorimagetest/svgpainter.cpp +++ b/tests/manual/vectorimagetest/svgpainter.cpp @@ -73,6 +73,9 @@ void SvgPainter::paintEvent(QPaintEvent *event) m_renderer.render(&p); m_size = m_renderer.defaultSize(); setFixedSize(m_size * m_scale / 10.0); + + if (m_looping && m_renderer.currentFrame() >= (m_renderer.animationDuration() / 1000 * m_renderer.framesPerSecond())) + m_renderer.setCurrentFrame(0); } #else m_size = renderer()->defaultSize(); diff --git a/tests/manual/vectorimagetest/svgpainter.h b/tests/manual/vectorimagetest/svgpainter.h index d362258661..d78af20aa1 100644 --- a/tests/manual/vectorimagetest/svgpainter.h +++ b/tests/manual/vectorimagetest/svgpainter.h @@ -20,6 +20,7 @@ class SvgPainter : public QWidget Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) + Q_PROPERTY(bool looping READ looping WRITE setLooping NOTIFY loopingChanged) public: explicit SvgPainter(QWidget *parent = nullptr); @@ -29,10 +30,23 @@ public: qreal scale() const; void setScale(const qreal scale); + bool looping() const + { + return m_looping; + } + + void setLooping(bool looping) + { + if (m_looping == looping) + return; + m_looping = looping; + emit loopingChanged(); + } + signals: void sourceChanged(); void scaleChanged(); - + void loopingChanged(); protected: #ifndef SVGWIDGET @@ -45,6 +59,7 @@ private: QUrl m_source; QSize m_size; qreal m_scale; + bool m_looping = false; #ifndef SVGWIDGET QSvgRenderer m_renderer; #endif diff --git a/tests/manual/vectorimagetest/vectorimagemanager.h b/tests/manual/vectorimagetest/vectorimagemanager.h index e81cf4520a..67fa8989dc 100644 --- a/tests/manual/vectorimagetest/vectorimagemanager.h +++ b/tests/manual/vectorimagetest/vectorimagemanager.h @@ -20,6 +20,7 @@ class VectorImageManager : public QObject Q_PROPERTY(QString currentDirectory READ currentDirectory WRITE setCurrentDirectory NOTIFY currentDirectoryChanged) Q_PROPERTY(QList<QUrl> sources READ sources NOTIFY sourcesChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) + Q_PROPERTY(bool looping READ looping WRITE setLooping NOTIFY loopingChanged) public: VectorImageManager(QObject *parent); ~VectorImageManager() override; @@ -57,8 +58,21 @@ public: qreal scale() const; + bool looping() const + { + return m_looping; + } + public slots: void setScale(int newScale); + void setLooping(bool looping) + { + if (m_looping == looping) + return; + + m_looping = looping; + emit loopingChanged(); + } signals: void currentSourceChanged(); @@ -69,6 +83,7 @@ signals: void currentDirectoryChanged(); void scaleChanged(); + void loopingChanged(); private: static VectorImageManager *g_manager; @@ -77,6 +92,7 @@ private: QString m_currentDirectory; QString m_qmlSource; qreal m_scale = 10.0; + bool m_looping = false; }; #endif // VECTORIMAGEMANAGER_H diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp index 28f8e9e610..bb27ba6ceb 100644 --- a/tools/qmllint/main.cpp +++ b/tools/qmllint/main.cpp @@ -30,7 +30,7 @@ using namespace Qt::StringLiterals; -constexpr int JSON_LOGGING_FORMAT_REVISION = 3; +constexpr int JSON_LOGGING_FORMAT_REVISION = 4; bool argumentsFromCommandLineAndFile(QStringList& allArguments, const QStringList &arguments) { |