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. Scroll view
Forum Updated to NodeBB v4.3 + New Features

Scroll view

Scheduled Pinned Locked Moved QML and Qt Quick
28 Posts 3 Posters 7.8k 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.
  • p3c0P Offline
    p3c0P Offline
    p3c0
    Moderators
    wrote on last edited by
    #19

    anchor it to the bottom.

    157

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Javeria
      wrote on last edited by
      #20

      I have tried to anchor it to the parent but the list view doesn't appear on the screen

      1 Reply Last reply
      0
      • p3c0P Offline
        p3c0P Offline
        p3c0
        Moderators
        wrote on last edited by
        #21

        and who is parent of ListView ?

        157

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Javeria
          wrote on last edited by
          #22

          I think the application window is the default parent, I haven't specified

          1 Reply Last reply
          0
          • p3c0P Offline
            p3c0P Offline
            p3c0
            Moderators
            wrote on last edited by
            #23

            How did you anchor it ? Can you post some code ?

            157

            1 Reply Last reply
            0
            • J Offline
              J Offline
              Javeria
              wrote on last edited by
              #24

              @import QtQuick 2.4
              import QtQuick.Controls 1.3
              import QtQuick.Window 2.2
              import QtQuick.Dialogs 1.2
              ApplicationWindow {
              //id:root
              title: qsTr("Hello World")
              width: 1500
              height: 1000
              property var imagesListModel: ["file:/original.jpg","file:/11.jpg","file:/test (1).jpg","file:/test (2).jpg","file:/test (3).jpg","file:/test (4).jpg","file:/test (5).jpg"]
              Image{
              id:main
              width: 450
              height: 600
              source:"file:/test (6).jpg"
              anchors.centerIn: parent
              }
              ListView {
              id: imagesList
              anchors.fill: parent
              spacing:25
              orientation: Qt.Vertictal
              model: imagesListModel
              delegate: Image {
              width: 75
              height: 100
              source: imagesListModel[index]

                       MouseArea {
                           anchors.fill: parent
              
                           onClicked: {
              

              // main.
              console.log("User select '"+imagesListModel[index]+"' image");
              }
              }
              }
              }

              }
              @

              1 Reply Last reply
              0
              • J Offline
                J Offline
                Javeria
                wrote on last edited by
                #25

                And the image with id should change when the user select the image from the list , how can i do that as well?

                1 Reply Last reply
                0
                • p3c0P Offline
                  p3c0P Offline
                  p3c0
                  Moderators
                  wrote on last edited by
                  #26

                  You should anchor ListView to bottom of root I.e ApplicationWindow. Do this in ListView
                  @
                  anchors.bottom : root.bottom
                  @

                  To set Image just assign the string that you get in onClicked to source of main

                  157

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    Javeria
                    wrote on last edited by
                    #27

                    It still doesnt work , how to put in corner

                    1 Reply Last reply
                    0
                    • p3c0P Offline
                      p3c0P Offline
                      p3c0
                      Moderators
                      wrote on last edited by
                      #28

                      anchor it to left or right as required.

                      157

                      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