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. Refresh QML Image
Forum Updated to NodeBB v4.3 + New Features

Refresh QML Image

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 4 Posters 5.2k 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.
  • L Offline
    L Offline
    lahianim
    wrote on last edited by
    #1

    in my application i have an Image with source: "........"
    and a button beside to let the user the option to replace it with other image.
    in my qml file I added a function reload to the image as follow:
    @
    ....
    ....
    Image{
    ....
    ....
    source: "img.png"
    function reload()
    {
    source = ""
    source = "img.png"
    //the same path and name as before when user ask to replace the image I change the name of the image to be like the old image and overwrite the old image with the renamed image
    }
    }
    this works fine on windows (7) but on MAC it fail
    some one know why?
    Thanks
    @

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Either a bug, or caching. Add this line to the definition:
      @
      cache: false
      @

      (Z(:^

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lahianim
        wrote on last edited by
        #3

        thanks sierdzio but i have this line already
        acctually this how i define the image
        @
        Image{
        id:mLogo
        smooth: true
        source: "../../../Resources/data/clientLogo.png"
        width: 91
        height: 30
        fillMode: Image.PreserveAspectFit
        cache: false
        }
        @
        but it not help

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tolszak
          wrote on last edited by
          #4

          Hello
          It is known bug
          http://qt-project.org/forums/viewthread/7093

          1 Reply Last reply
          0
          • F Offline
            F Offline
            fatinbrain
            wrote on last edited by
            #5

            Try to extract image source to property. than change this property.
            @
            property string src: "img.png"
            Image{
            source: src
            function reload()
            {
            src = "img1.png"
            }
            @

            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