当前位置:网站首页>Qt | 控件之QComboBox
Qt | 控件之QComboBox
2022-07-18 00:33:00 【InfoQ】
- 静态方式:直接从工具箱中拖拉复选框控件的方式,不需要手动添加头文件,Qt Creator会自动添加;
- 动态方式:通过new创建复选框的方式,需要我们通过代码来手动添加头文件。
/* 未下拉时 */
"QComboBox {border:1px solid #eeeeee;border-radius:4px;
padding:1px 18px 1px 50px; background:#ffffff;
font-size:14px;color:#333333;font-family:Microsoft YaHei UI;}
QComboBox:checked {border:1px solid #069aae;}//下拉后,整个下拉窗体样式
QComboBox QAbstractItemView{outline: 0px solid gray;//选定项的虚线框
border:1px solid #eeeeee;//整个下拉窗体的边框
color:#333333;font-size:14px;font-family:Microsoft YaHei UI;
background-color: #ffffff;//整个下拉窗体的背景色
selection-color:#333333;selection-background-color:#f1f8ff;}//被选中的背景色
/* 下拉箭头样式 */
QComboBox::drop-down {subcontrol-origin: padding;subcontrol-position: top right;
width: 16px;
border-left: 0px solid darkgray;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;}
QComboBox::down-arrow {image:url(:/image/gdt_xx_n.png); padding-right: 10px;}
QComboBox::down-arrow:on {image:url(:/image/gdt_xs_n.png); padding-right: 10px;}";
- 带图标:combo->addItem(QIcon(:/image/Henan.png), "Henan");
- 不带图标:combo->addItem("Henan");
QStringList strList;
strList<<"Henan"<<"ShanDong"<<"FuJian"<<"TianJin";
combo->addItems(strList);
- int currentIndex();//返回当前项的序号,第一个项的序号为0。
- QString currentText();//返回当前项的文字。
- QVariant currentData(int role = Qt::UserRole);//返回当前项的关联数据,数据的缺省角色为role=Qt::UserRole(可以自定义的数据)。
- QString itemText(int index);//返回指定索引号的项的文字。
- QVariant itemData(int index, int role = Qt::UserRole);//返回指定索引号的项的关联数据。
- int count();//返回项的个数。
- void currentIndexChanged(int index);
- void currentIndexChanged(const QString &text);
边栏推荐
- PostgreSQL installation et démarrage des tutoriels de base sous Linux et Windows
- C language simple version address book (static version)
- Radiotap
- Devops tool chain: open and free to choose the tools most suitable for the needs of the team and business
- Wpa_ Supplicant WiFi connection
- Code compliance: five reasons why developers use helix QAC
- Notepad++实用功能分享(正则行尾行首替换常用方法、文本比对功能等)
- The lifecycle of arkui development framework components
- Selenium三种等待方式以及Alert弹窗的三种处理方式
- Is online account opening safe? I want to know where I can open an account in Nanning now?
猜你喜欢

Stack和Queue容器的系列操作( 详解 )

【软件测试】——postman接口测试工具完整教程

数字IC-1.11.1 静态时序分析 - 单周期静态时序分析

OSPF综合实验

PbootCMS search SQL注入漏洞

可以写进简历的软件测试项目实战经验(包含电商、银行、app等)

C # FTP dual network card problem

Notepad++实用功能分享(正则行尾行首替换常用方法、文本比对功能等)

Identity server 4 uses openid connect to add user authentication (3)

Through JMeter pressure measurement surging
随机推荐
网上开户安全么?接着证券开户选择哪个证券
Zhiniu stock -- 08
Caddy's introduction
Work notes | talk about data quality audit
Offline installation of MariaDB
ArkUI常见问题汇总【系列2】
Lambda function and for items Sort (key = lambda y:y[1], reverse = true).
通过jmeter压测surging
ArkUI路由跳转
【FPGA】:ip核-----CIC滤波器
Learning notes of JUC source code 2 - AQS sharing and semaphore, countdownlatch
使用flex布局实现局部滚动条
Wpa_supplicant WiFi连接
2022/7/17
数字IC-1.11.1 静态时序分析 - 单周期静态时序分析
SSH uses Socks5 proxy to connect to the remote server
LVS负载均衡群集
Est - il sûr d'ouvrir un compte en ligne pour acheter des fonds? Je viens de toucher le Fonds, je ne sais pas comment demander des conseils.
Get a list of dates in recent 30 days
通过群晖套件搭建内网邮件服务