Results 1 to 4 of 4

Thread: Dragging an Image in QLabel using mouse

  1. #1
    Join Date
    Oct 2011
    Posts
    48
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Dragging an Image in QLabel using mouse

    Hi All,


    I have an image in QLabel.I want to drag the image using mouse.Which class should I use for that?Can anyone please help me? Should I use QDrag ??

  2. #2
    Join Date
    Oct 2011
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows Maemo/MeeGo

    Default Re: Dragging an Image in QLabel using mouse

    Hi A9am,
    if you are asking how to drag image in qml it will be as..may this example could help you

    Rectangle { id: mainRect; width: 600; height: 200; color: "white" Image { id: pic; source: "face-smile.png" anchors.verticalCenter: parent.verticalCenter opacity: (600.0-pic.x) / 600; MouseArea { anchors.fill: parent drag.target: pic drag.axis: "XAxis" drag.minimumX: 0 drag.maximumX: mainRect.width-pic.width } } }

  3. #3
    Join Date
    Oct 2011
    Posts
    48
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Dragging an Image in QLabel using mouse

    Thanks m.azeemanwar for your reply. But I am not using qml. I have one QLabel and I have set the pixmap.Can I drag that Image using mouse?

  4. #4
    Join Date
    May 2010
    Posts
    61
    Thanks
    2
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Dragging an Image in QLabel using mouse

    Hi,

    Have a look at the Drag and Drop examples, especially at the Draggable Icons Example.

    Hope this helps,
    Wladek
    One second is long, everything longer than two seconds is definitely too long.

Similar Threads

  1. Make image bigger, when the mouse is over QLabel
    By Globulus in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2011, 10:39
  2. Hover on mouse over while dragging
    By mooreaa in forum Qt Programming
    Replies: 3
    Last Post: 6th February 2010, 11:31
  3. Custom mouse dragging an entire scene?
    By swbluto in forum Qt Programming
    Replies: 1
    Last Post: 26th October 2009, 16:46
  4. Replies: 9
    Last Post: 26th October 2009, 01:13
  5. Dragging mouse selection in QTableWidget
    By yartov in forum Qt Programming
    Replies: 1
    Last Post: 12th April 2008, 16:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.