Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    RubberBand in qml

    QML and Qt Quick
    1
    1
    1430
    Loading More Posts
    • 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.
    • S
      stereomatching last edited by

      I want to crop the Image in qml, like this

      "crop":http://www.flickr.com/photos/92283971@N04/9228168345/

      The region surrounded by the rectangle is the region I want to crop
      Do Qt provide any tools to make this job easier?

      @
      import QtQuick 2.1
      import QtQuick.Controls 1.0
      //import QtQuick.Layouts 1.0
      //import QtQuick.Dialogs 1.0

      Rectangle {
      id: root
      width: 1200
      height: 600

      Rectangle{
          anchors.fill: parent
      
          color: "black"
      
          Rectangle{
              id: rectDrag
      
              height: 100
              width: 100
      
              color: "transparent"
              border.width: 5
              border.color: "green"
              Drag.active: dragArea.drag.active
              radius: 10
      
              MouseArea {
                  id: dragArea
                  anchors.fill: parent
      
                  drag.target: parent
              }            
          }
      }
      

      }
      @

      I can drag the rectangle and find out the coordinates of the rectangle
      But there are two questions I don't know how to solve

      1 : How could I adjust the size of rectDrag by pulling the corners of the rectDrag?
      2 : After I select the region, I need to translate the coordinates(region) to the coordinates
      of the original image, how could I translate the coordinates after scaling by the
      fillMode--Image.PreserveAspectFit?

      edit: found Qt offer a rubberband class in c++, maybe I could use it to implement the
      rubberband?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post