I am working with QClipboard object under windows 10. Trying to write to the system clipboard using setText(), but it doesnt seem to work-getting empty clipboard. Here is the piece of code:
QClipboard *pClipboard = QApplication::clipboard();
pClipboard->setText(someText);
pClipboard->text() //to get text from clipboard
Am I missing something here? However, getting text from the clipboard is working.
Related
I need to repeatedly extract contents from a large number of text files with addresses given by URLs. Every time I run my R code and connect to a file it opens in Notepad++ which is my default text editor. The R code alone works perfectly well but in the text editor I have a "Reload" dialog window for each of 100+ files. How can I avoid this?
I use url.show function to extract the text and file function to connect and read the data.
url.show('https://www.playok.com/p/?g=gm136365880&txt', file='game.txt')
con = file("game.txt", open = "r")
### some code: extracting lines of text and processing...
close(con)
Probably these are not the proper functions for my particular task. What I need is just a connection to the file contents without opening the file anywhere (including my RStudio window and the text editor window).
If you don't need a local copy of the file, you can just pass the URL to open:
con <- file("https://www.playok.com/p/?g=gm136365880&txt", open = "r")
readLines(con)
close(con)
will print the content of the URL
I have a .xlsx file with an image on header. When i try to convert to PDF via terminal using libreoffice it converts but the image doesn't appear on the generated PDF.
Here is a screenshot of the main .xlsx file on Excel (print mode):
And the Screenshot of the generated PDF:
The command that im using is: soffice --headless --convert-to pdf --outdir /home/output /home/input/headers_footers.xlsx
Note: To display the header image of the .xlsx on excel we need to put it into print view mode (ctrl+p)
I tested the conversion of the headers_footers.xlsx with an online convertion tool to PDF and the final result was as expected: the image appeared.
But i need to do this programatically, so im not sure if its libreoffice or if i need to use other tool, or maybe manipulate the final PDF and add an image on it?
This is not only an UNIX problem. I can reproduce the malfunction running MS Windows 10. The header image appears in print view and in manually exported PDF. But when you call
soffice --headless --convert-to pdf --outdir . sample.xlsx
on command line it won't show up. I will keep on searching for an answer but this seems to be a bug to me.
Is using a LO Basic Macro an acceptable approach for you, too?
Sub ExportCalcToPDF
sURL = convertToURL("d:\temp\lo_calc.pdf")
dim mFileType(0)
mFileType(0) = createUnoStruct("com.sun.star.beans.PropertyValue")
mFileType(0).Name = "FilterName"
mFileType(0).Value = "calc_pdf_Export"
thisComponent.storeToURL(sURL, mFileType())
End Sub
When executed this macro exports the spreadsheet to pdf. To run the macro automatically e.g. on file open assign it to "Open Document" in Tools > Customize > Events.
Doing a test by double clicking the xlsx file the image appears in the header of the pdf. However, no success from command line so far.
I am facing a strange behavior of Qt (5.3.1 - I cannot use a newer version), when creating programmatically an odt file, I can add an href by doing:
QTextDocument* l_doc = new QTextDocument();
QTextCursor l_cursor(l_doc);
QTextCharFormat l_tc_fmt;
l_tc_fmt.setAnchor(true);
l_tc_fmt.setAnchorHref("www.stackoverflow.com");
l_tc_fmt.setForeground(QApplication::palette().color(QPalette::Link));
l_tc_fmt.setFontUnderline(true);
l_cursor.setCharFormat(l_tc_fmt);
l_cursor.insertText("stackoverflow");
QTextDocumentWriter l_twd("/home/test.odt");
l_twd.setFormat("odf");
l_twd.write(l_doc);
which results in an odt document containing a clickable string (works both on openoffice and msoffice):
The problem is that this works only on Linux platform, whereas on Windows I get the same underlined, blue string but it cannot be clicked (neither in openoffice nor in msoffice).
Exporting the QTextDocument to html, the only difference I can see is as following:
Windows
Linux
Did anyone experienced the same problem on MS Windows?
Machine: Windows7, browser: Firefox (lastest/recent).
I'm using Julia browser console (JuliaBox) to learn Julia. It works!
I not able to do the following though.
If I select some text in the console and right click > Copy it, the data is not getting copied to the global/system clipboard buffer.
I can open a new file within the console (vi new.txt) and there if I paste the data, it works!!
But if I want to copy the same selected/copied data outside of JuliaBox console, it doesn't work (i.e. if I try to paste it to Notepad++ or in outlook email, word doc etc).
Am I missing anything?
ALSO -- If I copy anything from notepadd++ / word doc or any data from an opened app or browser window, then I CAN'T paste it to JuliaBox console!! even if I try Control+C / Right Click Copy to copy the data.
copy-paste data from JuliaBox console:
use Ctrl+c/Ctrl+v on Windows/Linux or Cmd+c/Cmd+v on Mac.
copy-paste data into JuliaBox console:
a workaround is to use the term.js widget Paste from browser in the right-click menu.
this seems to be a bug, the issue says it will be fixed in the future.
I wrote an R script that uses
> read.table("clipboard",header=TRUE)
to read data from clipboard. But strangely the clipboard always switches back in a to me undeterministic way to a previous clipboard. No matter how or from where I copied new data into the clipboard, running the script always sets the clipboard back to an old clipboard. How can I reset this? Is the clipboard somehow linked to a previous fixed value? If yes how can I refresh this value? The script only read data and makes a plot, I don't write any new data to the clipboard.
Thanks.