Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Key navigation image change.
dstudentx last edited by
I'm trying to change images when I key nav around but I can only get it to work for opacity
What am I missing?
@opacity: focus ? .5 : 1; //this works@
I tried this for images but it doesn't work
@focus: true; source: focus ? "images/item-hl.png" :"images/item.png";@
Alek Śmierciak last edited by
why are you using the focus attribute? If you want key navigation, then use "KeyNavigation":http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-keynavigation.html - with two or more Image elements with separate sources specified.
Second thought: seeing that you want to implement highlighting and would rather have one Image element, I want to point out that you're "binding":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-syntax-propertybinding.html the source property to the focus property, which in turn you set to true. Make sure that you have the focus property changed at some point.
This "stackoverflow.com thread":http://stackoverflow.com/questions/16343196/qt-qml-keyboard-and-mouse-does-not-work-together-to-change-the-source-image has a similar problem.