QT-QlistWidget自定义item

本文介绍如何在QT编程中将自定义的Widget添加到QlistWidget,实现更丰富的显示效果。
摘要由CSDN通过智能技术生成

1、将自定义的widget添加到QlistWidget中

QWidget *widget=new QWidget(this);
QWidget *mainArea = new QWidget(widget);
QWidget *fileinfoWidget = new QWidget(mainArea);

//显示区域的布局
QVBoxLayout *verLayout = new QVBoxLayout();
QHBoxLayout *horLayout = new QHBoxLayout();
QHBoxLayout *fileinfoLayout = new QHBoxLayout();

//主要控件
QLabel *idLabel = new QLabel(widget);
QLabel *textLabel = new QLabel(mainArea);
QLabel *speedLabel = new QLabel(mainArea);
QProgressBar *progressbar = new QProgressBar(mainArea);
QPushButton *giveupButton = new QPushButton(widget);
QLabel *tipLabel1 = new QLabel(widget);
QLabel *tipLabel2 = new QLabel(widget);
QLabel *filesizeLabel = new QLabel(widget);

//设置不同控件的样式
idLabel->setFixedSize(30, 30);
idLabel->setStyleSheet("background:" + currentColor + "; border-radius:15px;color:white;");
idLabel->setText(setFormat(id));
idLabel->setAlignment(Qt::AlignCe
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值