| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 1 | |
Hi, I want to display pics in QTextBrowser. I load picture in Pixmap like this: std::string PixmapData = _user.getData(); QPixmap px_userIcon; px_userIcon.loadFromData((uchar *) PixmapData.c_str(), PixmapData.size()); How can I show this in a QTextBrowser. I can display it using <img> tag "<img src=\":pics/user.png\">" But the problem is images can be generated at run time. So I need to display it via QPixmap/std::string Any help would be great. Thanks -- [ signature omitted ]
On Friday 02 February 2007 21:58:27 Jaya Meghani wrote:
> Hi,
>
> I want to display pics in QTextBrowser.
>
> I load picture in Pixmap like this:
>
> std::string PixmapData = _user.getData();
>
> QPixmap px_userIcon;
> px_userIcon.loadFromData((uchar *) PixmapData.c_str(),
> PixmapData.size());
>
> How can I show this in a QTextBrowser.
>
> I can display it using <img> tag
> "<img src=\":pics/user.png\">"
>
> But the problem is images can be generated at run time. So I need to
> display it via QPixmap/std::string
>
> Any help would be great.
Try
textBrowser->document()->addResource("mypicture", px_userIcon);
with
<img src="mypicture" />
in HTML :)
Simon
Attachment:
Attachment:
pgpGK6A6NmR8K.pgp
Description: PGP signature