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. RubberBand in qml
Forum Updated to NodeBB v4.3 + New Features

RubberBand in qml

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.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.
  • S Offline
    S Offline
    stereomatching
    wrote on last edited by
    #1

    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
    0

    • Login

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