本文整理汇总了C++中QPushButton::isCheckable方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::isCheckable方法的具体用法?C++ QPushButton::isCheckable怎么用?C++ QPushButton::isCheckable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPushButton
的用法示例。
在下文中一共展示了QPushButton::isCheckable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObject *object)
{
QAccessibleInterface *iface = 0;
if (!object || !object->isWidgetType())
return iface;
QWidget *widget = static_cast<QWidget*>(object);
if (false) {
#ifndef QT_NO_LINEEDIT
} else if (classname == QLatin1String("QLineEdit")) {
iface = new QAccessibleLineEdit(widget);
#endif
#ifndef QT_NO_COMBOBOX
} else if (classname == QLatin1String("QComboBox")) {
iface = new QAccessibleComboBox(widget);
#endif
#ifndef QT_NO_SPINBOX
} else if (classname == QLatin1String("QAbstractSpinBox")) {
iface = new QAccessibleAbstractSpinBox(widget);
} else if (classname == QLatin1String("QSpinBox")) {
iface = new QAccessibleSpinBox(widget);
} else if (classname == QLatin1String("QDoubleSpinBox")) {
iface = new QAccessibleDoubleSpinBox(widget);
#endif
#ifndef QT_NO_SCROLLBAR
} else if (classname == QLatin1String("QScrollBar")) {
iface = new QAccessibleScrollBar(widget);
#endif
} else if (classname == QLatin1String("QAbstractSlider")) {
iface = new QAccessibleAbstractSlider(widget);
#ifndef QT_NO_SLIDER
} else if (classname == QLatin1String("QSlider")) {
iface = new QAccessibleSlider(widget);
#endif
#ifndef QT_NO_TOOLBUTTON
} else if (classname == QLatin1String("QToolButton")) {
Role role = NoRole;
#ifndef QT_NO_MENU
QToolButton *tb = qobject_cast<QToolButton*>(widget);
if (!tb->menu())
role = tb->isCheckable() ? CheckBox : PushButton;
else if (!tb->popupMode() != QToolButton::DelayedPopup)
role = ButtonDropDown;
else
#endif
role = ButtonMenu;
iface = new QAccessibleToolButton(widget, role);
#endif // QT_NO_TOOLBUTTON
} else if (classname == QLatin1String("QCheckBox")) {
iface = new QAccessibleButton(widget, CheckBox);
} else if (classname == QLatin1String("QRadioButton")) {
iface = new QAccessibleButton(widget, RadioButton);
} else if (classname == QLatin1String("QPushButton")) {
Role role = NoRole;
QPushButton *pb = qobject_cast<QPushButton*>(widget);
#ifndef QT_NO_MENU
if (pb->menu())
role = ButtonMenu;
else
#endif
if (pb->isCheckable())
role = CheckBox;
else
role = PushButton;
iface = new QAccessibleButton(widget, role);
} else if (classname == QLatin1String("QAbstractButton")) {
iface = new QAccessibleButton(widget, PushButton);
} else if (classname == QLatin1String("QDialog")) {
iface = new QAccessibleWidgetEx(widget, Dialog);
} else if (classname == QLatin1String("QMessageBox")) {
iface = new QAccessibleWidgetEx(widget, AlertMessage);
#ifndef QT_NO_MAINWINDOW
} else if (classname == QLatin1String("QMainWindow")) {
iface = new QAccessibleMainWindow(widget);
#endif
} else if (classname == QLatin1String("QLabel") || classname == QLatin1String("QLCDNumber")) {
iface = new QAccessibleDisplay(widget);
} else if (classname == QLatin1String("QGroupBox")) {
iface = new QAccessibleDisplay(widget, Grouping);
} else if (classname == QLatin1String("QStatusBar")) {
iface = new QAccessibleWidgetEx(widget, StatusBar);
} else if (classname == QLatin1String("QProgressBar")) {
iface = new QAccessibleDisplay(widget);
} else if (classname == QLatin1String("QToolBar")) {
iface = new QAccessibleWidgetEx(widget, ToolBar, widget->windowTitle());
#ifndef QT_NO_MENUBAR
} else if (classname == QLatin1String("QMenuBar")) {
iface = new QAccessibleMenuBar(widget);
#endif
#ifndef QT_NO_MENU
} else if (classname == QLatin1String("QMenu")) {
iface = new QAccessibleMenu(widget);
} else if (classname == QLatin1String("Q3PopupMenu")) {
iface = new QAccessibleMenu(widget);
#endif
#ifndef QT_NO_ITEMVIEWS
} else if (classname == QLatin1String("QHeaderView")) {
iface = new QAccessibleHeader(widget);
} else if (classname == QLatin1String("QAbstractItemView")) {
iface = new QAccessibleItemView(widget);
//.........这里部分代码省略.........
示例2: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
for (int i = MAX_DI - 1;i >= 0;i--)
{
QPushButton *b = new QPushButton(ui->groupBoxDI);
b->setText(tr("Input %1").arg(i));
connect(b, &QPushButton::pressed, [=]()
{
if (!b->isCheckable())
inputDiPressed(i, true);
});
connect(b, &QPushButton::released, [=]()
{
if (!b->isCheckable())
inputDiPressed(i, false);
});
connect(b, &QPushButton::toggled, [=](bool state)
{
if (b->isCheckable())
inputDiPressed(i, state);
});
ui->verticalLayout_6->insertWidget(1, b);
listDI.prepend(b);
}
for (int i = MAX_DI - 1;i >= 0;i--)
{
QCheckBox *c = new QCheckBox(ui->groupBoxDO);
c->setText(tr("Output %1").arg(i));
connect(c, &QCheckBox::toggled, [=](bool state)
{
inputDoPressed(i, state);
});
ui->verticalLayout_7->insertWidget(0, c);
listDO.prepend(c);
}
for (int i = MAX_AI - 1;i >= 0;i--)
{
QLineEdit *l = new QLineEdit(ui->groupBoxAI);
l->setPlaceholderText("Hexadecimal A-F, a-f, 0-9.");
l->setMaxLength(32767);
ui->verticalLayout_8->insertWidget(0, l);
connect(l, &QLineEdit::textChanged, [=](const QString &txt)
{
inputAiChanged(i, txt);
});
listAI.prepend(l);
}
for (int i = MAX_AO - 1;i >= 0;i--)
{
QLineEdit *l = new QLineEdit(ui->groupBoxAO);
l->setPlaceholderText("Hexadecimal A-F, a-f, 0-9.");
l->setMaxLength(32767);
ui->verticalLayout_9->insertWidget(0, l);
connect(l, &QLineEdit::textChanged, [=](const QString &txt)
{
inputAoChanged(i, txt);
});
listAO.prepend(l);
}
statusBar()->clearMessage();
statusBar()->showMessage("Not running");
}
示例3: if
QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObject *object)
{
QAccessibleInterface *iface = 0;
if (!object || !object->isWidgetType())
return iface;
QWidget *widget = static_cast<QWidget*>(object);
if (false) {
#ifndef QT_NO_LINEEDIT
} else if (classname == QLatin1String("QLineEdit")) {
iface = new QAccessibleLineEdit(widget);
#endif
#ifndef QT_NO_COMBOBOX
} else if (classname == QLatin1String("QComboBox")) {
iface = new QAccessibleComboBox(widget);
#endif
#ifndef QT_NO_SPINBOX
} else if (classname == QLatin1String("QAbstractSpinBox")) {
iface = new QAccessibleAbstractSpinBox(widget);
} else if (classname == QLatin1String("QSpinBox")) {
iface = new QAccessibleSpinBox(widget);
} else if (classname == QLatin1String("QDoubleSpinBox")) {
iface = new QAccessibleDoubleSpinBox(widget);
#endif
#ifndef QT_NO_SCROLLBAR
} else if (classname == QLatin1String("QScrollBar")) {
iface = new QAccessibleScrollBar(widget);
#endif
} else if (classname == QLatin1String("QAbstractSlider")) {
iface = new QAccessibleAbstractSlider(widget);
#ifndef QT_NO_SLIDER
} else if (classname == QLatin1String("QSlider")) {
iface = new QAccessibleSlider(widget);
#endif
#ifndef QT_NO_TOOLBUTTON
} else if (classname == QLatin1String("QToolButton")) {
QAccessible::Role role = QAccessible::NoRole;
#ifndef QT_NO_MENU
QToolButton *tb = qobject_cast<QToolButton*>(widget);
if (!tb->menu())
role = tb->isCheckable() ? QAccessible::CheckBox : QAccessible::PushButton;
else if (tb->popupMode() == QToolButton::DelayedPopup)
role = QAccessible::ButtonDropDown;
else
#endif
role = QAccessible::ButtonMenu;
iface = new QAccessibleToolButton(widget, role);
#endif // QT_NO_TOOLBUTTON
} else if (classname == QLatin1String("QCheckBox")) {
iface = new QAccessibleButton(widget, QAccessible::CheckBox);
} else if (classname == QLatin1String("QRadioButton")) {
iface = new QAccessibleButton(widget, QAccessible::RadioButton);
} else if (classname == QLatin1String("QPushButton")) {
QAccessible::Role role = QAccessible::NoRole;
QPushButton *pb = qobject_cast<QPushButton*>(widget);
#ifndef QT_NO_MENU
if (pb->menu())
role = QAccessible::ButtonMenu;
else
#endif
if (pb->isCheckable())
role = QAccessible::CheckBox;
else
role = QAccessible::PushButton;
iface = new QAccessibleButton(widget, role);
} else if (classname == QLatin1String("QAbstractButton")) {
iface = new QAccessibleButton(widget, QAccessible::PushButton);
} else if (classname == QLatin1String("QDialog")) {
iface = new QAccessibleWidget(widget, QAccessible::Dialog);
} else if (classname == QLatin1String("QMessageBox")) {
iface = new QAccessibleWidget(widget, QAccessible::AlertMessage);
#ifndef QT_NO_MAINWINDOW
} else if (classname == QLatin1String("QMainWindow")) {
iface = new QAccessibleMainWindow(widget);
#endif
} else if (classname == QLatin1String("QLabel") || classname == QLatin1String("QLCDNumber")) {
iface = new QAccessibleDisplay(widget);
#ifndef QT_NO_GROUPBOX
} else if (classname == QLatin1String("QGroupBox")) {
iface = new QAccessibleGroupBox(widget);
#endif
} else if (classname == QLatin1String("QStatusBar")) {
iface = new QAccessibleDisplay(widget);
#ifndef QT_NO_PROGRESSBAR
} else if (classname == QLatin1String("QProgressBar")) {
iface = new QAccessibleProgressBar(widget);
#endif
} else if (classname == QLatin1String("QToolBar")) {
iface = new QAccessibleWidget(widget, QAccessible::ToolBar, widget->windowTitle());
#ifndef QT_NO_MENUBAR
} else if (classname == QLatin1String("QMenuBar")) {
iface = new QAccessibleMenuBar(widget);
#endif
#ifndef QT_NO_MENU
} else if (classname == QLatin1String("QMenu")) {
iface = new QAccessibleMenu(widget);
#endif
#ifndef QT_NO_ITEMVIEWS
} else if (classname == QLatin1String("QTreeView")) {
iface = new QAccessibleTree(widget);
//.........这里部分代码省略.........