@ -186,7 +186,36 @@ GridView {
highlightMoveDuration: 0
keyNavigationEnabled : true
keyNavigationWraps : true
Keys.onPressed: {
/ / v i m h , j , k , l k e y b i n d i n g s
if ( event . key === Qt . Key_J ||
event . key == Qt . Key_H ||
event . key == Qt . Key_K ||
event . key == Qt . Key_L
) { / / i f a v i m H , J , K , L k e y b i n d i n g i s p r e s s e d
var arrow = Qt . UpArrow ; / / s a m p l e a r r o w k e y
switch ( event . key ) { / / s e t t i n g u p t h e a r r o w k e y
case ( Qt . Key_J ) : a = Qt . DownArrow ; break ;
case ( Qt . Key_H ) : a = Qt . LeftArrow ; break ;
case ( Qt . Key_L ) : a = Qt . RightArrow ; break ;
case ( Qt . Key_K ) : a = Qt . UpArrow ; break ;
}
/ / s e t t i n g t h e s e l e c t e d f i l e t o t h e n e w o n e t h a n k s t o t h e a r r o w
if ( ! editor || ! editor . targetItem ) {
var newIndex = positioner . nearestItem (
currentIndex ,
effectiveNavDirection ( control . flow , control . effectiveLayoutDirection , arrow )
)
if ( newIndex !== - 1 ) {
currentIndex = newIndex
updateSelection ( event . modifiers )
}
}
}
/ / f o c u s o n c o n t r o l / s h i f t e v e n t
control . keyPress ( event )
if ( event . key === Qt . Key_Control ) {
@ -218,8 +247,11 @@ GridView {
}
Keys.onUpPressed: {
if ( ! editor || ! editor . targetItem ) {
var newIndex = positioner . nearestItem ( currentIndex ,
effectiveNavDirection ( control . flow , control . effectiveLayoutDirection , Qt . UpArrow ) )
var newIndex = positioner . nearestItem (
currentIndex , effectiveNavDirection (
control . flow , control . effectiveLayoutDirection , Qt . UpArrow
)
)
if ( newIndex !== - 1 ) {
currentIndex = newIndex
updateSelection ( event . modifiers )
@ -228,8 +260,11 @@ GridView {
}
Keys.onDownPressed: {
if ( ! editor || ! editor . targetItem ) {
var newIndex = positioner . nearestItem ( currentIndex ,
effectiveNavDirection ( control . flow , control . effectiveLayoutDirection , Qt . DownArrow ) )
var newIndex = positioner . nearestItem (
currentIndex , effectiveNavDirection (
control . flow , control . effectiveLayoutDirection , Qt . DownArrow
)
)
if ( newIndex !== - 1 ) {
currentIndex = newIndex
updateSelection ( event . modifiers )
@ -238,8 +273,11 @@ GridView {
}
Keys.onLeftPressed: {
if ( ! editor || ! editor . targetItem ) {
var newIndex = positioner . nearestItem ( currentIndex ,
effectiveNavDirection ( control . flow , control . effectiveLayoutDirection , Qt . LeftArrow ) )
var newIndex = positioner . nearestItem (
currentIndex , effectiveNavDirection (
control . flow , control . effectiveLayoutDirection , Qt . LeftArrow
)
)
if ( newIndex !== - 1 ) {
currentIndex = newIndex
updateSelection ( event . modifiers )
@ -248,8 +286,11 @@ GridView {
}
Keys.onRightPressed: {
if ( ! editor || ! editor . targetItem ) {
var newIndex = positioner . nearestItem ( currentIndex ,
effectiveNavDirection ( control . flow , control . effectiveLayoutDirection , Qt . RightArrow ) )
var newIndex = positioner . nearestItem (
currentIndex , effectiveNavDirection (
control . flow , control . effectiveLayoutDirection , Qt . RightArrow
)
)
if ( newIndex !== - 1 ) {
currentIndex = newIndex
updateSelection ( event . modifiers )