QWidget 用于显示带有小图片的文本(图标/表情符号) [英] QWidget for showing text with small pictures (icons/emoticons)

查看:25
本文介绍了QWidget 用于显示带有小图片的文本(图标/表情符号)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这样的小部件存在吗?

我可以基于 QLabel 和类似于 http://qt-project.org/doc/qt-5/qtwidgets-layouts-flowlayout-example.html,但是我不能全选文本和复制(因为这只是一组标签).

I can write my own widget based on QLabels and layout similar to http://qt-project.org/doc/qt-5/qtwidgets-layouts-flowlayout-example.html, but then I can't select all text and copy (because this is just a set of labels).

推荐答案

A QLabel 的 text 属性 可以包含富文本,img 标签在 Qt 的富文本中被支持.

A QLabel's text property can have rich text in it, and the img tag is supported in rich text in Qt.

例如

QLabel myLabel("<img src=\":/foo.png\"> Hello, World!");

这篇关于QWidget 用于显示带有小图片的文本(图标/表情符号)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆