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. How to drag a qml element to a widget

How to drag a qml element to a widget

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.1k Views
  • 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.
  • I Offline
    I Offline
    itviewer
    wrote on last edited by
    #1

    in Qt5,we can use drag and drop inside a Qt Quick scene,
    Now,I want to drag a Image (item )to a widget,Does is it possible?
    Thanks.

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      AFAIK, you can use drag by setting Drag.dragType to Drag.Automatic and set Drag.mimeData to base64 data of the Image and then on the other widget for eg. QLabel get the base64 data, decode it using fromBase64 and apply using QPixmap.

      157

      1 Reply Last reply
      0
      • I Offline
        I Offline
        itviewer
        wrote on last edited by
        #3

        [quote author="p3c0" date="1409904422"]Hi,

        AFAIK, you can use drag by setting Drag.dragType to Drag.Automatic and set Drag.mimeData to base64 data of the Image and then on the other widget for eg. QLabel get the base64 data, decode it using fromBase64 and apply using QPixmap.[/quote]
        Sorry, can you provide a demo ?

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          Can you show what you have started with ? Any trials ? In this way it would be easier for you to understand.
          You might need to check "Drag":http://qt-project.org/doc/qt-5/qml-qtquick-drag.html and it's this "example":http://qt-project.org/doc/qt-5/qtquick-externaldraganddrop-example.html. Just use Image element instead of Text.
          Waiting for you to try this first :)

          157

          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