本文整理汇总了C++中QCheckBox::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ QCheckBox::setVisible方法的具体用法?C++ QCheckBox::setVisible怎么用?C++ QCheckBox::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCheckBox
的用法示例。
在下文中一共展示了QCheckBox::setVisible方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: authentication
void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth)
{
QDialog* dialog = new QDialog(p_QupZilla);
dialog->setWindowTitle(tr("Authorization required"));
QFormLayout* formLa = new QFormLayout(dialog);
QLabel* label = new QLabel(dialog);
QLabel* userLab = new QLabel(dialog);
QLabel* passLab = new QLabel(dialog);
userLab->setText(tr("Username: "));
passLab->setText(tr("Password: "));
QLineEdit* user = new QLineEdit(dialog);
QLineEdit* pass = new QLineEdit(dialog);
QCheckBox* save = new QCheckBox(dialog);
save->setText(tr("Save username and password on this site"));
pass->setEchoMode(QLineEdit::Password);
QDialogButtonBox* box = new QDialogButtonBox(dialog);
box->addButton(QDialogButtonBox::Ok);
box->addButton(QDialogButtonBox::Cancel);
connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));
label->setText(tr("A username and password are being requested by %1. "
"The site says: \"%2\"").arg(reply->url().toEncoded(), Qt::escape(auth->realm())));
formLa->addRow(label);
formLa->addRow(userLab, user);
formLa->addRow(passLab, pass);
formLa->addRow(save);
formLa->addWidget(box);
AutoFillModel* fill = mApp->autoFill();
if (fill->isStored(reply->url())) {
save->setChecked(true);
user->setText(fill->getUsername(reply->url()));
pass->setText(fill->getPassword(reply->url()));
}
emit wantsFocus(reply->url());
//Do not save when private browsing is enabled
if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
save->setVisible(false);
}
if (dialog->exec() != QDialog::Accepted) {
return;
}
auth->setUser(user->text());
auth->setPassword(pass->text());
if (save->isChecked()) {
fill->addEntry(reply->url(), user->text(), pass->text());
}
}
示例2: disableCheckbox
void SensorsDialog::disableCheckbox(int index)
{
QCheckBox *cb = getCheckboxPtr(index);
if (cb != NULL) {
cb->setText("");
cb->setEnabled(false);
cb->setVisible(false);
}
}
示例3: addCheck
// Create new checkbox widget
QtWidgetObject* AtenTreeGuiDialog::addCheck(TreeGuiWidget* widget, QString label)
{
QtWidgetObject* qtwo = widgetObjects_.add();
QCheckBox *check = new QCheckBox(this);
qtwo->set(widget, check);
check->setText(label);
check->setChecked(widget->valueI());
check->setEnabled(widget->enabled());
check->setVisible(widget->visible());
check->setMinimumHeight(WIDGETHEIGHT);
check->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
// Connect signal to master slot
QObject::connect(check, SIGNAL(clicked(bool)), this, SLOT(checkBoxWidget_clicked(bool)));
return qtwo;
}
示例4: updateControls
void DetailsWidgetPrivate::updateControls()
{
if (m_widget)
m_widget->setVisible(m_state == DetailsWidget::Expanded || m_state == DetailsWidget::NoSummary);
m_detailsButton->setChecked(m_state == DetailsWidget::Expanded && m_widget);
m_detailsButton->setVisible(m_state == DetailsWidget::Expanded || m_state == DetailsWidget::Collapsed);
m_summaryLabelIcon->setVisible(m_state != DetailsWidget::NoSummary && !m_useCheckBox);
m_summaryLabel->setVisible(m_state != DetailsWidget::NoSummary && !m_useCheckBox);
m_summaryCheckBox->setVisible(m_state != DetailsWidget::NoSummary && m_useCheckBox);
for (QWidget *w = q; w; w = w->parentWidget()) {
if (w->layout())
w->layout()->activate();
if (QScrollArea *area = qobject_cast<QScrollArea*>(w)) {
QEvent e(QEvent::LayoutRequest);
QCoreApplication::sendEvent(area, &e);
}
}
}
示例5: authentication
void NetworkManager::authentication(const QUrl &url, QAuthenticator *auth, QWidget *parent)
{
QDialog* dialog = new QDialog(parent);
dialog->setWindowTitle(tr("Authorisation required"));
QFormLayout* formLa = new QFormLayout(dialog);
QLabel* label = new QLabel(dialog);
QLabel* userLab = new QLabel(dialog);
QLabel* passLab = new QLabel(dialog);
userLab->setText(tr("Username: "));
passLab->setText(tr("Password: "));
QLineEdit* user = new QLineEdit(dialog);
QLineEdit* pass = new QLineEdit(dialog);
pass->setEchoMode(QLineEdit::Password);
QCheckBox* save = new QCheckBox(dialog);
save->setText(tr("Save username and password for this site"));
QDialogButtonBox* box = new QDialogButtonBox(dialog);
box->addButton(QDialogButtonBox::Ok);
box->addButton(QDialogButtonBox::Cancel);
connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));
label->setText(tr("A username and password are being requested by %1. "
"The site says: \"%2\"").arg(url.host(), auth->realm().toHtmlEscaped()));
formLa->addRow(label);
formLa->addRow(userLab, user);
formLa->addRow(passLab, pass);
formLa->addRow(save);
formLa->addWidget(box);
AutoFill* fill = mApp->autoFill();
QString storedUser;
QString storedPassword;
bool shouldUpdateEntry = false;
if (fill->isStored(url)) {
const QVector<PasswordEntry> &data = fill->getFormData(url);
if (!data.isEmpty()) {
save->setChecked(true);
shouldUpdateEntry = true;
storedUser = data.at(0).username;
storedPassword = data.at(0).password;
user->setText(storedUser);
pass->setText(storedPassword);
}
}
// Do not save when private browsing is enabled
if (mApp->isPrivate()) {
save->setVisible(false);
}
if (dialog->exec() != QDialog::Accepted) {
delete dialog;
return;
}
auth->setUser(user->text());
auth->setPassword(pass->text());
if (save->isChecked()) {
if (shouldUpdateEntry) {
if (storedUser != user->text() || storedPassword != pass->text()) {
fill->updateEntry(url, user->text(), pass->text());
}
}
else {
fill->addEntry(url, user->text(), pass->text());
}
}
delete dialog;
}
示例6: QWidget
//.........这里部分代码省略.........
//---
// Buttons
startButton = new QPushButton("Start");
connect(startButton, SIGNAL(clicked()), this, SLOT(start_pause_resume()));
connect(this, SIGNAL(startPushed()), mainWin, SLOT(startComputing()));
connect(this, SIGNAL(pauseOrResumePushed(bool)), mainWin, SLOT(pauseComputing(bool)));
stopButton = new QPushButton("Stop");
stopButton->setEnabled(false);
connect(stopButton, SIGNAL(clicked()), mainWin, SLOT(stopComputing()));
connect(stopButton, SIGNAL(clicked()), this, SLOT(stop()));
// Checkbox for saving option
saveDirCheckBox = new QCheckBox("Save data");
saveDirCheckBox->setChecked(false);
// Button for QFileDialog
saveDirButton = new QPushButton("Choose saving directory");
connect(saveDirButton, SIGNAL(clicked()), this, SLOT(changeDirectory()));
// Steps to skip Label
QLabel *saveStepsLabel = new QLabel("Steps between saves :");
// Steps to skip Spinbox
saveStepsSpinBox = new QSpinBox();
saveStepsSpinBox->setRange(1, 1000000);
saveStepsSpinBox->setSingleStep(1);
saveStepsSpinBox->setValue(defaultNbStepsToSave);
connect(saveStepsSpinBox, SIGNAL(valueChanged(int)), mainWin, SLOT(changeNbStepsToSave(int)));
//---
// Labels and lists for variables to display
QLabel *variablesRenderedLabel = new QLabel("Variables rendered :");
variablesRenderedList = new QListWidget;
variablesRenderedList->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
variablesRenderedList->setMinimumSize(QSize(30,100)); //modify if needed (height = nItems * cst?)
connect(variablesRenderedList, SIGNAL(itemChanged(QListWidgetItem *)), this, SLOT(updateRenderedVars(QListWidgetItem *)));
// Rendering colormap label & dropdown list
QLabel *colorLabel = new QLabel("Colormap :");
QComboBox *colorComboBox = new QComboBox;
std::map<std::string, std::pair<unsigned int, float*>> colormap = ColorMap::multiHueColorMaps();
for (auto it = colormap.begin(); it != colormap.end(); ++it) {
colorComboBox->addItem(QString(it->first.c_str()));
}
connect(colorComboBox, SIGNAL(currentIndexChanged(const QString &)), mainWin, SLOT(changeColormap(const QString &)));
// Auto rendering checkbox
QCheckBox *autoRenderCheckBox = new QCheckBox("Automatic rendering");
autoRenderCheckBox->setChecked(true);
connect(autoRenderCheckBox, SIGNAL(stateChanged(int)), mainWin, SLOT(changeAutoRendering(int)));
connect(autoRenderCheckBox, SIGNAL(stateChanged(int)), this, SLOT(showSlider(int)));
autoRenderCheckBox->setVisible(false);
// Iteration selection slider
gridSlider = new QSlider(Qt::Horizontal);
gridSlider->setRange(1, 100); // to be updated when iterSpinBox changes value
gridSlider->setPageStep(5);
gridSlider->setSingleStep(1);
gridSlider->setTracking(false);
gridSlider->setValue(1);
gridSlider->hide();
connect(gridSlider, SIGNAL(valueChanged(int)), mainWin, SLOT(changeDisplayedGrid(int)));
//----//
// Add Widgets
globalLayout->setSpacing(30);
globalLayout->addWidget(modelGroupBox);
globalLayout->addWidget(runGroupBox);
globalLayout->addWidget(renderOptionsGroupBox);
modelLayout->setSpacing(10);
modelLayout->addWidget(modelLabel, 0, 0);
modelLayout->addWidget(modelComboBox, 0, 1);
modelLayout->addWidget(iterLabel, 1, 0);
modelLayout->addWidget(iterSpinBox, 1, 1);
modelLayout->addWidget(initButton, 2, 0);
modelLayout->addWidget(paramsButton, 2, 1);
runLayout->setSpacing(10);
runLayout->addWidget(startButton, 0, 0, 1, 2);
runLayout->addWidget(stopButton, 1, 0, 1, 2);
runLayout->addWidget(saveDirCheckBox, 2, 0);
runLayout->addWidget(saveDirButton, 2, 1);
runLayout->addWidget(saveStepsLabel, 3, 0);
runLayout->addWidget(saveStepsSpinBox, 3, 1);
renderOptionsLayout->setSpacing(10);
renderOptionsLayout->addWidget(variablesRenderedLabel, 0, 0);
renderOptionsLayout->addWidget(variablesRenderedList, 0, 1);
renderOptionsLayout->addWidget(colorLabel, 1, 0);
renderOptionsLayout->addWidget(colorComboBox,1 , 1);
renderOptionsLayout->addWidget(autoRenderCheckBox, 2, 0);
renderOptionsLayout->addWidget(gridSlider, 2, 1);
// Init m_argsMap and m_varsMap
refreshParameters(modelComboBox->currentIndex());
}