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. Listview and focus problem
Forum Updated to NodeBB v4.3 + New Features

Listview and focus problem

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.5k 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.
  • A Offline
    A Offline
    aykon
    wrote on last edited by
    #1

    I've got two differenciate areas.

    On one hand, I've got a Listview where each line has a text (line_text). On the other hand I've got a text (my_text) that is set by using the custom_keyboard I made, and an accept button.
    I succeded in setting my_text using the custom_keyboard.

    The problem is that I also want to get focus on a line of the listview by clicking it, so that when I press accept_button my_text is copied into the line_text of the focused line.

    Here's a summary of the relevant parts of my code:

    @Rectangle {
    ...
    Rectangle {
    Listview {
    Delegate {
    Rectangle {
    id: line
    Row {
    ...
    Row {
    Text {
    id: line_text
    }
    }
    }
    }
    }
    }
    }

    Item {
    Rectangle {
    Text {
    id: my_text
    }
    }

    Rectangle {
      id: custom_keyboard
      ...
    }
    
    Rectangle {
      id: accept_button
      ...
      MouseArea {
          ...
      }
    }
    

    }
    }
    @

    Thank you

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      Hi,

      The following threads will hopefully give you some ideas of where you might start:

      • "currentItem and currentIndex for ListView":http://qt-project.org/forums/viewthread/2324/#13286
      • "PathView: accessing delegate at current index":http://qt-project.org/forums/viewthread/11916

      Regards,
      Michael

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aykon
        wrote on last edited by
        #3

        Ok, Thank you. I'll have a look at it

        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