[Interest] Loader keyboard problem
md at rpzdesign.com
md at rpzdesign.com
Thu Aug 14 23:49:08 CEST 2014
Michael:
Actually, a slight modification to your response.
Outlined in bug report Qt-40790 (likely to get closed soon)
You must use forceActiveFocus() to get this to work, focus: true does
NOT seem to work.
Thanks for the reply,
cheers,
md
On 8/14/2014 3:55 PM, Michael Brasser wrote:
> Hi Mark,
>
> Loader is a focus scope (see
> http://qt-project.org/doc/qt-5/qml-qtquick-loader.html#focus-and-key-events),
> so you will need to set focus on the Loader itself as well as the
> ListView in order for keyboard navigation to work.
>
> Regards,
> Michael
>
> ------------------------------------------------------------------------
> Date: Wed, 13 Aug 2014 09:40:27 -0700
> From: rpzrpzrpz at gmail.com
> To: interest at qt-project.org
> Subject: Re: [Interest] Loader keyboard problem
>
> Oops, I did not finish describing what was the problem with the Loader
> Sample.
>
> The Listview on the Loader for screen1.qml does not work with keyboard
> navigation, but when loaded as a
> component, the Listview keyboard navigation works.
>
> Attached is the sample project:
>
> Built on OSX Mavericks with Qt 5.3.1 QtQuick 2.2
>
> Thanks for any responses.
>
>
> On Wed, Aug 13, 2014 at 9:37 AM, mark diener <rpzrpzrpz at gmail.com
> <mailto:rpzrpzrpz at gmail.com>> wrote:
>
> I am having some strange behavior with a Loader sample program
> for QtQuick 2.2
>
> The Listview on Screen1.qml works
>
> Here is the main.qml file:
>
> import QtQuick 2.2
>
> import QtQuick.Window 2.1
>
>
> Window
>
> {
>
> id: mainwindow
>
>
> visible: true
>
>
> width: Screen.width
>
> height: Screen.height
>
> color: "black"
>
> title: "Test Loader"
>
>
> //Keyboard navigation under OSX Mavericks does not work for the loader
>
> Loader
>
> {
>
> id: genload
>
> anchors.fill: parent
>
> source: "Screen1.qml"
>
> }
>
>
> //Keyboard navigation under OSX Mavericks works for the component
>
>
>
> //Comment out the loader and Un-comment the component to see.
>
> //Screen1 {}
>
>
>
> }
>
>
> /////////NEW QML FILE BELOW///////////
>
>
> Here is the Screen1.qml file:
>
>
> import QtQuick 2.2
>
>
>
>
> Rectangle
>
>
> {
>
>
>
>
> anchors.fill: parent
>
>
>
>
> color: "white"
>
>
>
>
> opacity: 1
>
>
>
>
> ListModel
>
>
> {
>
>
> id: listdata
>
>
>
>
> ListElement
>
>
> {
>
>
> name : "Joe Vabeetz"
>
>
>
>
> cell: "555-1212"
>
>
>
>
> }
>
>
> ListElement
>
>
> {
>
>
> name : "Mary Vabeetz"
>
>
>
>
> cell: "555-1213"
>
>
>
>
> }
>
>
> ListElement
>
>
> {
>
>
> name : "Pete Vabeetz"
>
>
>
>
> cell: "555-1214"
>
>
>
>
> }
>
>
> }
>
>
>
>
>
>
> Component
>
>
> {
>
>
> id: listdelegate
>
>
>
>
> Item
>
>
> {
>
>
> id: rowperson
>
>
>
>
> width: parent.width - 10
>
>
>
>
> height: 50
>
>
>
>
> MouseArea
>
>
> {
>
>
> id: rowmousearea
>
>
>
>
> hoverEnabled: false
>
>
> anchors.fill: parent
>
>
>
>
> onClicked:
>
>
> {
>
>
> listpeople.currentIndex = index
>
>
>
>
> }
>
>
> }
>
>
> Text
>
>
> {
>
>
> id: rowname
>
>
>
>
> text: '<b>Name:</b> ' + name
>
>
>
>
> }
>
>
> Text
>
>
> {
>
>
> id: rowcell
>
>
>
>
> anchors.top: rowname.bottom
>
>
>
>
> text: '<b>Cell:</b>' + cell
>
>
>
>
> }
>
>
> }
>
> }
>
>
>
>
> ListView
>
> {
>
>
>
>
> id: listpeople
>
>
>
> anchors { fill: parent; margins: 22 }
>
>
>
> model: listdata
>
>
>
> delegate: listdelegate
>
>
>
> highlight: Rectangle { color : "lightsteelblue"; radius : 5 }
>
>
>
> focus: true
>
> }
>
>
> }
>
>
>
>
>
> _______________________________________________ Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
More information about the Interest
mailing list