A
A
Alexey A2015-03-08 14:50:52
Programming
Alexey A, 2015-03-08 14:50:52

How to replace OnClick in qml?

I must say right away that I am not a programmer at all, so do not judge strictly for the question.
As I understand it Qt.
There is code in .qml file

states: [
                           State {
                                name: "skip"
                                when: player.Sw < 0
                                PropertyChanges {
                                    target: skip_layout
                                    visible: true
                                }  
                             ]
MouseArea {
                            id: skip_layout
                            anchors.fill: parent
                            hoverEnabled: true
                            visible: false

                            onClicked: player.skipSmt();
                         }

Question: how to make player.skipSmt(); run immediately (no mouse click)?
Or launched after checking some state, for example, when visible: true .

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Jacob E, 2015-03-29
@allewa

Instead of the entire MouseArea component, immediately writeComponent.onCompleted: player.skipSmt();

A
Alexander Taratin, 2015-03-08
@Taraflex

Immediately
qt-project.org/doc/qt-4.8/qml-component.html#onCom...
By property change
qt-project.org/doc/qt-4.8/qml-propertychanges.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question