Results 1 to 2 of 2

Thread: QClipboard mime type data for native pasting in OOCalc

  1. #1
    Join Date
    Oct 2009
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QClipboard mime type data for native pasting in OOCalc

    Hi,
    I develop an application that I want to copy tables of data to clipboard for pasting in OOCalc.
    Searching through the forum and on the internet I found that a tabular csv form is needed with MIME type "text/plain".
    Each column is separated with \t and each row with \n.
    I format my table string to:
    "1"\t"2"\t"3"\n
    "4"\t"5"\t"6"\n
    and set the qmimedata to "text/plain" and set the qmimedata object to QClipboard:
    Qt Code:
    1. m_scene->writeCSVDocument(m_scene->selection,s);
    2. qDebug()<<"csv:"<<s;
    3. mimeData->setData("text/plain",s.toUtf8());
    4. QClipboard* cb=KApplication::clipboard();
    5. cb->setMimeData(mimeData);
    To copy to clipboard, switch view to plain text mode 
    When I paste in OOCalc, a "Text/Import" window is popped up, and pressing "OK" , my table is transfered to OOCalc.
    The thing is that I DON'T want the popping "Text/Import" window. I want my table data, to be processed by OOCalc, nativelly, and paste them directly on it, without the window.
    The question is: Does anyone knows the internal native data format of OOCalc and the correct mimetype to use, so that OOCalc sees the data like its own, and not to try to import them?

    Thank you in advance.

  2. #2
    Join Date
    Oct 2009
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QClipboard mime type data for native pasting in OOCalc

    For anyone who cares. The solution was really stupid.
    I used /r character for newline instead of \n and OOo accepts the paste as "native".

  3. The following user says thank you to hayzel for this useful post:

    d_stranz (16th December 2014)

Similar Threads

  1. Phonon Mime Type
    By somnathbanik in forum Newbie
    Replies: 0
    Last Post: 20th November 2010, 11:02
  2. getting a file extenstion list from a MIME type
    By roxton in forum Qt Programming
    Replies: 0
    Last Post: 10th April 2009, 18:27
  3. qt with mime.type and mail.cap
    By killerwookie99 in forum Qt Programming
    Replies: 0
    Last Post: 16th September 2008, 22:39
  4. Replies: 2
    Last Post: 5th June 2008, 12:42
  5. QTreeWidgetItem mime type
    By themolecule in forum Qt Programming
    Replies: 6
    Last Post: 27th November 2007, 12:55

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.