PDA

View Full Version : QClipboard mime type data for native pasting in OOCalc



hayzel
16th December 2014, 18:36
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:


QString s;
m_scene->writeCSVDocument(m_scene->selection,s);
qDebug()<<"csv:"<<s;
mimeData->setData("text/plain",s.toUtf8());
QClipboard* cb=KApplication::clipboard();
cb->setMimeData(mimeData);


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.

hayzel
16th December 2014, 20:48
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".