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?
Related
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.
Im currently trying to load a file in my jupyter notebook, to read it's content.
My Code:
file = widgets.FileUpload(
description= 'Title',
accept='.csv',
multiple=False,
)
box = widgets.HBox([file])
display(box)
# New Cell
print(str(file))
I run the first cell, after that i use the FileUploader to Upload a .csv File before running the second cell.
I expect the output to be a dict containing the files Context like "content" etc.
A Screenshot of a simpler version:
Does anyone know that i'm doing wrong?
I also tried every other idea that came to my mind.
Unfortunately, at the moment file upload widget only retrieves file value if you are using classic Jupyter lab through your browser, and IDEs such as Pycharm and VScode do not support the feature.
Open the notebook on classic Jupyter lab and try to upload the file there, and you will see your code works perfectly.
Try accessing file.value instead.
More info here: https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html#file-upload
In R (just default mac R) on my mac machine, when I see the help page with
> ?read.csv
it appears on a new window with a beautiful format.
Now I'm using the Sublime text 3 for R (with SublimeREPL:R, R-Box, R-Extended etc.) on the mac machine, many things work fine.
My question is:
when I type the help page (?read.csv), the contents appear on the same ST3 window with a plain format.
Is there any way to make it appear on a new window such as a HTML page (in Safari)?
Set the help_type option to "html":
options(help_type = 'html')
and it will open help files in the default browser. If you put that in your .Rprofile, you won't need to set it for each session.
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 am working on application which needs to load bmp 16bit(5-6-5) images to QPixmap. Is there any way in Qt of doing this directly like for 24bit bmp's?
I tried to convert all images to 24bit version and there were no problems with loading them. Unfortunately I really need to work with 16bit.
I tried also the following code, but without success. However I could load 16bit (1-5-5-5) version of my bmp.
QImage img = QImage(300, 300, QImage::Format_RGB16);
img.loadFromData(imgArray);
ui->test->setPixmap(QPixmap::fromImage(img));
It seems to work pretty well for me using the QImage constructor:
QImage::QImage(const QString & fileName, const char * format = 0)
Basically, the use would be:
QImage img = QImage("filename.bmp")
and the RGB16 format should be picked up by the constructor on its own from the file header.
EDIT:
The file you posted seems to be using a header type that is not supported by Qt. It is an undocumented header with size 56 called BITMAPV3INFOHEADER, which Wikipedia explains as:
Not officially documented, but this documentation was posted Adobe's
forums, by an employee of Adobe with a statement that the standard was
at one point in the past included in official MS documentation
https://forums.adobe.com/message/3272950#3272950
It seems to be a quite special header type that is not supported by many libraries. However, gimp or ImageMagic can load it and convert it, so I suggest that you converted your files to another BMP file with RGB565 encoding that uses a more standard header. Then, the above code will work for you.