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. Problem dropping a file on ManWindow (Qt 5.4 mac)
Qt 6.11 is out! See what's new in the release blog

Problem dropping a file on ManWindow (Qt 5.4 mac)

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

    i'm Using OS X 10.10.
    I have Problem dropping a file (from Finder) on ManWindow
    This problem exists in Qt 5.4 mac

    this is my code
    @void PhotoWindow::dragEnterEvent(QDragEnterEvent *event)
    {
    if (event->mimeData()->hasUrls())
    {
    event->acceptProposedAction();
    }
    }

    void PhotoWindow::dropEvent(QDropEvent *event)
    {
    foreach (const QUrl &url, event->mimeData()->urls())
    {
    PhotoAddress << url.toLocalFile();

        if(!PhotoAddress.isEmpty(&#41;&#41;
        {
            pe=true;
    
            this->ProcessingPhoto(&#41;;
        }
    }
    

    }@

    But return me something like this : /.file/id=6571367.1965329

    this problem even exists in Qt Creator
    When dropping a file (from Finder) on Qt Creator.
    !http://sd.uploads.im/xOMHk.png!

    This should be a bug in Qt 5.4 mac!

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rondog
      wrote on last edited by
      #2

      I ran into this too. It is a problem with Yosemite; I didn't have a problem with Mountain Lion.

      You need to modify the file 'qtbase/src/platformsupport/clipboard/qmacmime.mm' and recompile Qt (assuming you have the source for Qt).

      The complete function is here including the changes (two lines). It starts on line number 608

      @
      QVariant QMacPasteboardMimeFileUri::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
      {
      if (!canConvert(mime, flav))
      return QVariant();
      QList<QVariant> ret;
      for (int i = 0; i < data.size(); ++i) {
      QUrl url = QUrl::fromEncoded(data.at(i));
      if (url.host().toLower() == QLatin1String("localhost"))
      url.setHost(QString());

           if (url.host().isEmpty() && url.path().startsWith(QLatin1String("/.file/id=")))
      

      url = QUrl::fromNSURL([url.toNSURL() filePathURL]);

          url.setPath(url.path().normalized(QString::NormalizationForm_C));
          ret.append(url);
      }
      return QVariant(ret);
      

      }
      @

      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