Key navigation not working
-
i want key navigation for the below project, but its not working. Is the issue with folder structrue or with the code?
I am writing the key navigation code in ScreenMainMenu. qml and i am loading this screen in main.qml.My folder structure is:
main.qml:
import QtQuick 2.2
import QtQuick.Window 2.0
import "Screens"Window
{
id: appWindow
visible: true
width: 500
height: 600property var theme: Theme {} property var topBar: HeaderBar {} property var mainScreen: ScreenMainMenu {} Rectangle { width: 500 height: 600 color: theme.background_color Loader { id: firstscreen source: "/Screens/ScreenMainMenu.qml" } }
}
screenmainmenu.qml:
Rectangle
{
id: screen1
//To load header for Start Case Menu
Loader
{
id: l1
source: "/HeaderBar.qml"
}Text { id: name anchors.fill: parent text: qsTr("Start Case") font.pixelSize: theme.fontpixelSize anchors.leftMargin: theme.leftalign anchors.topMargin: theme.topmargin color: "white" } Rectangle { id: r1 width: appWindow.width height: appWindow.height/10 //color: "red" anchors.top: l1.bottom
//for key navigation
**color: focus ? "pink" : "lightgray"
focus: trueKeyNavigation.down: r2** } Rectangle { id: r2 width: appWindow.width height: appWindow.height/10 color: "white" anchors.top: r1.bottom }
}
-
@JasmineSethi What is the purpose of this code exaxtly?
-
When you loaded the Screenmain.qml did it load ? I don't see any size property for screen.qml.
-
This post is deleted!
-
@dheerendra
yes it is loading. I am using loader to load ScreenMainMenu.qml in main.qml. -
This post is deleted!