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. [solved]QML and Partial Image Displaying
Forum Updated to NodeBB v4.3 + New Features

[solved]QML and Partial Image Displaying

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 3.7k 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.
  • W Offline
    W Offline
    Wroman
    wrote on last edited by
    #1

    Hi,

    is it possible to display q quarter of an image ? I mean, is it possible to specify how much of the image you want to display with proportion preservation. Displaying the end or the begginning. In QML or in QML with C++... Anything that can be plugged into QML.

    Thanks

    Trust me, i'm an engineer !

    1 Reply Last reply
    0
    • F Offline
      F Offline
      favoritas37
      wrote on last edited by
      #2

      An easy way to begin with is to place an "Image":doc.qt.nokia.com/4.7-snapshot/qml-image.html element in a "Rectangle":http://doc.qt.nokia.com/4.7-snapshot/qml-rectangle.html element. Let Rectangle be smaller than the Image and in the Rectangle set the clip:true. This show only a part of the Image.
      @
      Rectangle{
      clip:true
      width: 150
      height:150
      Image{
      source: "image/source.png"
      }
      }
      @

      To go a bit further replace the Rectangle with a "Flickable":http://doc.qt.nokia.com/4.7-snapshot/qml-flickable.html element. Thus if the image is smaller than the size of the Flickable you will be able to scroll the view of the image. So:

      @
      Flickable{
      clip:true
      width: 150
      height:150

      contentWidth: image.width
      contentHeight: image.height
      Image{
          id: image
          source: "image/source.png"
      }
      

      }
      @

      Does this do what you need?

      1 Reply Last reply
      0
      • W Offline
        W Offline
        Wroman
        wrote on last edited by
        #3

        Yes, it's exactly what i needed !

        Thanks !

        Trust me, i'm an engineer !

        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