[Interest] [QtQuick] A couple of questions regarding focus

Preet prismatic.project at gmail.com
Wed Sep 12 17:21:21 CEST 2012


Hiya,

I'm having trouble giving specific items in my application focus in
Qml. First: Is it possible to query the scene to see which item
currently has focus (without setting some visual output property on
each and every possible thing that can receive focus)?

Second, I have a specific case where I have a TextEdit loaded
dynamically as a component in a ListView when certain criteria are
met. When this ListView becomes visible, I'd like the TextEdit to be
active so that any key events go directly to it.

I've tried directly requesting focus (focus: true), calling
forceActiveFocus(), etc when creating the TextEdit, but in general I'm
shooting in the dark. I set the currentIndex to the index that
contains the TextEdit, and I can get as far as verifying that the
delegate item that contains the TextEdit has activeFocus, but nothing
I do gives the TextEdit itself focus.

delegate: http://pastie.org/4708504
TextEdit: http://pastie.org/4708507

I'd appreciate any advice,

Preet



More information about the Interest mailing list