本文整理汇总了C++中QCheckBox::setChecked方法的典型用法代码示例。如果您正苦于以下问题:C++ QCheckBox::setChecked方法的具体用法?C++ QCheckBox::setChecked怎么用?C++ QCheckBox::setChecked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCheckBox
的用法示例。
在下文中一共展示了QCheckBox::setChecked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initUi
void QwwTipWidgetPrivate::initUi() {
Q_Q(QwwTipWidget);
QHBoxLayout *l = new QHBoxLayout;
m_check = new QCheckBox;
m_check->setChecked(true);
l->addWidget(m_check);
l->addStretch();
m_prev = new QPushButton;
m_prev->setIcon(QPixmap(":/wwwidgets/arrowleft.png"));
l->addWidget(m_prev);
m_next = new QPushButton;
m_next->setIcon(QPixmap(":/wwwidgets/arrowright.png"));
l->addWidget(m_next);
m_close = new QPushButton;
m_close->setDefault(true);
m_close->setAutoDefault(true);
l->addWidget(m_close);
QVBoxLayout *vl = new QVBoxLayout(q);
m_browser = new QTextBrowser;
m_browser->setOpenExternalLinks(true);
vl->addWidget(m_browser);
vl->addLayout(l);
q->connect(m_close, SIGNAL(clicked()), q, SIGNAL(closed()));
q->connect(m_prev, SIGNAL(clicked()), q, SLOT(prevTip()));
q->connect(m_next, SIGNAL(clicked()), q, SLOT(nextTip()));
q->setTabOrder(m_close, m_next);
q->setTabOrder(m_next, m_prev);
q->setTabOrder(m_prev, m_check);
q->setTabOrder(m_check, m_close);
q->setFocusProxy(m_close);
retranslateUi();
}
示例2: returnWidget
QWidget* CObjectProperty::returnWidget(QWidget *parent_) {
if(m_visible) {
if(m_type == "string") {
QLineEdit* newWidget = new QLineEdit(parent_);
if(!m_editable) newWidget->setEnabled(false);
newWidget->setText(m_property.toString());
QObject::connect(this,SIGNAL(signal_propertyChanged(QString)),newWidget,SLOT(setText(QString)));
QObject::connect(newWidget,SIGNAL(textChanged(QString)),this,SLOT(slot_propertyChanged(QString)));
return newWidget;
} else if(m_type == "longlong") {
QLineEdit* newWidget = new QLineEdit(parent_);
if(!m_editable) newWidget->setEnabled(false);
QValidator* validator = new QIntValidator();
newWidget->setValidator(validator);
newWidget->setText(m_property.toString());
QObject::connect(this,SIGNAL(signal_propertyChanged(QString)),newWidget,SLOT(setText(QString)));
QObject::connect(newWidget,SIGNAL(textChanged(QString)),this,SLOT(slot_propertyChanged(QString)));
return newWidget;
} else if(m_type == "bool") {
QCheckBox* newWidget = new QCheckBox(parent_);
if(!m_editable) newWidget->setEnabled(false);
newWidget->setChecked(m_property.toBool());
QObject::connect(this,SIGNAL(signal_propertyChanged(bool)),newWidget,SLOT(setChecked(bool)));
QObject::connect(newWidget,SIGNAL(toggled(bool)),this,SLOT(slot_propertyChanged(bool)));
return newWidget;
}
}
示例3: QWidget
QWidget* Sis3350UI::createTriggerFIRControls()
{
// Trigger Enable FIR mode
QWidget *box = new QWidget(this);
QSignalMapper *mapper = new QSignalMapper();
QHBoxLayout *l = new QHBoxLayout();
l->setMargin(0);
triggerFir = new QList<QCheckBox*>();
QLabel *label = new QLabel(tr("FIR mode:"),this);
l->addWidget(label);
for(int i=0; i<4; i++)
{
QCheckBox *trgFir = new QCheckBox(this);
if(module->conf.trigger_fir[i])
{
trgFir->setChecked(true);
}
triggerFir->append(trgFir);
connect(trgFir,SIGNAL(stateChanged(int)),mapper,SLOT(map()));
mapper->setMapping(trgFir,i);
l->addWidget(trgFir);
}
connect(mapper,SIGNAL(mapped(int)),this,SLOT(firChanged(int)));
box->setLayout(l);
return box;
}
示例4: QGroupBox
//! [4]
QGroupBox *Window::createSecondExclusiveGroup()
{
QGroupBox *groupBox = new QGroupBox(tr("E&xclusive Radio Buttons"));
groupBox->setCheckable(true);
groupBox->setChecked(false);
//! [4]
//! [5]
QRadioButton *radio1 = new QRadioButton(tr("Rad&io button 1"));
QRadioButton *radio2 = new QRadioButton(tr("Radi&o button 2"));
QRadioButton *radio3 = new QRadioButton(tr("Radio &button 3"));
radio1->setChecked(true);
QCheckBox *checkBox = new QCheckBox(tr("Ind&ependent checkbox"));
checkBox->setChecked(true);
//! [5]
//! [6]
QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(radio1);
vbox->addWidget(radio2);
vbox->addWidget(radio3);
vbox->addWidget(checkBox);
vbox->addStretch(1);
groupBox->setLayout(vbox);
return groupBox;
}
示例5: setValue
void WidgetParameters::setValue(QWidget* curWidget,QVariant value)
{
QLineEdit* lineEdit = dynamic_cast<QLineEdit*>(curWidget);
if(lineEdit)
lineEdit->setText(value.toString());
QScienceSpinBox* dblspinbox = dynamic_cast<QScienceSpinBox*>(curWidget);
if(dblspinbox)
dblspinbox->setValue(value.toDouble());
QSpinBox* spinbox = dynamic_cast<QSpinBox*>(curWidget);
if(spinbox)
spinbox->setValue(value.toInt());
QCheckBox* checkbox = dynamic_cast<QCheckBox*>(curWidget);
if(checkbox)
checkbox->setChecked(value.toBool());
QComboBox* combo = dynamic_cast<QComboBox*>(curWidget);
if(combo)
{
combo->setCurrentIndex(combo->findData(value));
}
}
示例6: setEditorData
void QFRDRTableDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const {
QDateTimeEdit *dateEditor = qobject_cast<QDateTimeEdit *>(editor);
if (dateEditor) {
dateEditor->setDateTime(index.model()->data(index, Qt::EditRole).toDateTime());
} else {
QFDoubleEdit *dEditor = qobject_cast<QFDoubleEdit *>(editor);
if (dEditor) {
dEditor->setValue(index.model()->data(index, Qt::EditRole).toDouble());
} else {
QSpinBox *sEditor = qobject_cast<QSpinBox *>(editor);
if (sEditor) {
sEditor->setValue(index.model()->data(index, Qt::EditRole).toLongLong());
} else {
QCheckBox *check = qobject_cast<QCheckBox *>(editor);
if (check) {
check->setChecked(index.model()->data(index, Qt::EditRole).toBool());
} else {
QLineEdit *edit = qobject_cast<QLineEdit*>(editor);
if (edit) {
edit->setText(index.model()->data(index, Qt::EditRole).toString());
}
}
}
}
}
}
示例7: dontShowAgain
void tst_QErrorMessage::dontShowAgain()
{
QString plainString = QLatin1String("foo");
QString htmlString = QLatin1String("foo<br>bar");
QCheckBox *checkBox = 0;
QErrorMessage errorMessageDialog(0);
// show an error with plain string
errorMessageDialog.showMessage(plainString);
QVERIFY(errorMessageDialog.isVisible());
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
QVERIFY(checkBox);
QVERIFY(checkBox->isChecked());
errorMessageDialog.close();
errorMessageDialog.showMessage(plainString);
QVERIFY(errorMessageDialog.isVisible());
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
QVERIFY(checkBox);
QVERIFY(checkBox->isChecked());
checkBox->setChecked(false);
errorMessageDialog.close();
errorMessageDialog.showMessage(plainString);
QVERIFY(!errorMessageDialog.isVisible());
// show an error with an html string
errorMessageDialog.showMessage(htmlString);
QVERIFY(errorMessageDialog.isVisible());
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
QVERIFY(checkBox);
QVERIFY(!checkBox->isChecked());
checkBox->setChecked(true);
errorMessageDialog.close();
errorMessageDialog.showMessage(htmlString);
QVERIFY(errorMessageDialog.isVisible());
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
QVERIFY(checkBox);
QVERIFY(checkBox->isChecked());
checkBox->setChecked(false);
errorMessageDialog.close();
errorMessageDialog.showMessage(htmlString);
QVERIFY(!errorMessageDialog.isVisible());
}
示例8: caFile
WalkmeshManager::WalkmeshManager(QWidget *parent, const QGLWidget *shareWidget) :
QDialog(parent, Qt::Tool),
idFile(0), caFile(0), infFile(0), scriptsAndTexts(0)
{
setWindowTitle(tr("Zones"));
walkmesh = Config::value("OpenGL", true).toBool() ? new WalkmeshWidget(0, shareWidget) : 0;
QWidget *walkmeshWidget = walkmesh ? walkmesh : new QWidget(this);
slider1 = new QSlider(this);
slider2 = new QSlider(this);
slider3 = new QSlider(this);
slider1->setRange(-180, 180);
slider2->setRange(-180, 180);
slider3->setRange(-180, 180);
slider1->setValue(0);
slider2->setValue(0);
slider3->setValue(0);
QLabel *keyInfos = new QLabel(tr("Utilisez les touches directionnelles pour déplacer la caméra."));
keyInfos->setTextFormat(Qt::PlainText);
keyInfos->setWordWrap(true);
QPushButton *resetCamera = new QPushButton(tr("Remettre à 0"));
QCheckBox *showModels = new QCheckBox(tr("Afficher modèles"));
tabWidget = new QTabWidget(this);
tabWidget->addTab(buildCameraPage(), tr("Caméra"));
tabWidget->addTab(buildWalkmeshPage(), tr("Walkmesh"));
tabWidget->addTab(buildGatewaysPage(), tr("Sorties"));
tabWidget->addTab(buildDoorsPage(), tr("Portes"));
tabWidget->addTab(buildArrowPage(), tr("Flèches"));
tabWidget->addTab(buildCameraRangePage(), tr("Limites caméra"));
tabWidget->addTab(buildMiscPage(), tr("Divers"));
tabWidget->setFixedHeight(250);
QGridLayout *layout = new QGridLayout(this);
layout->addWidget(walkmeshWidget, 0, 0, 4, 1);
layout->addWidget(slider1, 0, 1);
layout->addWidget(slider2, 0, 2);
layout->addWidget(slider3, 0, 3);
layout->addWidget(keyInfos, 1, 1, 1, 3);
layout->addWidget(resetCamera, 2, 1, 1, 3);
layout->addWidget(showModels, 3, 1, 1, 3);
layout->addWidget(tabWidget, 4, 0, 1, 4);
if(walkmesh) {
connect(slider1, SIGNAL(valueChanged(int)), walkmesh, SLOT(setXRotation(int)));
connect(slider2, SIGNAL(valueChanged(int)), walkmesh, SLOT(setYRotation(int)));
connect(slider3, SIGNAL(valueChanged(int)), walkmesh, SLOT(setZRotation(int)));
connect(resetCamera, SIGNAL(clicked()), SLOT(resetCamera()));
connect(showModels, SIGNAL(toggled(bool)), SLOT(setModelsVisible(bool)));
showModels->setChecked(true);
}
}
示例9: addCheckboxes
/**
* Add a site to the list.
*/
void sourcesWindow::addCheckboxes()
{
QSettings settings(savePath("settings.ini"), QSettings::IniFormat);
QString t = settings.value("Sources/Types", "icon").toString();
QStringList k = m_sites->keys();
for (int i = 0; i < k.count(); i++)
{
QCheckBox *check = new QCheckBox();
check->setChecked(m_selected[i]);
check->setText(k.at(i));
connect(check, SIGNAL(stateChanged(int)), this, SLOT(checkUpdate()));
m_checks << check;
ui->gridLayout->addWidget(check, i, 0);
int n = 1;
if (t != "hide")
{
if (t == "icon" || t == "both")
{
QLabel *image = new QLabel();
image->setPixmap(QPixmap(savePath("sites/"+m_sites->value(k.at(i))->type()+"/icon.png")));
ui->gridLayout->addWidget(image, i, n);
m_labels << image;
n++;
}
if (t == "text" || t == "both")
{
QLabel *type = new QLabel(m_sites->value(k.at(i))->value("Name"));
ui->gridLayout->addWidget(type, i, n);
m_labels << type;
n++;
}
}
QBouton *del = new QBouton(k.at(i));
del->setText(tr("Options"));
connect(del, SIGNAL(appui(QString)), this, SLOT(settingsSite(QString)));
m_buttons << del;
ui->gridLayout->addWidget(del, i, n);
}
/*int n = 0+(t == "icon" || t == "both")+(t == "text" || t == "both");
for (int i = 0; i < m_checks.count(); i++)
{
ui->gridLayout->addWidget(m_checks.at(i), i, 0);
m_checks.at(i)->show();
if (!m_labels.isEmpty())
{
for (int r = 0; r < n; r++)
{
ui->gridLayout->addWidget(m_labels.at(i*n+r), i*n+r, 1);
m_labels.at(i*n+r)->show();
}
}
ui->gridLayout->addWidget(m_buttons.at(i), i, n+1);
m_buttons.at(i)->show();
}*/
}
示例10: QDialog
FenetreTaille::FenetreTaille(ImageRGB* image, QWidget *parent) :
QDialog(parent)
{
if(image != NULL)
{
setFixedSize(260,160);
proportionnel = true;
this->image = image;
this->imagePrec = *image;
this->valProp = (double)(image->width()) / (double)(image->height());
QVBoxLayout *layout = new QVBoxLayout;
QCheckBox* prop = new QCheckBox("Conserver les proportions", this);
prop->setChecked(true);
layout->addWidget(prop);
connect(prop, SIGNAL(toggled(bool)), this, SLOT(changeProp(bool)));
QLabel* text1 = new QLabel("hauteur", this);
layout->addWidget(text1);
BoxHauteur = new QSpinBox(this);
BoxHauteur->setMinimum(1);
BoxHauteur->setMaximum(10000);
BoxHauteur->setValue(image->height());
hauteurImage = image->height();
layout->addWidget(BoxHauteur);
connect(BoxHauteur, SIGNAL(valueChanged(int)), this, SLOT(changeHauteur(int)));
QLabel* text2 = new QLabel("Largeur", this);
layout->addWidget(text2);
BoxLargeur = new QSpinBox(this);
BoxLargeur->setMinimum(1);
BoxLargeur->setMaximum(10000);
BoxLargeur->setValue(image->width());
largeurImage = image->width();
layout->addWidget(BoxLargeur);
connect(BoxLargeur, SIGNAL(valueChanged(int)), this, SLOT(changeLargeur(int)));
QHBoxLayout* layout2 = new QHBoxLayout;
QPushButton* bouton_annuler = new QPushButton("Annuler", this);
layout2->addWidget(bouton_annuler);
connect(bouton_annuler, SIGNAL(clicked()), this, SLOT(annuler()));
QPushButton* bouton_ok = new QPushButton("OK", this);
layout2->addWidget(bouton_ok);
layout->addLayout(layout2);
connect(bouton_ok, SIGNAL(clicked()), this, SLOT(valider()));
this->changePourProp = false;
this->setLayout(layout);
}
示例11: setEditorData
void CheckBoxDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
bool value = index.model()->data(index, Qt::EditRole).toBool();
QCheckBox *CheckBox = static_cast<QCheckBox*>(editor);
CheckBox->setChecked(value);
}
示例12: setEditorData
void CheckBoxListDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{
// Set editor data.
QCheckBox* myEditor = static_cast<QCheckBox*>(editor);
myEditor->setText(index.model()->data(index, Qt::DisplayRole).toString());
myEditor->setChecked(index.model()->data(index, Qt::UserRole).toBool());
}
示例13: QWidget
//! [7]
PermissionsTab::PermissionsTab(const QFileInfo &fileInfo, QWidget *parent)
: QWidget(parent)
{
QGroupBox *permissionsGroup = new QGroupBox(tr("Permissions"));
QCheckBox *readable = new QCheckBox(tr("Readable"));
if (fileInfo.isReadable())
readable->setChecked(true);
QCheckBox *writable = new QCheckBox(tr("Writable"));
if ( fileInfo.isWritable() )
writable->setChecked(true);
QCheckBox *executable = new QCheckBox(tr("Executable"));
if ( fileInfo.isExecutable() )
executable->setChecked(true);
QGroupBox *ownerGroup = new QGroupBox(tr("Ownership"));
QLabel *ownerLabel = new QLabel(tr("Owner"));
QLabel *ownerValueLabel = new QLabel(fileInfo.owner());
ownerValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
QLabel *groupLabel = new QLabel(tr("Group"));
QLabel *groupValueLabel = new QLabel(fileInfo.group());
groupValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
QVBoxLayout *permissionsLayout = new QVBoxLayout;
permissionsLayout->addWidget(readable);
permissionsLayout->addWidget(writable);
permissionsLayout->addWidget(executable);
permissionsGroup->setLayout(permissionsLayout);
QVBoxLayout *ownerLayout = new QVBoxLayout;
ownerLayout->addWidget(ownerLabel);
ownerLayout->addWidget(ownerValueLabel);
ownerLayout->addWidget(groupLabel);
ownerLayout->addWidget(groupValueLabel);
ownerGroup->setLayout(ownerLayout);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(permissionsGroup);
mainLayout->addWidget(ownerGroup);
mainLayout->addStretch(1);
setLayout(mainLayout);
}
示例14: addBoolField
void DeclarativeSettingsPageImpl::addBoolField(const QString &key, const DeclarativeSettingsPage::Entry &entry)
{
QCheckBox * control = new QCheckBox(entry.title, pClass_);
if (entry.defaultValue.isValid())
control->setChecked(entry.defaultValue.toBool());
widgets_[key] = control;
addField("", control);
}
示例15: uncheckCol
void AssociationsDialog::uncheckCol(int col)
{
for (int i = 0; i < table->rowCount(); i++){
QCheckBox *it = (QCheckBox *)table->cellWidget(i, col);
if (it)
it->setChecked(false);
}
}