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. Setting static path to image source
Forum Updated to NodeBB v4.3 + New Features

Setting static path to image source

Scheduled Pinned Locked Moved QML and Qt Quick
16 Posts 2 Posters 3.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.
  • B Offline
    B Offline
    beemaneni
    wrote on last edited by
    #7

    Hi,
    No this is nly part of the code...Actual thing is i am capturing an image from camera...where image is saved in sd card...so i have to give that path here...yeah i will try by giving width and height for list view and update u

    Bala B
    Infinite Computer systems
    Chennai

    1 Reply Last reply
    0
    • B Offline
      B Offline
      beemaneni
      wrote on last edited by
      #8

      i tried with width and height for list view also but in no vain..did u get that working for u

      Bala B
      Infinite Computer systems
      Chennai

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

        Well i tried this and it worked for me
        @
        ListView {
        id : list
        width: 200
        height: 300
        spacing: 3
        model: 10
        orientation: ListView.Horizontal
        delegate: Rectangle {
        anchors { verticalCenter: parent.verticalCenter }
        width: 70; height: 70;
        color: "grey";
        border.color: "#000";
        radius: 5
        Image {
        id: imagecap
        anchors { centerIn: parent }
        source: "file:///home/user1/Pictures/star.jpg"
        }
        }
        }
        @

        157

        1 Reply Last reply
        0
        • B Offline
          B Offline
          beemaneni
          wrote on last edited by
          #10

          hi thanks
          i have not checked on desktop till now..it works gud for me on desktop..but it does not work on android mobile

          Bala B
          Infinite Computer systems
          Chennai

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

            On Android it must be a different path.

            157

            1 Reply Last reply
            0
            • B Offline
              B Offline
              beemaneni
              wrote on last edited by
              #12

              Hi
              Actual code is i am capturing an image and saving that image in one path using "camera" class .I found where the image is saved using "camera.imageCapture.capturedimagepath()" ..path is like "/storage "/sdcard0/DCIM/******etc /img.png"..i assigned the path to listview image source. i deployed the application on android phone and found the path ,bt it is not retrieving in image source in listview...this is exactly my requirement..

              Thanks for guiding...:-)

              Bala B
              Infinite Computer systems
              Chennai

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

                And does it work if you assign some other already existing image ?
                any errors in Qt Creator's console when you run the application on phone ?
                Is the image that you captured a valid image ? you can try opening it in default image viewer on phone

                157

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  beemaneni
                  wrote on last edited by
                  #14

                  yeah i have included images through qrc file but nt static paths...in my phone it does not printt anything on console window...yeah image is an valid one and i am able to open and see in phone..

                  image saved in phone at: "/storage/sdcard0/DCIM/Pictures/IMG_00001.jpg"

                  the same path i have given as source to image as
                  "file:///storage/sdcard0/DCIM/Pictures/IMG_00001.jpg"

                  Bala B
                  Infinite Computer systems
                  Chennai

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    beemaneni
                    wrote on last edited by
                    #15

                    hi

                    I found some bug in the aboe code i have given..
                    Inside the delegate->Rectangle image is placed...I could not access that image outside..How do i do that?

                    Bala B
                    Infinite Computer systems
                    Chennai

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

                      Is the image accessible outside Rectangle ? You can try to use Image element directly instead of placing inside the Rectangle. But i don't think so that would be a problem.

                      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