aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Update dependencies on '6.7' in qt/qtdeclarativev6.7.0-beta1Qt Submodule Update Bot2023-12-121-5/+5
| | | | | Change-Id: Ia2dd1ddb1ef7177830b2770fc11b7421bb6f63b2 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Doc: Move Flipable, Dial Control example to UI Components categoryKai Köhne2023-12-112-2/+2
| | | | | | | | | | Arguably fits better than Graphics & Multimedia. Pick-to: 6.6 Change-Id: I2604d5f43621a73ad28d01532e6ad8ec121a2e29 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit f3f3de6c38c14a2cd3771916f26bcd926208e7cd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix translated messages of QQuickTextDocument's load/save functionalityFriedemann Kleint2023-12-111-2/+2
| | | | | | | | | | Use placeholders. Amends b46d6a75ac16089de1a29c773e7594a82ffea13e. Change-Id: Ie013879962f665d3337ba9ed71558ec142d3eee1 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit 7cdcaba54c6cbe3fd54a3adb764404820237e27d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* MessageDialog: make QQuickAbstractDialog::result return button pressedOliver Eftevaag2023-12-107-27/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The widgets QMessageBox returns either the StandardButton value of the last button pressed, or the index, in the case of custom buttons. This differs from how we did things in quick, where we'd always return either 0 or 1 (Accepted or Rejected). The documentation even states the following: MessageDialog sets the result to the value of the clicked standard button instead of using the standard result codes Which was incorrect, since the result property functioned the same, regardless of dialog type. The goal of this patch is to make the result property for MessageDialog behave the same as QMessageBox, without changing the behavior for other dialog types. In order to accomplish this, the type has to be changed from StandardCode to int, since the result value can either be a StandardCode value, or a StandardButton value. The widget QMessageBox also differs in that it will not emit rejected when the user presses a button with a role that isn't NoRole or RejectRole. I've decided to make the MessageDialog behave the same way. [ChangeLog][QtQuick][Dialogs][Important Behavior Changes] The MessageDialog will no longer emit rejected when the user presses a button that doesn't have the role NoRole or RejectedRole. Task-number: QTBUG-118445 Task-number: QTBUG-118689 Task-number: QTBUG-118212 Change-Id: I7084a889210027f5c057f5c22eee2e08867ce741 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Update dependencies on 'dev' in qt/qtdeclarativeQt Submodule Update Bot2023-12-101-5/+5
| | | | | Change-Id: I08ef5f1e54a532df96317ba50cc3fee8f2b90c9f Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* Fix IconImage test on systems with mixed DPR displaysVolker Hilsheimer2023-12-091-30/+21
| | | | | | | | | | | | | | | | When running on a system with two displays with different DPR values, it used the highest value of all systems (which is what QGuiApplication::devicePixelRatio returns). Some tests then failed when the test's windows opened on the lower-DPR display, and other tests failed when the windows opened on the high-DPR display. Fix this by initializing the DPR values in each test function after the view is shown, reading the DPR value from that view. Fold the skipping if the DPR is too high into that macro. Pick-to: 6.6 Change-Id: I2b2f3540e26ee0c65d7ef62dd9b11640b5ca0274 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Get rid of DocumentHandler in the Text Editor exampleShawn Rutledge2023-12-098-555/+22
| | | | | | | | ...and fix a couple of minor issues that remained. Fixes: QTBUG-81022 Change-Id: I5fc1547fb09caef5a9e24d95c2ca7b8d78ee104a Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Update dependencies on 'dev' in qt/qtdeclarativeQt Submodule Update Bot2023-12-091-5/+5
| | | | | Change-Id: I7ca1437e59ee8810fa87725aa98f554b2801028b Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* qmlls: find usages of enumerationsSemih Yavuz2023-12-096-45/+136
| | | | | | | | | | | | | | | | | | Enumerations in Qml are bound to file component they are defined in. Qml engine doesn't allow to have same named enum in the same scope, but it allows having the same named enum within another scope. Nevertheless, they have no way to be accessed, for example it is not possible to use <FileName>.<EnumValue> for an enum declared inner scope. Consider this limitation, don't find the enum values defined in inner scopes. Introduce finding enum names. Also fix a completion test that was using enums with incorrect semantics. This has to be squashed into this commit otherwise test would break. Change-Id: I1c4f46dd3ee1de4e04021cb35614a15be566105d Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Add TextSelection (Tech Preview)Shawn Rutledge2023-12-088-51/+463
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the Controls text editor example, DocumentHandler always sounded like a hack, just by its name. We don't expect to be able to handle multiple selections anytime soon; but if we realistically expect to have multi-seat support in Qt some day, then probably the multi-user experience should include support for multiple text cursors and selections. So we shouldn't paint ourselves into a corner. QQuickTextControl works with only one QTextCursor most of the time (but it's private, thus modifiable); and TextEdit has properties like selectionStart, selectionEnd, selectedText, etc. which seem to assume that there is only one selection. So probably if we needed to support multiple selections, we could add Q_PROPERTY(QQmlListProperty<QQuickTextSelection> selections ...), document that those legacy properties just work with the first selection, and/or deprecate them. So with that in mind, let's get started with a QQuickTextSelection object. We add TextEdit.cursorSelection which holds the single selection near the text cursor. It provides API needed for tracking and manipulating often-used properties of selected rich text (such as QTextCharFormat properties) so that DocumentHandler can be removed. The example now uses TextArea.cursorSelection to manipulate the selected text's format. It's not possible to be fully declarative with this API though; we need to call setFont (by assigning a font), but QFont is a value type, and is not as mergeable as QTextCharFormat is, for example. If we used a binding rather than Action.onTriggered, it would trigger reading the font for an entire span of selected text (which may have had multiple fonts), setting one attribute (like bold), then applying the font to the whole span. What we do now is almost like that; but instead of reading the font first, we start with a default-constructed QFont, set one attribute, and call QTextCursor::mergeCharFormat(), in the hope that it can merge only the features of QFont that have actually been set. Unfortunately this is not quite true either: if you toggle the bold button, it might change the font size too, and so on; so maybe we really need QTextCharFormat in QML (as a value type, presumably) to implement those feature-toggling toolbar buttons correctly. This API is in tech preview, because of such issues as described above; because we're just scratching the surface of what might be possible; because we should perhaps compare popular JavaScript text-editing APIs that might be found elsewhere, in the meantime get feedback from users during the tech preview phase, and keep iterating. [ChangeLog][QtQuick][TextEdit] TextEdit.cursorSelection is a TextSelection object, which provides properties to inspect and modify the formatting of the single selection that is currently supported. This API is in Tech Preview. [ChangeLog][Controls][TextArea] TextArea.cursorSelection is a TextSelection object, which provides properties to inspect and modify the formatting of the single selection that is currently supported. This API is in Tech Preview. Task-number: QTBUG-36521 Task-number: QTBUG-38830 Task-number: QTBUG-81022 Change-Id: Icea99f633694aa712d0b4730b77369077288540f Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* TestCase: use strict (in)equality operators whenever possibleVladimir Belyavsky2023-12-081-35/+35
| | | | | | | | | Use strict `===`/'!==` operators in all places where possible to avoid type coercion and fix QML run-time check warning M126 in Qt Creator. Change-Id: I24aa3c5438da4f161dbf82725b00055b65374879 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* TestCase: use `let` instead of `var`Vladimir Belyavsky2023-12-081-57/+57
| | | | | | | Change-Id: I98ffa53dc54bdff29df1cfb9bb014857fc0aab3c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Don't crash when calling coerceAndCall() with null thisObjectUlf Hermann2023-12-084-2/+37
| | | | | | | | Pick-to: 6.6 6.5 Fixes: QTBUG-119395 Change-Id: I5877beef9a53d358a6f58f9ce5029688bd9dcedb Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQuickItem: Make focusReason property read-only from QMLDoris Verria2023-12-082-1/+2
| | | | | | | | | | | | | | The focusReason shouldn't be set through this property, but rather the event delivery and focus transfer mechanisms in C++ should take care to set it. If users need to set the reason from QML, it should be done through the invokable QQuickItem::setActiveFocusReason(Qt::FocusReason). [ChangeLog][QtQuick][Item] focusReason property is read-only. Task-number: QTBUG-117596 Change-Id: I9bd1fa3af2e9dade90f9834a14b2fc43014d2ffa Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove focus-related duplicated members from subclassesDoris Verria2023-12-086-54/+2
| | | | | | | | | | Now that focusReason and visualFocus moved to QQuickItem, we don't need to have duplicated data members or methods in subclasses. Task-number: QTBUG-117596 Change-Id: Id0e363f18993c4a74b9b6e5b6b26a7d0f2817441 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Move focusPolicy from QQuickControl to QQuickItemDoris Verria2023-12-086-38/+47
| | | | | | | | | [ChangeLog][QtQuick][Item] The focusPolicy property has now moved from QQuickControl to QQuickItem. Task-number: QTBUG-117596 Change-Id: I3a3d5c26f4d7a8bd4890b3e4fdfc34d6e716362b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Move focusReason from QQuickControl to QQuickItemVolker Hilsheimer2023-12-088-29/+62
| | | | | | | | | | [ChangeLog][QtQuick][Item] The focusReason property has now moved from QQuickControl to QQuickItem. Task-number: QTBUG-117596 Change-Id: I7ddfbe535b6f0e7289dd3408a074ad0b8aa4de01 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Attempt to stabilize tst_qquicktextedit::embeddedImages()Shawn Rutledge2023-12-082-2/+2
| | | | | | | | | An import version < 64 makes the error message say QML QQuickPre64TextEdit*: Error transferring http://... which didn't match the expectation that the error is in TextEdit Change-Id: I67e526a6409b599b379d5b1b9bffb62bf1d97350 Reviewed-by: Doris Verria <doris.verria@qt.io>
* Doc: Fix description on how to load the extending-qml sourcesKai Köhne2023-12-081-10/+11
| | | | | | | | | | | | | The tutorial is not a qdoc 'example' anymore , and therefore also do not show up in the Qt Creator welcome screen. While at it, also remove the version from the QML import snippet. Task-number: QTBUG-119663 Pick-to: 6.6 Change-Id: Ib32b6fc9a4c80001f6ab30d8f38bce129e5209a0 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Preferably wrap types in QJSPrimitiveValue for SetLookupUlf Hermann2023-12-083-2/+26
| | | | | | | | | If we store one primitive type inside another, we cannot get its content pointer. Change-Id: I7088685fdd2633085de732aab87b4b5f93300b90 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* doc: Mention that TextBesideIcon is the default display modeJoshua Goins2023-12-081-1/+1
| | | | | | | | | | It's not clear without digging into the internals that this is the default value for AbstractButton's display property. This now clearly show's that it's the default. Pick-to: 6.5 6.6 Change-Id: I7dcb22da98a8ced457ada9800bebed409bfcedfa Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* qmlformat: Don't remove newlines between import statementsJoshua Goins2023-12-085-2/+52
| | | | | | | | | | | | When writing QML files, it's common to use newlines to separate groups of import statements (e.g. separating imports from Qt and your own.) Now qmlformat will preserve the newline grouping, but ensure that it's only one newline and will strip out extra ones. A test is added to ensure this does not regress. Pick-to: 6.5 6.6 Change-Id: I8f158c46886bc0be2313a0e57d6b7c52a1df28fa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlls: add manual test for automatic qmlls cmake type registrationSami Shalayel2023-12-086-0/+129
| | | | | | | | | | Add a manual test for the CMake type registration, along with instructions on what to test. Task-number: QTBUG-118705 Change-Id: I36bb752fd255f9235f27dc382f8be477ff24a283 Reviewed-by: Semih Yavuz <semih.yavuz@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlls: unary expression support for completionSami Shalayel2023-12-083-2/+116
| | | | | | | | | | | | | | | | | Previously, the unary expression would get the completion of the parent. So an expression statement like `++<something>` would propose JS statements after the `++` (like a let statement, for example). Fix this by implementing completion for unary expressions, now that unary expression have a Dom representation. Also fix some completion test for for-statements, as they were testing the increment operator completions instead of the for statement completion itself. Task-number: QTBUG-119798 Change-Id: If9fccb3d48f9e608af2b6d92bda70886ae462480 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* dom: add representation for unary expressionsSami Shalayel2023-12-0815-0/+390
| | | | | | | | | | | | | | | | | | | | | | | | | Add a Dom representation for unary expressions. This is needed to enable correct completion inside of unary expressions (see commit in relation chain). Like BinaryExpression, group them all together under two DomTypes: ScriptUnaryExpression (++i, +i, new i, ...) and ScriptPostExpression (i++ and i--). Most unary expression share a common trait: they have one subexpression. Add a makeUnaryExpression helper method in qqmldomastcreator to take care of creating a basic unary expression, and use it for all required visit overloads. Later on, one could add the actual type happening in the unary expression by adding the operator type (post increment, unary plus, new operator) in the Dom representation (just as the BinaryExpression already does that). This is not needed for the completions, but that could be added if necessary later. Task-number: QTBUG-119798 Task-number: QTBUG-92876 Change-Id: I28414dafe68c4aabd8d9a8f0cf07865d2ab72dd3 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add preliminary support for embedding QWindows into Qt QuickTor Arne Vestbø2023-12-0823-30/+1541
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new WindowContainer item allows embedding arbitrary windows into the Qt Quick scene, including foreign windows such as native map or web views. A new parent property is also added to Window, allowing these to be embedded inside other Items without the need for an explicit window container, along with a new z property, allowing modifications to the child Window's stacking order. Splitting the Quick document up into child windows allows interesting use-cases, such as setting a different surface format on the child window, for example for enabling HDR without affecting the rest of the UI. The embedded windows are managed as a child windows of the root QQuickWindow, with positioning, sizing, and stacking order reflecting the implicit or explicit window container item. Clipping is also supported, by setting a mask on the embedded window. The advantage of managing all embedded windows as as children of the root window is that we always have a QQuickWindow to handle the stacking order, we're not limited by the platform surface clip, and don't risk being interleaved behind native parts of the window we embed into that we don’t control. [ChangeLog[Quick] Preliminary support for embedding QWindows into the Qt Quick scene has been added, along with a parent property on Window, to allow setting a visual parent of the Window. Task-number: QTBUG-102835 Change-Id: I78b973e2685fb0ebbc850a110712f3e747bfe09a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Remove duplicated import in qtquickcontrols-selectionrectangle.qmlVladimir Belyavsky2023-12-081-2/+0
| | | | | | | | | Remove extra QtQuick import and fix QML run-time check warning M400 in Qt Creator. Pick-to: 6.5 6.6 Change-Id: I0268d796af8dcceda336439ae9e533e53161980d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QmltcCompiler: Adhere to Compare requirement ("!(a < a)")Michael Weghorn2023-12-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Compare requirements [1] say: > The return value of the function call operation applied to an object of > a type satisfying Compare, when contextually converted to bool, yields > true if the first argument of the call appears before the second in the > strict weak ordering relation induced by this type, and false otherwise. That requirement was violated here, because passing the same value for both arguments would return true, since the inlineComponentB->inherits(inlineComponentA) check returns true when both inline components are the same. Add an equality check to fix that. Fixes a build failure when building with CXXFLAGS='-D_GLIBCXX_DEBUG': /usr/include/c++/13/bits/stl_algo.h:4892: In function: void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = QList<variant<QString, monostate> >::iterator; _Compare = QmltcCompiler::compile(const QmltcCompilerInfo&)::<lambda(const QmltcCompiler::InlineComponentOrDocumentRootName&, const QmltcCompiler::InlineComponentOrDocumentRootName&)>] Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)). Objects involved in the operation: instance "functor" @ 0x7ffec14329f8 { type = QmltcCompiler::compile(QmltcCompilerInfo const&)::{lambda(std::variant<QString, std::monostate> const&, std::variant<QString, std::monostate> const&)#1}; } iterator::value_type "ordered type" { type = std::variant<QString, std::monostate>; } Aborted (core dumped) ninja: build stopped: subcommand failed. GDB backtrace: Program terminated with signal SIGABRT, Aborted. #0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44 44 ./nptl/pthread_kill.c: No such file or directory. (gdb) bt #0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44 #1 0x00007fbe6b4a815f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78 #2 0x00007fbe6b45a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #3 0x00007fbe6b4444b2 in __GI_abort () at ./stdlib/abort.c:79 #4 0x00007fbe6b6a300d in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #5 0x0000560ae899bec4 in std::sort<QList<std::variant<QString, std::monostate> >::iterator, QmltcCompiler::compile(const QmltcCompilerInfo&)::<lambda(const QmltcCompiler::InlineComponentOrDocumentRootName&, const QmltcCompiler::InlineComponentOrDocumentRootName&)> >(QList<std::variant<QString, std::monostate> >::iterator, QList<std::variant<QString, std::monostate> >::iterator, struct {...}) (__first=..., __last=..., __comp=...) at /usr/include/c++/13/bits/stl_algo.h:4892 #6 0x0000560ae898bd67 in QmltcCompiler::compile (this=0x7ffec1432e80, info=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltccompiler.cpp:85 #7 0x0000560ae89264b6 in main (argc=23, argv=0x7ffec1434fc8) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/main.cpp:284 [1] https://en.cppreference.com/w/cpp/named_req/Compare Change-Id: Ie8934b8381ef217c1f8860ee110f6fa2aa0c86fa Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* QmltcVisitor: Fix sort order of array used with std::binary_searchMichael Weghorn2023-12-081-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using std::binary_search has the requirement that the passed range fulfils ordering requirements, which was not the case for the cppKeywords array here. As the QString doc says [1]: > QStrings can be compared using overloaded operators such as operator<(), > operator<=(), operator==(), operator>=(), and so on. Note that > the comparison is based exclusively on the numeric Unicode > values of the characters. It is very fast, but is not what a > human would expect; (...) Therefore, sort the array accordingly and add an assert to ensure it will remain sorted. Fixes an crash/assert when building qtdeclarative with CXXFLAGS='-D_GLIBCXX_DEBUG': /usr/include/c++/13/bits/stl_algo.h:2243: In function: bool std::binary_search(_FIter, _FIter, const _Tp&) [with _FIter = const QString*; _Tp = QStringView] Error: elements in iterator range [first, last) are not partitioned by the value __val. Objects involved in the operation: iterator "first" @ 0x7ffc4a2c4f18 { type = QString const* (constant iterator); } iterator "last" @ 0x7ffc4a2c4f10 { type = QString const* (constant iterator); } Aborted (core dumped) ninja: build stopped: subcommand failed. GDB backtrace: Program terminated with signal SIGABRT, Aborted. #0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44 44 ./nptl/pthread_kill.c: No such file or directory. (gdb) bt #0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44 #1 0x00007f307e0a815f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78 #2 0x00007f307e05a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #3 0x00007f307e0444b2 in __GI_abort () at ./stdlib/abort.c:79 #4 0x00007f307e2a300d in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6 #5 0x00005639ff90471d in std::binary_search<QString const*, QStringView> (__first=0x5639ffa1a9c0 <QmltcVisitor::checkForNamingCollisionsWithCpp(QDeferredSharedPointer<QQmlJSScope const> const&)::cppKeywords>, __last=0x5639ffa1b2c0 <guard variable for QmltcVisitor::checkForNamingCollisionsWithCpp(QDeferredSharedPointer<QQmlJSScope const> const&)::cppKeywords>, __val=...) at /usr/include/c++/13/bits/stl_algo.h:2243 #6 0x00005639ff8fb837 in operator() (__closure=0x7ffc4a2c52bf, word=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:764 #7 0x00005639ff8fb89e in operator() (__closure=0x7ffc4a2c52a0, name=..., errorPrefix=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:768 #8 0x00005639ff8fc99b in QmltcVisitor::checkForNamingCollisionsWithCpp (this=0x7ffc4a2c6070, type=...) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:787 #9 0x00005639ff8f9dea in QmltcVisitor::endVisit (this=0x7ffc4a2c6070, program=0x563a002e0628) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltcvisitor.cpp:341 #10 0x00007f307f6636fa in QQmlJS::AST::UiProgram::accept0 (this=0x563a002e0628, visitor=0x7ffc4a2c6070) at /home/michi/development/git/qt5/qtdeclarative/src/qml/parser/qqmljsast.cpp:1193 #11 0x00007f3080159b8f in QQmlJS::AST::Node::accept (this=0x563a002e0628, visitor=0x7ffc4a2c6070) at /home/michi/development/git/qt5/qtbase/include/QtQml/6.7.0/QtQml/private/../../../../../../qtdeclarative/src/qml/parser/qqmljsast_p.h:272 #12 0x00007f3080212f4b in QQmlJSTypeResolver::init (this=0x7ffc4a2c5b50, visitor=0x7ffc4a2c6070, program=0x563a002e0628) at /home/michi/development/git/qt5/qtdeclarative/src/qmlcompiler/qqmljstyperesolver.cpp:173 #13 0x00005639ff8f0bd3 in QmltcTypeResolver::init (this=0x7ffc4a2c5b50, visitor=0x7ffc4a2c6070, program=0x563a002e0628) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/qmltctyperesolver.cpp:19 #14 0x00005639ff8c02d4 in main (argc=23, argv=0x7ffc4a2c7a68) at /home/michi/development/git/qt5/qtdeclarative/tools/qmltc/main.cpp:269 [1] https://doc.qt.io/qt-6/qstring.html#comparing-strings Change-Id: I82ebbcdca4ab90155b935f9af24b3a3821134563 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Call QQuickItemPrivate::transformChanged when the clip is dirtiedTor Arne Vestbø2023-12-081-2/+2
| | | | | | | | | | An item that observes the viewport may use this to do clipping via QQuickItem::clipRect(), in which case changing the clip of a parent item needs to be reflected by a transformChanged call for the observing item. Change-Id: I02df01a6ff6d48695bcf55a65983966c0575d86b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* MessageDialog: Dont rely on accept or reject signal emissions from QPAOliver Eftevaag2023-12-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, all native dialog implementations need to emit the QPlatformDialogHelper::accept and QPlatformDialogHelper::reject signals, in order for the QQuickAbstractDialog to be able to react to changes and update its visibility property. This makes sense for most dialogs, that have 2 buttons ("Ok" and "Cancel"). The MessageDialog however, is more complicated in that it can have an arbitrary number of buttons. To further complicate things, it can also have buttons with other roles than simply YesRole|AcceptRole|NoRole|RejectRole. Because of this, the native message dialogs will sometimes only emit QPlatformMessageDialogHelper::clicked, which makes QQuickMessageDialog responsible for figuring out what to do next. This patch fixes the issue by calling close() in handleClick(). This is safe to do, since currently all of our native message dialog implementations close after any button is pressed. It is very important that the QQuickAbstractDialog and native dialog are in agreement as to whether a dialog is currently open or not. In cases where there is a mismatch, a new dialog will never be able to be opened again, since QQuickAbstractDialog will return early when the user attempt to open a dialog that it believes is already showing. [ChangeLog][QtQuick][Dialogs] The MessageDialog will now close when a button is pressed, regardless of the button's role. Pick-to: 6.6 6.5 Task-number: QTBUG-118689 Fixes: QTBUG-118445 Fixes: QTBUG-118212 Change-Id: I67a7c575fe5ce8a595eb71cf7056a1d8709ff50d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* doc: Clarify focus window vs activation in Key Handling OverviewTor Arne Vestbø2023-12-081-2/+2
| | | | | | Pick-to: 6.6 6.5 6.2 Change-Id: I837e72448577e6814acf20cef49f4528e2ac6ba7 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Add load/save functionality to QQuickTextDocument (Tech Preview)Shawn Rutledge2023-12-0812-16/+418
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since QTBUG-92155 is not done, we need an easy way to load and save text into and out of a QTextDocument in QML. This patch follows the pattern from Image and other types: add a `source` property, a URL from which the file is to be loaded. When it comes to saving, the pattern is not set: so far the only file writing that has been available from QML is ItemGrabResult.saveToFile(). Since we need to save in specific formats, it makes sense to continue that pattern: the text document knows how to do its own serialization, so this is not suitable for generic data file I/O, even if we did have a QML API for that. We add invokable functions save() and saveAs() for the usual use cases in word processors and such. The URL extension determines the file format. Setting QQuickTextDocument's source is not allowed if the document has unsaved changes. The user (app author) needs to call save() or override modified to false first. [ChangeLog][QtQuick][TextEdit] TextEdit.textDocument now has a source property for loading files; save() and saveAs() functions for writing; a modified property which tracks QTextDocument::modified; and an error signal in case any of these operations fail. Setting the source property is allowed only if the document is in unmodified state. This API is in Tech Preview. [ChangeLog][Controls][TextArea] TextArea.textDocument now has a source property for loading files; save() and saveAs() functions for writing; a modified property which tracks QTextDocument::modified; and an error signal in case any of these operations fail. Setting the source property is allowed only if the document is in unmodified state. This API is in Tech Preview. Change-Id: I687318523c7a520e02244e47224d067da55318b5 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* TextEdit example: Add more FontAwesome icons to fontello.ttfShawn Rutledge2023-12-081-0/+0
| | | | | | | We'll soon be adding functionality to this example. Change-Id: If084ce88b3008bfccc96e9ae059b32a99df9cfdf Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Curve renderer: drop the control point magic for line elementsEirik Aavitsland2023-12-083-11/+24
| | | | | | | | | | | | | | | | | Now that we are adding ever more manipulations of quadpaths, relying on this silent state to not having been lost on the way is bugprone. Also, being instead able to rely on the control point of a line always being the line's midpoint, so that the element is a valid representation even if treated as quad curve, makes for more resilient code: it can make it optional whether to treat lines specially. So replace the magic value by a new Element method referencePoint(), that returns the control point for curves and the inside point for lines, and use that in the one place that used to rely on the special line control point. Change-Id: Id54b9034d23d7bc7794f2f77fab36fbfe137a60e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Use the PlatformServiceColorPicker for the ColorDialog's eye dropperOliver Eftevaag2023-12-081-3/+20
| | | | | | | | | | | | | | | | | On wayland, it's not possible to use QScreen::grabWindow(), in order to to pick a color from the screen. However, it is possible to use the XDG desktop portal, to pick a color for us. In qtbase the commit 00a8957cef8f9406346d299da03f595427078f43 added a new virtual function pickColor() to QPlatformService. This patch takes advantage of this new API, to prioritize using this new platform service if available, and fallback to the old behavior in case it's not supported for the current platform. Change-Id: Ia155531ff4e6ee1446f122dcb44d90753c11846b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Update dependencies on 'dev' in qt/qtdeclarativeQt Submodule Update Bot2023-12-071-5/+5
| | | | | Change-Id: I96aa155cda389cc18442064f49defc44532aa5d9 Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
* qmltyperegistrar: Complain less about missing base typesUlf Hermann2023-12-071-18/+42
| | | | | | | | | | | | | | | If we have multiple base types, we can only use one anyway. The rest must be undeclared interfaces or C++-only types. We don't need to complain about those. Furthermore, base types of value types don't have to be registered. Don't complain about these either. Amends commit 68875816b4c2ee8a7eb70b25d839e0555ff8ce3f. Change-Id: I97daeab10ddc9e04634960044b24418ef222429f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: Use QtDeployTargets.cmake for deploying QML pluginsJoerg Bornemann2023-12-071-15/+22
| | | | | | | | | | If QtDeployTargets.cmake contains information for a QML plugin, use it to deploy the correct file. Fall back to the old file name heuristics if the information is missing. Change-Id: If3820cf10530b1944dc00b1724a3ea276b25131e Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Deploy runtime dependencies of QML pluginsJoerg Bornemann2023-12-071-0/+10
| | | | | | | | | | | | | | | On Windows, we only deployed the Fooplugin.dll of a QML module Foo. The backing library was missing. The reason was the file path heuristics we employ that looks for '/Fooplugin.*\.dll'. That doesn't take into account the backing library. Now, we use the QtDeployTargets.cmake information that is generated on project configuration and deploy the DLLs that are used at runtime. Pick-to: 6.5 6.6 Fixes: QTBUG-117948 Change-Id: I6d26405814ca2bc66bfa308cf4d23e42cbbfeb7f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QmlFormat: Support .js files (in memory formatting)Dmitrii Akshintsev2023-12-0731-10/+368
| | | | | | | | | | | | | | | | | Previous commits in the stack introduced the possibility of loading .js files to the DOM environments and keeping the content inside the corresponding JSFile abstraction. This commit introduces 1. writeOut method for the JSFile required by the qmlformat 2. formatting of .import .pragma library directives & helper objects 3. Adding support of JSFile in OutWriter::updatedFile 4. Tests covering in Memory formatting Task-number: QTBUG-117849 Change-Id: I741f06058aec8a280f64b05a755d25fc8fe1d1f7 Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Revert "CMake: Fix the all_qmllint* targets for Visual Studio generators"Joerg Bornemann2023-12-071-36/+26
| | | | | | | | | | | | | | | This reverts commit f81945e1d79f69c27340cc2ba1a5919957eae514. Reason for revert: this introduces a regression for VS projects. If qt_add_qml_module is called in different subdirectories then we cannot add the PRE_BUILD step to the all_qmllint target. CMake will complain: TARGET 'all_qmllint' was not created in this directory. Fixes: QTBUG-119838 Task-number: QTBUG-115166 Change-Id: I3c61b30891151abe1da9389db36b21adc7239f21 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* qmlls: support completions in conditional expressionsSami Shalayel2023-12-079-0/+121
| | | | | | | | | | | Add a dom representation for conditional expressions, and implement completions for those. Task-number: QTBUG-92876 Task-number: QTBUG-119798 Change-Id: Iace8c79ba2870597b0d64ae5e3723aa54a7f1ea4 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlls: completions for comma expressionsSami Shalayel2023-12-076-0/+83
| | | | | | | | | | | | | | | | Represent comma expressions as BinaryExpressions in the Dom, as comma expressions behave very similarly to binary expressions. This means that completions for comma expressions can reuse the already existing completion for binary expression, and no new code has to be added for that. Still, add a test to make sure completion works as expected, and another to make sure the dom representation is correctly constructed. Task-number: QTBUG-92876 Task-number: QTBUG-119798 Change-Id: I7c61abaa4dc6a153e318322e4d64211231e63e3a Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlls: suggest break and continue only where actually allowedSami Shalayel2023-12-073-4/+152
| | | | | | | | | | | | | | Update the suggestion for break and continue statements in suggestJSStatementCompletion() to support the newly introduced labelled statements. The break and continue keywords can both occur inside of loops, but break can also occur when (nested) inside a labelled statement or when (nested) inside a switch statement. Task-number: QTBUG-117445 Change-Id: I6d08ec4dfa10c76110ba910f6f98e227539c4e54 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlls: fix method body and statement completionSami Shalayel2023-12-077-36/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems that the Dom construction was not creating a block for empty function bodies. This led to a bug where completion was not working inside an empty method bodies, so fix it in this commit. Add a test in tst_qmldomitem for this case. Also, it seems that the (non-empty) function bodies had the wrong SourceLocations: instead of starting and ending at the `{}` tokens, they were starting at the start and end of the statementlist. This was making the completion stop working, for example in ``` function f() { return 3; } <-body--> (old source location) <----------body-----------> (new source location) <-------> <--------> (where completion failed) ``` you would not get any JS statement completion in the whitespace before or after the return statement. Also, use the CompletionContext when completing JS statements. This is because expression statements need the context to provide correct autocompletion of field member expressions like `root.<completion here>`. Add a test for both cases, and replace the QEXPECT_FAIL test "inMethodBody" with "insideMethodBody". There is no need to test for keywords like "for", "while", and co anymore: these JS statements are already being proposed as snippets, and these snippets already have their own tests. Task-number: QTBUG-117445 Change-Id: Ia9157087524fbb1fc0f9cf64502887b4630af6b9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmldomastcreator: simplify logic for function declarationsSami Shalayel2023-12-071-55/+53
| | | | | | | | | | | | That code was written before the introduction of the Q_SCRIPTELEMENT_EXIT_IF() macro, and contains way too many `if (m_enableScriptExpressions)`. Replace these ifs with Q_SCRIPTELEMENT_EXIT_IF where applicable. This prepares for the following commit fixing the missing BlockStatement for empty function bodies. Change-Id: I704c3ce814fe2575c4bfce0519639837a84de0a5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Add generic QVariant-to-typed comparisonUlf Hermann2023-12-079-12/+184
| | | | | | | Since we have a lot more shadowable values now, we need to add this. Change-Id: Ie9f389730bb6f330b1cd28f9229c5dd143727e4f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* DOM: Add js code holder to JsFileDmitrii Akshintsev2023-12-075-4/+37
| | | | | | | | | | | | | | This commit introduces 1. A new ScriptExpression Type designated to represent the "whole" file as one ScriptExpression. 2. ScriptExpression member of JsFile class holding the content of the file 3. Corresponding test Change-Id: I61de118f923a1d763f938822c8adf29bd65754b9 Task-number: QTBUG-117849 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
* QmlCompiler: Do not adjust renamesUlf Hermann2023-12-074-0/+39
| | | | | | | | | | | | A rename always produces a register with exactly one tracked type, but we do not want to use it as base for the type adjustments. We want to adjust based on the original location and its readers (which includes any renames). Pick-to: 6.6 6.5 Change-Id: Iaefdf56992c7c101a35a056fb93c49ade5ccf393 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>