aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickstackview_p_p.h
Commit message (Collapse)AuthorAgeFilesLines
* StackView: fix heap-use-after-free when pushing after clearMitch Curtis2020-05-291-1/+2
| | | | | | | | | | | | | This patch extends the work done in aaec25a7 to cover all operations. Note also that b94889f4 does a similar thing to this patch and aaec25a7, in that it explicitly ignores operations that are done during the removal of elements. Fixes: QTBUG-84381 Pick-to: 5.15 Change-Id: Id8bbbded39d8e58bcf0e8eedeb2dde794952333f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Add missing overrideAlexander Volkov2020-05-251-1/+1
| | | | | | Pick-to: 5.15 Change-Id: I29af6f91ed90395ce3fdb92081d54a17f16d58e0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Update dependencies on 'dev' in qt/qtquickcontrols2Qt Submodule Update Bot2020-03-231-2/+2
| | | | | | | Fix build after internal QtQml API changes. Change-Id: Iaeafb84f5f2d9c60b54659f27e7baa448a858c4a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* StackView: fix crash when recursively removing itemsMitch Curtis2019-12-051-0/+1
| | | | | | | | | | | | | | | | | This can happen when e.g. calling clear() in Component.onDestruction in response to a pop() call. The patch fixes the crash by warning and returning early. If users really need to do this, the clear() call can be delayed: Component.onDestruction: { Qt.callLater(function() { stackView.clear(StackView.Immediate) }) } Change-Id: If3cf07495bb34b96089522f44c36976bd6c62492 Fixes: QTBUG-80353 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Include qstack.h in qquickstackview_p_p.hUlf Hermann2019-05-081-0/+1
| | | | | | | We use QStack below. Change-Id: Ife39904e4e075a9ca5d79a529ca7abd3e3c74fce Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Templates: use C++11 default member initializationJ-P Nurmi2018-05-041-13/+5
| | | | | | | | | | | The code is more readable and less error-prone (this patch caught a few uninitialized members) when the members are initialized in the same place where they are declared. In many cases, empty default destructors can be entirely removed, and we get faster implicitly declared inline default constructors defined by the compiler. Change-Id: I14c5448afc901f9b2ac5965f28c1c26c0b646c08 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix crash with StackView::initialItemSimon Hausmann2018-03-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following binding initialView: Qt.createComponent("blah.qml") works with QQC1 but crashes with QQC2 as soon as the garbage collector kicks in. In QQC1 StackView was implemented in a .qml file and the property was declared as property var initialItem For such declared properties the QML engine takes care of ensuring that the reference assigned is a strong reference towards the GC and it also tracks the life-time of the QObject in case it's explicitly deleted by somebody else. In QQC2 the property continues to be documented as "var" property, however it is implemented in C++ as QVariant property. The QVariant is not known to the GC at all and it also doesn't do life-cycle tracking. The C++ equivalent to "var" in QML is QJSValue, which is a strong reference and also ends up using a QPointer internally when holding a QObject. Task-number: QTBUG-67118 Change-Id: I43e473c7bf2c40f9843e9d50fe4fd805b54fd256 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickStackView: fix emptyChanged()J-P Nurmi2017-05-231-1/+1
| | | | | | | Don't emit emptyChanged() when popping down to 1 element. Change-Id: Iff1e29567d1d6171cea0f158955325389c03800c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add StackView::empty for convenienceJ-P Nurmi2017-05-231-0/+1
| | | | | | | "stack.empty" looks cleaner in bindings than "stack.depth === 0" Change-Id: Ia99ea8ff2a8cf76a752917c239874d24d2103312 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* StackView: resolve relative URLs to the callerJ-P Nurmi2017-04-041-1/+2
| | | | | | Task-number: QTBUG-59309 Change-Id: I3c19d55431dd4831c4510acb5ef0e9fffa8f478f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* StackView: provide better warnings and errorsJ-P Nurmi2017-03-241-2/+2
| | | | | | | | | Check for valid URLs and test object types. Throw warnings when appropriate instead of crashing later. Task-number: QTBUG-59634 Change-Id: Ia269dc8afd31b618f1ff7aec94d684029cb78244 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add QQuickStackViewPrivate::warn() helperJ-P Nurmi2017-03-241-0/+3
| | | | | | | | | Store the current operation name internally to allow throwing informative warnings when component creation fails. Task-number: QTBUG-59634 Change-Id: I7506c5eb4be35878c8abd73a637357e0d8ae08a2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickStackView: fix pop/replace exit leakJ-P Nurmi2017-02-241-1/+3
| | | | | | | | | | | | | | QQuickStackView did not keep track of the element that was exiting the view during a pop/replace exit transition, but it was expecting viewItemTransitionFinished() to be called and cleaned up the element there. If a pop/replace exit transition was running at the destruction time, QQuickStackView did not clean up the element at all (because it had been already removed from the internal stack of elements) and thus the transition was left running. Task-number: QTBUG-59034 Change-Id: I3cd7c761fab79574b9a7cc849788f36765def45b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Format initializer listsJ-P Nurmi2017-01-191-1/+5
| | | | | | | | Initialize one member per line. Allow empty constructors with one initialized member on a single line. Change-Id: Ie115802561ebd19efd4dacda1fa868b64d279109 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add attached StackView.visible propertyJ-P Nurmi2017-01-121-2/+3
| | | | | | | | | | [ChangeLog][Controls][StackView] Added attached StackView.visible property that can be used to control whether items below the top- most item are kept visible. Task-number: QTBUG-56801 Change-Id: Ieead0d476f254886cff5f8457bb5c5d23cb7de8a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2017-01-111-1/+1
|\ | | | | | | Change-Id: If797ac58344b20e8de4379343131c097247ba2f2
| * Welcome to 2017J-P Nurmi2017-01-091-1/+1
| | | | | | | | | | Change-Id: If68cff4efacc7dc5719c8b8e61937e85e9076870 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Rename QQuickStackAttached to QQuickStackViewAttachedJ-P Nurmi2016-10-271-4/+4
| | | | | | | | | | | | | | | | | | | | In QQC1 the attached property was called "Stack", purely because we couldn't have both QML and C++ types with the same name. Now the attached properties are provided by StackView itself, so this is the correct name. Change-Id: I0f98d73735cff14c444a9e843b7cb56dc8a45cd8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Move QQuickStackTransition into its own filesJ-P Nurmi2016-10-271-19/+0
| | | | | | | | | | Change-Id: I87fdef1c2cc5bb2b04c38b54cca316ace8814f2c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Move QQuickStackElement into its own filesJ-P Nurmi2016-10-271-43/+2
|/ | | | | Change-Id: I4fce147f125d4641e1eb3a6534f57d68000dbfc7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8J-P Nurmi2016-09-261-2/+2
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: examples/quickcontrols2/gallery/gallery.qrc src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc src/quicktemplates2/qquickstackview_p.cpp src/quicktemplates2/qquickstackview_p_p.h tests/auto/controls/data/tst_stackview.qml Change-Id: If451fe0e5653572d305b4de90a6d5cb878463e8d
| * Fix a crash in StackView::pop()J-P Nurmi2016-09-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an item is still activating (from a previous pop) when it gets already popped out, we must not set the deactivating status before calling prepareTransition(). This method cancels and finishes the ongoing activation transition, and if the status says that the item was deactivating, the item gets destroyed in the middle of preparing for the deactivation transition. Let prepareTransition() cancel any ongoing transition first, and then set the status after the preparation. The cleanest way is to pass the target status to startTransition() and completeTransition(). Task-number: QTBUG-56158 Change-Id: Id52752200b650ea9f84659bbf43431f8a8b22f1e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | StackView: allow choosing which transition to runJ-P Nurmi2016-07-141-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is mostly useful for being able to use either push or pop transition for replace operations, but there doesn't seem to be any reason to limit the others. So, now it's able to run any of the push/pop/replace transitions (or none with "immediate") for any push/pop/replace operation. [ChangeLog][StackView] Made it possible to choose the visual transition type for any operation. This allows using for example push and pop transitions with replace(), which allows implementing an "infinite" back and forward navigation pattern while keeping the amount of instantiated items constant. Change-Id: I93b87cf854c3d6e2f33ef73ef25ffb3456ec27f4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Refactor QQuickStackView transition startupJ-P Nurmi2016-07-141-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | Merge the separate but very similar looking popTransition(), pushTransition(), and replaceTransition() methods to a single startTransition() method, and pass the necessary arguments in a QQuickStackTransition structure. This is an enabler step for being able to specify the desired transition type for replace (and push & pop, for that matter) operations. Change-Id: Ia68bb94dc9280aace8718f4df0e798a7f1469e78 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickStackView: allocate incubators on the stackJ-P Nurmi2016-06-101-2/+0
|/ | | | | | | | | | Don't keep unnecessary incubator instances alive for all loaded stack elements. Just allocate it on the stack and let it go out of scope. We only use incubators to synchronously to initialize properties during construction. Change-Id: Ide56435ec9c640b9e49356f01476e36120dff5d7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickStackView: fix buildLiang Qi2016-05-201-0/+1
| | | | | | | error: no matching function for call to 'QQmlComponentPrivate::initializeObjectWithInitialProperties(QV4::ScopedValue&, QQuickItem*&)' Change-Id: Ied1bd7b73b60c69c73e42b82209f10f2448ce7b0 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Templates: update license headersJ-P Nurmi2016-04-141-2/+2
| | | | | | | This file is part of the Qt Quick Templates 2 module of the Qt Toolkit. Change-Id: I39ef9cbb00f55a32b7a43f11ffbdfbb40b84e124 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Templates: rename the C++ module to qtquicktemplates2J-P Nurmi2016-04-131-0/+162
Change-Id: I146da903b46f5c2caf865e37291c25376b49021a Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>