[Qt-qml] question about inner working of transition for a state change

3 views
Skip to first unread message

Sivan Greenberg

unread,
Jan 20, 2012, 10:16:00 AM1/20/12
to qt-...@qt.nokia.com
Hi All!

First, the QtQuick development experience is fun and enjoying! It
has become easy to catch on new concepts and features as QtQuick
documentation has improved since the last time I tried to work with
it. The re-usability of every element you create is superb, given you
make just a few arrangements. The designer is not so bad at all so
overall: Fun building QtQuick apps!

Now, I'm using code and states to determine when my input box needs
to get focus:

onButton1Clicked: {
if (window.state=='feedView')
{
toolBar.button1Label = 'Save'
window.state= 'changeSettings'
setview.inputFocus = true
}
else
{
window.currentFeed = setview.address
feedModel.reload();
toolBar.button1Label = 'Settings'
window.state='feedView'

}
}


I also set the focus on the element I want to have focused on the
settings view state:

Rectangle{
anchors.centerIn: parent
border.width: 20
SettingsView {
id: setview
inputFocus: true
anchors.verticalCenter: parent.verticalCenter
}


Input focus is defined in the SettingsView component I created:

import QtQuick 1.0
Item {
property alias inputFocus: uri.focus
....

and references this:

Input{
focus: parent.focus
id: uri
onAccepted: {

window.currentFeed = "http://" + uri.text;
feedModel.reload();
}
text: window.currentFeed
}


Now I have to *both* set inputFocus: true, and use imperative way in
the code to set the focus to true if I want focus reception and smooth
transition.

If I only set the declarative property inputFocus, the input box never
gets focus, and if I just set it through the code and not through the
property then the transition jitters and gets stuck for very short
time, but noticeable interrupting the transition, although the text
input gets focus.

Perhaps this is due to the reference of the parent's focus in "uri"?
Otherwise I would love to know why this happens so I can write just as
much as absolutely necessary imperative QML javascript code.

Many thanks!
--
-Sivan
_______________________________________________
Qt-qml mailing list
Qt-...@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply all
Reply to author
Forward
0 new messages