一、
Qt
风格
Qt
中的各种风格是一组继承自QStyle的类。QStyle类是一个抽象基类,封装了 一个GUI的外观,
Qt
的内建(built-in)部件使用它来执行几乎所有的绘制工作,以确保它们看起来可以像各个平台上的本地部件一样。
Qt
提供的风格类如下表所列:
类名 介绍
QCDEStyle CDE(Common Desktop Environment)风格
QCleanlooksStyle 类似于GNOME中的Clearlook风格
QGtkStyle GTK +风格
QMotifStyle
字体属性:(font)
大小 {font-size: x-large;}(特大) xx-small;(极小) 一般中文用不到,只要用数值就可以,单位:PX、PD
样式 {font-style: oblique;}(偏斜体) italic;(斜体) normal;(正常)
行高 {line-height: normal;}(正常) 单位:PX、PD、EM
粗细 {font-weight: bold;}(粗体) lighter;(细体) normal;(正常)
变体 {font-variant: small-.
要取消
Qt
中的 RadioButton 的
选中
状态,可以使用 `setChecked(false)` 方法。具体操作步骤如下:
1. 找到你想要取消
选中
的 RadioButton 对象,可以通过对象名或者其它属性来获取该对象。
2. 调用该对象的 `setChecked(false)` 方法,即可取消该 RadioButton 的
选中
状态。
示例代码如下所示:
```cpp
// 获取 RadioButton 对象
QRadioButton *radioButton = ui->radioButton;
// 取消
选中
状态
radioButton->setChecked(false);
当然,如果你要取消多个 RadioButton 的
选中
状态,也可以通过遍历所有 RadioButton 的方式来实现,代码如下所示:
```cpp
// 遍历所有 RadioButton 取消
选中
状态
foreach (QObject *obj, ui->groupBox->children()) {
QRadioButton *radioButton = qobject_cast<QRadioButton*>(obj);
if (radioButton) {
radioButton->setChecked(false);
以上就是取消
Qt
RadioButton
选中
状态的方法。