diff --git a/src/libs/browser/webview.cpp b/src/libs/browser/webview.cpp index dd028e6d..bc6b9784 100644 --- a/src/libs/browser/webview.cpp +++ b/src/libs/browser/webview.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -58,12 +57,12 @@ void WebView::setZoomLevel(int level) emit zoomLevelChanged(); } -const QVector &WebView::availableZoomLevels() +const QList &WebView::availableZoomLevels() { // clang-format off - static const QVector zoomLevels = {30, 40, 50, 67, 80, 90, 100, - 110, 120, 133, 150, 170, 200, - 220, 233, 250, 270, 285, 300}; + static const QList zoomLevels = {30, 40, 50, 67, 80, 90, 100, + 110, 120, 133, 150, 170, 200, + 220, 233, 250, 270, 285, 300}; // clang-format on return zoomLevels; diff --git a/src/libs/browser/webview.h b/src/libs/browser/webview.h index aee79c2c..497fd9bd 100644 --- a/src/libs/browser/webview.h +++ b/src/libs/browser/webview.h @@ -5,6 +5,7 @@ #ifndef ZEAL_BROWSER_WEBVIEW_H #define ZEAL_BROWSER_WEBVIEW_H +#include #include namespace Zeal::Browser { @@ -22,7 +23,7 @@ public: bool eventFilter(QObject *watched, QEvent *event) override; - static const QVector &availableZoomLevels(); + static const QList &availableZoomLevels(); static int defaultZoomLevel(); public slots: diff --git a/src/libs/registry/searchresult.h b/src/libs/registry/searchresult.h index 7d255e2d..ff999a62 100644 --- a/src/libs/registry/searchresult.h +++ b/src/libs/registry/searchresult.h @@ -7,7 +7,7 @@ #include #include -#include +#include namespace Zeal::Registry { @@ -24,7 +24,7 @@ struct SearchResult Docset *docset; double score; - QVector matchPositions; + QList matchPositions; inline bool operator<(const SearchResult &other) const { diff --git a/src/libs/ui/qxtglobalshortcut/qxtglobalshortcut_x11.cpp b/src/libs/ui/qxtglobalshortcut/qxtglobalshortcut_x11.cpp index 72a53bce..788d8fdc 100644 --- a/src/libs/ui/qxtglobalshortcut/qxtglobalshortcut_x11.cpp +++ b/src/libs/ui/qxtglobalshortcut/qxtglobalshortcut_x11.cpp @@ -35,8 +35,8 @@ #include #include #include +#include #include -#include #include #include diff --git a/src/libs/ui/searchitemdelegate.cpp b/src/libs/ui/searchitemdelegate.cpp index 9633e0eb..bdfca632 100644 --- a/src/libs/ui/searchitemdelegate.cpp +++ b/src/libs/ui/searchitemdelegate.cpp @@ -128,7 +128,7 @@ void SearchItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op const QString elidedText = fm.elidedText(opt.text, Qt::ElideRight, textRect.width()); // Get pre-computed match positions from model for highlighting. - const QVector matchPositions = index.data(m_textHighlightRole).value>(); + const auto matchPositions = index.data(m_textHighlightRole).value>(); painter->save(); diff --git a/src/libs/util/fuzzy.cpp b/src/libs/util/fuzzy.cpp index 7a70d776..00fad107 100644 --- a/src/libs/util/fuzzy.cpp +++ b/src/libs/util/fuzzy.cpp @@ -81,7 +81,7 @@ bool hasMatch(const QString &needle, const QString &haystack) // High-level Qt convenience API implementation // ============================================================================ -double score(const QString &needle, const QString &haystack, QVector *positions) +double score(const QString &needle, const QString &haystack, QList *positions) { // Pre-filter: check if all needle characters exist in haystack (performance optimization) // This avoids expensive DP computation on unmatchable strings @@ -101,7 +101,7 @@ double score(const QString &needle, const QString &haystack, QVector *posit // Low-level API implementation // ============================================================================ -double computeScore(const QString &needle, const QString &haystack, QVector *positions) +double computeScore(const QString &needle, const QString &haystack, QList *positions) { const int needleLen = needle.length(); const int haystackLen = haystack.length(); diff --git a/src/libs/util/fuzzy.h b/src/libs/util/fuzzy.h index 2ae5aaa0..9a182bef 100644 --- a/src/libs/util/fuzzy.h +++ b/src/libs/util/fuzzy.h @@ -4,8 +4,8 @@ #ifndef ZEAL_UTIL_FUZZY_H #define ZEAL_UTIL_FUZZY_H +#include #include -#include // TODO: [Qt 6] Use QList. namespace Zeal::Util::Fuzzy { @@ -28,7 +28,7 @@ namespace Zeal::Util::Fuzzy { * @param positions Optional output list of matched haystack indices for highlighting * @return Match score (higher is better, -infinity for no match) */ -double score(const QString &needle, const QString &haystack, QVector *positions = nullptr); +double score(const QString &needle, const QString &haystack, QList *positions = nullptr); /** * @brief Computes fuzzy match score, optionally returning match positions @@ -44,7 +44,7 @@ double score(const QString &needle, const QString &haystack, QVector *posit * @return Fuzzy match score (-infinity if no match possible, infinity if needle == haystack, * otherwise unbounded: ~0.9 + (n-1) for a perfect length-n consecutive match) */ -double computeScore(const QString &needle, const QString &haystack, QVector *positions = nullptr); +double computeScore(const QString &needle, const QString &haystack, QList *positions = nullptr); /** * @brief Main scoring function for use in SQLite callbacks diff --git a/src/libs/util/tests/fuzzy_test.cpp b/src/libs/util/tests/fuzzy_test.cpp index 4780450a..175be939 100644 --- a/src/libs/util/tests/fuzzy_test.cpp +++ b/src/libs/util/tests/fuzzy_test.cpp @@ -110,7 +110,7 @@ void FuzzyTest::testFuzzyMatch() void FuzzyTest::testPositionsFuzzy() { - QVector positions; + QList positions; double fuzzyScore = score(QStringLiteral("abc"), QStringLiteral("aXbXc"), &positions); QVERIFY(fuzzyScore > 0); @@ -122,7 +122,7 @@ void FuzzyTest::testPositionsFuzzy() void FuzzyTest::testPositionsExact() { - QVector positions; + QList positions; double exactScore = score(QStringLiteral("test"), QStringLiteral("prefix_test"), &positions); QVERIFY(exactScore > 0); @@ -136,7 +136,7 @@ void FuzzyTest::testPositionsExact() void FuzzyTest::testCamelCase() { // Should detect camelCase word boundaries - QVector positions; + QList positions; double camelScore = score(QStringLiteral("path"), QStringLiteral("HasPermissionForPath"), &positions); QVERIFY(camelScore > 0); @@ -162,7 +162,7 @@ void FuzzyTest::testUnicode() void FuzzyTest::testPubTrimIssue() { // Regression test: "pubtrim" should highlight Publisher + toTrim, not prototype - QVector positions; + QList positions; score(QStringLiteral("pubtrim"), QStringLiteral("Publisher.prototype.toTrim"), &positions); QCOMPARE(positions.size(), 7); @@ -177,7 +177,7 @@ void FuzzyTest::testPubTrimIssue() void FuzzyTest::testPubProtIssue() { // Regression test: "pubprot" should highlight Publisher + prototype - QVector positions; + QList positions; score(QStringLiteral("pubprot"), QStringLiteral("Publisher.prototype.fieldsToTrim"), &positions); QCOMPARE(positions.size(), 7); @@ -252,7 +252,7 @@ void FuzzyTest::testEqualLengthNonMatching() void FuzzyTest::testSpecialCharacters() { // Should handle special characters - QVector positions; + QList positions; double s = score(QStringLiteral("a-b"), QStringLiteral("foo-a-bar-b"), &positions); QVERIFY(s > 0); QCOMPARE(positions.size(), 3); @@ -390,7 +390,7 @@ void FuzzyTest::testManyGapsNegativeScore() void FuzzyTest::testPositionsClearedOnNoMatch() { - QVector positions; + QList positions; positions.append(1); positions.append(2); positions.append(3); @@ -404,7 +404,7 @@ void FuzzyTest::testPositionsClearedOnNoMatch() void FuzzyTest::testPositionsForInfinityScore() { - QVector positions; + QList positions; // Equal length exact match should return infinity and fill positions sequentially double s = score(QStringLiteral("test"), QStringLiteral("test"), &positions); @@ -463,7 +463,7 @@ void FuzzyTest::testSpaceHandling() // Spaces are treated as literal characters in fzy algorithm // They must match exactly and give word boundary bonus to the next character - QVector positions; + QList positions; // Space in needle matches space in haystack double spaceMatch = score(QStringLiteral("a b"), QStringLiteral("a b"), &positions); @@ -515,7 +515,7 @@ void FuzzyTest::testBacktrackingPrefixConflict() // matchRequired. M[i][j] reflects the global prefix optimum (s,t,r at 0,1,2 // decaying via gaps), not the path being backtracked, so matchRequired // incorrectly dropped to false and the algorithm fell back to j=0,1. - QVector positions; + QList positions; score(QStringLiteral("string"), QStringLiteral("str::to_string"), &positions); QCOMPARE(positions.size(), 6); @@ -536,7 +536,7 @@ void FuzzyTest::testBacktrackingWordBoundaryWins() // The 'S' at position 0 (slash bonus 0.9) builds up an M score that is // higher than D at position 7 (word boundary bonus 0.8), causing the same // matchRequired bug to drop false and fall back to j=0 for the first char. - QVector positions; + QList positions; score(QStringLiteral("string"), QStringLiteral("Static String"), &positions); QCOMPARE(positions.size(), 6);