本文整理汇总了C++中QAbstractButton::setProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractButton::setProperty方法的具体用法?C++ QAbstractButton::setProperty怎么用?C++ QAbstractButton::setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractButton
的用法示例。
在下文中一共展示了QAbstractButton::setProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
DriverWidget::DriverWidget(const Device &device, QWidget *parent)
: QWidget(parent)
, ui(new Ui::Form)
, m_radioGroup(new QButtonGroup(this))
{
ui->setupUi(this);
ui->label->setText(xi18nc("@info %1 is hardware vendor, %2 is hardware model",
"<title>%1 %2</title>",
device.vendor,
device.model));
// We want to sort drivers so they have consistent order across starts.
QList<Driver> driverList = device.drivers;
qSort(driverList);
foreach (const Driver &driver, driverList) {
// This driver is not manual, but also has no package, hence we cannot
// do anything with it and should not display anything.
if (driver.package == nullptr && !driver.manualInstall){
qDebug() << "encountered invalid driver" << driver.package << driver.manualInstall << "for" << device.model;
continue;
}
QAbstractButton *button;
if (driverList.count() <= 1) {
button = new QCheckBox(this);
m_radioGroup->setExclusive(false);
} else {
button = new QRadioButton(this);
}
button->setProperty("package", driver.packageName);
button->setProperty("builtin", driver.builtin);
ui->verticalLayout->addWidget(button);
m_radioGroup->addButton(button);
if (driver.fuzzyActive) {
button->setChecked(true);
}
if (driver.manualInstall) {
button->setText(i18nc("Manually installed 3rd party driver",
"This device is using a manually-installed driver : (%1)",
driver.packageName));
break; // Manually installed drivers have no additional information available.
}
if (driver.recommended) {
button->setText(i18nc("%1 is description and %2 is package name; when driver is recommended for use",
"Using %1 from %2 (Recommended Driver)",
driver.package->shortDescription(),
driver.package->name()));
} else { // !recommended
button->setText(i18nc("%1 is description and %2 is package name",
"Using %1 from %2",
driver.package->shortDescription(),
driver.package->name()));
}
if (driver.free) {
button->setToolTip(i18nc("The driver is under a open source license",
"Open Source Driver"));
} else { // !free
button->setToolTip(i18nc("The driver is under a proprietary license",
"Proprietary Driver"));
}
}
m_indexSelected = m_radioGroup->checkedId();
m_defaultSelection = m_indexSelected;
connect(m_radioGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SIGNAL(selectionChanged()));
}