Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Scroll through listItem
Qt 6.11 is out! See what's new in the release blog

Scroll through listItem

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.6k 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.
  • S Offline
    S Offline
    sam_dev
    wrote on last edited by
    #1

    I want to scroll to next item in list on the button click event and not through navigation keys.

    In short, following functionality must processed:

    focus moves to next item in the list (onDownButtonPressed)

    focus moves to previous item in the list (onUpButtonPressed)

    If page support max five entries, how to update the list with six item and 1st element in the list must be removed

    please do share your suggestions.

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hi,
      This is basic, Generate two slots (or the automatic slot from Designer) and then use the currentRow() + 1 to set the currentRow ;-)
      So something like this:
      @
      // Will only do down, up is your thing to do ;-)
      void MainWindow::on_downButtonPressed(void)
      {
      // Check if you already selected the last item
      if (ui->myList.count() > ui->myList.currentRow())
      {
      ui->myList.setCurrentRow(ui->myList.currentRow() + 1);
      }
      }
      @

      Greetz, Jeroen

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sam_dev
        wrote on last edited by
        #3

        Thanks Jeroentje@home..
        Is it possible to do within QMLs without using C++ code.

        say,

        I have 2 QMLs, SettingsList.qml (displays list data in the parent region) and a Navigation.qml (containing navigation pad which mouse area defined in it)

        Now using these two QMLs in main.qml as:

        @import QtQuick 2.0

        Rectangle{
        Width:200
        Height:380
        Loader{
        id:qmlLoader
        Width:200
        height:280
        source:"SettingsList.qml"
        }

        //Navigation defines upKey, downKey, rightKey, leftKey and selectKey
        Navigation{
        id:navigate
        x:300
        width:200
        height:75
        }
        }@

        Whenever downKey is Clicked, then next item must be highlighted in the list view and also it must be set to current list item.

        How can i achieve above functionality.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sam_dev
          wrote on last edited by
          #4

          is it possible to connect two QMLs through signals without using C++.
          Please share an example or link where I can find relevant details.

          Thanks

          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