PDA

View Full Version : How to add a border to the QTextEdit image?



tiaoweiliao
20th April 2016, 09:07
Question 1:

I try to add a border to the QTextEdit image.

code is :
QString image_html = QString("<img border="3" src="C:/test.png">");
ui->textEdit->insertHtml(image_html);

The picture shows no problem , but picture is no border.

I'm using Qt 5.3.1. windows 7 64bit.


Question 2:

how to get QTextCursor current coordinates? I want to display the coordinates my widget.

d_stranz
20th April 2016, 17:04
Qt supports a subset of HTML (http://doc.qt.io/qt-5/richtext-html-subset.html) in rich text.

tiaoweiliao
21st April 2016, 03:59
thx , i see img Supports the src, source (for Qt 3 compatibility), width, and height attributes.

no border attribute , Have other way to add for img?

d_stranz
21st April 2016, 17:00
Can you make a one-cell table (that supports the "border" attribute) and embed your image in the cell?

tiaoweiliao
22nd April 2016, 06:14
thx,I can only so. :)