[Interest] Qml SpinBox Control 2 undo/redo

Jérôme Godbout godboutj at amotus.ca
Tue Mar 17 21:25:01 CET 2020


Hi,
I'm trying to make an undo redo, I manage to have my whole thing working for user mouse drag n drop, add remove part into my model. One thing that bug me with the control 2 is the spinbox, the value is bind to the mode and the model get changed too, not sure this is the optimal way (I so wish we got 2 way binding like C# one day, this is so deeply needed and not have everybody reimplement there own way).

SpinBox
{
    id: sequenceIndex_

    value: opsModel.index

    onValueChanged:
    {
        // This is called before value modified
    }

    onValueModified:
    {
        // The value is already modified, how can I get previous value to make my undo/redo ? seem too late and the value changed as already been called
    }

    Binding
    {
        target: ops_model
        property: "index"
        value: sequenceIndex_.value
    }
}

How does one manage to do it with this control?! I guess I will have the same challenge with the ComboBox and all the selector controls (button are fairly easy since I can capture the previous value before doing the action).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200317/3688f4a2/attachment.html>


More information about the Interest mailing list