Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Key navigation image change.

Key navigation image change.

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 923 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dstudentx
    wrote on last edited by
    #1

    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";@

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Alek Śmierciak
      wrote on last edited by
      #2

      Hi,

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved