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.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.
  • p3c0P Offline
    p3c0P Offline
    p3c0
    Moderators
    wrote on last edited by
    #6

    In the similar way shav have explained earlier. Basically its the delegate which is used as a view.

    157

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

      I have tried this but the view is not visible, i have also set the visibility to true

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

        Ok. It would be better if you post the code or probably a complete minimal sample.

        157

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

          @ApplicationWindow {
          id : hola
          title: ("SketchIt")
          width: 640
          height: 480
          minimumWidth: mainToolBar .implicitWidth
          visible: true

          Image{
              visible:true
           source:"C:\\1.jpg"
           sourceSize.width:hola.width/2
           sourceSize.height:hola.height/2
          }
          toolBar: ToolBar{
              id : mainToolBar
              anchors.fill :parent
              RowLayout{
               //   width : parent.width
          
                  ToolButton{
                 // text : ("main")
                  iconSource: "C:\\Users\\Hassan Adil\\Documents\\sketchIt\\16.png"
                  onClicked: hola.color = "blue"
                  anchors.margins: 4
          

          }

              Button{
          
                  text : "close"
                  onClicked: hola.close()
          

          }
          }
          }
          SplitView{
          anchors.fill: parent
          orientation: Qt.Horizontal
          }

          }@

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

            The C directory path is correct, but no view

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

              What do you mean by no view in this example?

              157

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

                View meaning that the image is not visible

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

                  Ok. Try prepending file:// to source. And you can use "/" as file separator. Qt internally handles it depending upon OS.
                  @
                  iconSource: "file://C:/Users/Hassan Adil/Documents/sketchIt/16.png"
                  @

                  157

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

                    If i write file:/1.jpg which is located in C: it works and the view also works , but is it possible to put space between the images ?

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

                      Ok. By space, do you mean another path ?

                      157

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

                        No i mean i want to have some distance between the images, to make it look good, can i use borders or something else?

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

                          Inside the RowLayout you can set spacing.

                          157

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

                            Okay thanks a lot!, and also how can i shift the listview close to the bottom of the window

                            1 Reply Last reply
                            0
                            • 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

                                          • Login

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