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. QMimeData Custom Data Type | Recieving PDF Pages at DropEvent
Forum Updated to NodeBB v4.3 + New Features

QMimeData Custom Data Type | Recieving PDF Pages at DropEvent

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.1k 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
    Seajmoon
    wrote on last edited by
    #1

    Hello,

    How do i get the content of a MimeData with the following format:
    @
    application/x-qt-windows-mime;value="FileGroupDescriptorW"
    application/x-qt-windows-mime;value="FileContents"
    @

    I tried getting the Data with the two values (FileGroupDescriptorW or FileContents) and saving it in QArrayByte but i get 0 Byte
    @
    QByteArray input(mimeData->data("FileGroupDescriptorW"));
    setText(tr("%1 bytes").arg(input.size())) //Prints 0 Byte
    @

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ckakman
      wrote on last edited by
      #2

      Hi,

      Why don't you print out the recognized mime types for the dropped object with QMimeData::formats() and try one of the values there?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Seajmoon
        wrote on last edited by
        #3

        bq. Why don’t you print out the recognized mime types for the dropped object with QMimeData::formats() and try one of the values there?

        That is exactly what i did and the formats are:
        @
        application/x-qt-windows-mime;value="FileGroupDescriptorW"
        application/x-qt-windows-mime;value="FileContents"
        @

        And i tried all the values, but am getting 0 Byte

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          as you have written you want the contents of 'application/x-qt-windows-mime;value="FileGroupDescriptorW"'. So why do you retrieve the data only asking for 'FileGroupDescriptorW' ?!
          Use:
          @
          QByteArray input( mimeData->data("application/x-qt-windows-mime;value="FileGroupDescriptorW") );
          @
          But note, Qt has a "bug":https://bugreports.qt.io/browse/QTBUG-17373 (which was fixed shortly in Qt 5.5) which prevents to get the 'FileContents' from the drop in case there were multiple files dragged. Of course this only affects Windows, since these are Windows specific mime-types.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Seajmoon
            wrote on last edited by
            #5

            Hi,

            Thanks for your efforts.

            I tried using the format to the data, but i still get 0 Byte
            @
            else {

                QStringList formatList = mimeData->formats();
                QString text;
                for (int i = 0; i < formatList.length() && i < 32; ++i) {
                    QString formatStr = formatList.at(i);
                    text += formatStr + QString(" : ") + QString::number(mimeData->data(formatStr).length()) + QString("\n");
                }
            
                setText(text);
            
            
                mouseMoveEvent(NULL);
            }
            

            @

            !https://dyp.im/fhsoOZrb8I(Result)!

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Seajmoon
              wrote on last edited by
              #6

              This problem is solved.

              This Reason why i get 0 byte of Data is because the Datasource saves no Data in the Storage medium.

              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