Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Drag and drop event->mimeData()->hasImage() return false , when droping image file
Forum Updated to NodeBB v4.3 + New Features

Drag and drop event->mimeData()->hasImage() return false , when droping image file

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 4.2k 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.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    Hi
    i like to build simple listView that support dropping images . simple.
    this listview is added to to QDialog , when i implement the QDialog dropEvent
    and try to check if the drop image is image . according to example i should first see if the data hasImage
    but the event->mimeData()->hasImage() always returns me false, why ?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      Where are you dropping the image from?

      If it's from a file manager it could be possible that it's just dropping the URL to the file itself, although the DND has a image thumbnail. Just dump the QMimeData and analyze its contents.

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        How do you drag/drop the image?

        Do you select a file and try to drop that? Then you get an Url and have to check the file.

        Or do you select some image like in word and drop that?

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          For checking what is dumped, you can use the "dropsite example":http://doc.qt.nokia.com/4.7/draganddrop-dropsite.html

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • U Offline
            U Offline
            umen242
            wrote on last edited by
            #5

            its from file manager , so i guess i need to check if its valid file suffix
            like jpd,png .... or there is more generic way ?

            1 Reply Last reply
            0
            • G Offline
              G Offline
              giesbert
              wrote on last edited by
              #6

              That's the way, check the type URL and the check the file type. You could also use a QImage or similar and try loading it :-)

              Nokia Certified Qt Specialist.
              Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

              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