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 outlook mail item to QT application
Forum Updated to NodeBB v4.3 + New Features

drag and drop outlook mail item to QT application

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 654 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.
  • R Offline
    R Offline
    rakm
    wrote on last edited by
    #1

    Hi Team,
    I am trying to drag n drop the mail item from outlook to my local QT application. Drag n drop of .eml extension file is working but the application is not able to detect the mail item when I drag and drop the mail directly from Outlook application installed in MAC Also, I want to fetch the mail body and attachment from the drag n drop event. Please help me with this.
    Attached below is my code snippet:
    void DropArea::dropEvent(QDropEvent *event)
    {
    const QMimeData *mimeData = event->mimeData();

     QList<QByteArray> bytearray=mimeData->dynamicPropertyNames();
     foreach(QByteArray by,bytearray){
         qDebug()<<"bytearrauy"<<by;
     }
    
    if (mimeData->hasImage()) {
        setPixmap(qvariant_cast<QPixmap>(mimeData->imageData()));
    } else if (mimeData->hasHtml()) {
        setText("has html"+mimeData->html());
        setTextFormat(Qt::RichText);
    } else if (mimeData->hasUrls()) {
        QList<QUrl> urlList = mimeData->urls();
        QString text;
        for (int i = 0; i < urlList.size() && i < 32; ++i)
            text += urlList.at(i).path() + QLatin1Char('\n');
        setText("hasurl"+text);
    }
    else if(mimeData->hasFormat("message/rfc822")){
        setText(tr("msg droped"));
    }else {
        setText(tr("Cannot display data"));
    }
    
    setBackgroundRole(QPalette::Dark);
    event->acceptProposedAction();
    

    }

    raven-worxR 1 Reply Last reply
    0
    • R rakm

      Hi Team,
      I am trying to drag n drop the mail item from outlook to my local QT application. Drag n drop of .eml extension file is working but the application is not able to detect the mail item when I drag and drop the mail directly from Outlook application installed in MAC Also, I want to fetch the mail body and attachment from the drag n drop event. Please help me with this.
      Attached below is my code snippet:
      void DropArea::dropEvent(QDropEvent *event)
      {
      const QMimeData *mimeData = event->mimeData();

       QList<QByteArray> bytearray=mimeData->dynamicPropertyNames();
       foreach(QByteArray by,bytearray){
           qDebug()<<"bytearrauy"<<by;
       }
      
      if (mimeData->hasImage()) {
          setPixmap(qvariant_cast<QPixmap>(mimeData->imageData()));
      } else if (mimeData->hasHtml()) {
          setText("has html"+mimeData->html());
          setTextFormat(Qt::RichText);
      } else if (mimeData->hasUrls()) {
          QList<QUrl> urlList = mimeData->urls();
          QString text;
          for (int i = 0; i < urlList.size() && i < 32; ++i)
              text += urlList.at(i).path() + QLatin1Char('\n');
          setText("hasurl"+text);
      }
      else if(mimeData->hasFormat("message/rfc822")){
          setText(tr("msg droped"));
      }else {
          setText(tr("Cannot display data"));
      }
      
      setBackgroundRole(QPalette::Dark);
      event->acceptProposedAction();
      

      }

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @rakm
      this is not possible with Qt API (and without modifiying Qt source code) and never will be
      I once implemented this, but only with an ugly hack by exposing the actual drop item out of QtGui dll and examine it's contents directly in the dropEvent() handler.

      Any way you may want to checkout this change though. It may be that it might be possible in the meantime.

      --- 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
      3

      • Login

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