Results 1 to 9 of 9

Thread: Is there a known problem with QMimeData on Mac OS X?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Is there a known problem with QMimeData on Mac OS X?

    Try upgrading your Qt installation (4.3.4 is the latest stable release).

  2. #2
    Join Date
    Apr 2006
    Posts
    31
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Is there a known problem with QMimeData on Mac OS X?

    Quote Originally Posted by wysota View Post
    Try upgrading your Qt installation (4.3.4 is the latest stable release).
    The duples are gone. Now I see just one plain/text entry in the clipboard. This does not really solve my problem, since I would like to get the html-source similar to the other two platforms.

    I do not know how the textedit application (distributed with Mac OSX) handles it, but this programm is able to receive the html-code from at least safari with the same sequence of <Apple>A/<Apple>C and <Apple>V in the textedit window. It looks a little bit like garbage, but it contains links (and this is what I would like to get).

  3. #3
    Join Date
    May 2006
    Posts
    788
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    49
    Thanked 48 Times in 46 Posts

    Default Re: Is there a known problem with QMimeData on Mac OS X?

    On my mac i use.....

    qmake -v
    QMake version 2.01a
    Using Qt version 4.4.0-snapshot-20070608 in /usr/local/Trolltech/Qt-4.4.0-snapshot-20070608/lib

    and its run OK

    try to build
    http://code.google.com/p/qxhtml-edit/

    only append text plain ...
    http://qxhtml-edit.googlecode.com/sv...c/qvimedit.cpp

    Qt Code:
    1. void QVimedit::insertFromMimeData ( const QMimeData * source )
    2. {
    3.  
    4. //////////qDebug() << "### insertFromMimeData 2 ";
    5.  
    6. if ( source->hasImage() ) {
    7. numerobase++;
    8. const QString nuovaim = QString("%2/image_%1.png").arg(numerobase).arg(QDir::homePath());
    9. QImage images = qvariant_cast<QImage>(source->imageData());
    10. bool salvato = images.save(nuovaim,"PNG",100);
    11. //////////////////qDebug() << "### salvato 1/0 " << salvato;
    12. emit TakeImage(nuovaim); /* and remove nuovaim */
    13. return;
    14.  
    15. }
    16.  
    17. ////////////////QTextEdit::insertFromMimeData(source);
    18. if ( source->formats().contains("text/html") ) {
    19. ////////qDebug() << "### incomming paste text/html ";
    20. const QString tidicaches = QString("%2/.qtidy/").arg(QDir::homePath());
    21. QString draghtml = source->html();
    22. /* fwriteutf8(QString fullFileName,QString xml) */
    23. QTidy *tidy = new QTidy(); /* QTidy *tidy; */
    24. tidy->Init(tidicaches); /* tidy cache remove on last event */
    25. const QString xhtmlnew = tidy->TidyExternalHtml(draghtml);
    26. ///////fwriteutf8("copy_in.html",xhtmlnew);
    27. QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(xhtmlnew);
    28. textCursor().insertFragment(fragment);
    29. emit IncommingHTML();
    30. return;
    31. }
    32. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Is there a known problem with QMimeData on Mac OS X?

    Patrick, how is the code you pasted related to the problem? The guy just said his QMimeData doesn't contain "text/html", so why the hell do you paste code which runs some tidy clone on html code? How is that relevant?

  5. #5
    Join Date
    Apr 2006
    Posts
    31
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Is there a known problem with QMimeData on Mac OS X?

    Quote Originally Posted by wysota View Post
    How is that relevant?
    It helps me a little bit. I see now, that the Clipboard on OSX can hold text/plain and text/html at the same time and that Qt/Mac (even Qt 4.2.1) and my code work as expected. So it seems that I have to ask at the project pages of the relevant browsers.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Is there a known problem with QMimeData on Mac OS X?

    Quote Originally Posted by Wurgl View Post
    I see now, that the Clipboard on OSX can hold text/plain and text/html at the same time and that Qt/Mac and my code work as expected. So it seems that I have to ask at the project pages of the relevant browsers.
    Have you seen the "dropsite" example (or demo) bundled with Qt? It's useful for testing mime-types of dragged objects and dragging and pasting from clipboard is using the same technique (you can probably even modify the example to react on pasting as well). And you can see what mime-types are created when you drag data from these applications.

Similar Threads

  1. problem with opengl, zooming, drawpixels, and origin
    By ntp in forum General Programming
    Replies: 0
    Last Post: 22nd February 2008, 21:48
  2. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  3. [QMYSQL] connection problem
    By chaos_theory in forum Installation and Deployment
    Replies: 5
    Last Post: 2nd July 2007, 09:52
  4. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.