Пример #1
0
void TaskProjGroup::setupViewCheckboxes(bool addConnections)
{
    if ( multiView == NULL ) {
        return;
    }

    // There must be a better way to construct this list...
    QCheckBox * viewCheckboxes[] = { ui->chkView0,
                                     ui->chkView1,
                                     ui->chkView2,
                                     ui->chkView3,
                                     ui->chkView4,
                                     ui->chkView5,
                                     ui->chkView6,
                                     ui->chkView7,
                                     ui->chkView8,
                                     ui->chkView9 };


    for (int i = 0; i < 10; ++i) {
        QCheckBox *box = viewCheckboxes[i];
        if (addConnections) {
            connect(box, SIGNAL(toggled(bool)), this, SLOT(viewToggled(bool)));
        }

        const char *viewStr = viewChkIndexToCStr(i);
        if ( viewStr != NULL && multiView->hasProjection(viewStr) ) {
            box->setCheckState(Qt::Checked);
        } else {
            box->setCheckState(Qt::Unchecked);
        }
    }
}
Пример #2
0
void WidgetMOItem::updateWidgetValue(QWidget* curWidget, QVariant value)
{
    QComboBox* combo = dynamic_cast<QComboBox*>(curWidget);
    if(combo)
        combo->setEditText(value.toString());

    QSpinBox* spinBox = dynamic_cast<QSpinBox*>(curWidget);
    if(spinBox)
        spinBox->setValue(value.toInt());

    QScienceSpinBox* doubleSpinBox = dynamic_cast<QScienceSpinBox*>(curWidget);
    if(doubleSpinBox)
        doubleSpinBox->setValue(value.toDouble());

    QCheckBox* checkBox = dynamic_cast<QCheckBox*>(curWidget);
    if(checkBox)
    {
        if(value.toBool())
            checkBox->setCheckState(Qt::Checked);
        else
            checkBox->setCheckState(Qt::Unchecked);
    }

    QLineEdit* lineEdit = dynamic_cast<QLineEdit*>(curWidget);
    if(lineEdit)
        lineEdit->setText(value.toString());
}
Пример #3
0
void IndicatorDataView::initView(const QString& indicator)
{
  if(!mPainter->mIndicator) return;

  mIndicator = indicator;

  // Delete old entries

  // Insert new entries
  QStringList var;
  //mPainter->mData->getVariableNames(var);
  QSet<QString> varList;
  mPainter->mIndicator->getVariableNames(&varList);
  var = varList.values();
  //qDebug() << "IndicatorDataView::initView()" << var << varList.size();

  // Sort the variable list, but place the bardata as block in front
  var.removeAt(var.indexOf("OPEN"));
  var.removeAt(var.indexOf("HIGH"));
  var.removeAt(var.indexOf("LOW"));
  var.removeAt(var.indexOf("CLOSE"));
  var.removeAt(var.indexOf("VOLUME"));
  var.removeAt(var.indexOf("OPINT"));
  var.sort();
  var.prepend("OPINT");
  var.prepend("VOLUME");
  var.prepend("CLOSE");
  var.prepend("LOW");
  var.prepend("HIGH");
  var.prepend("OPEN");
  var.prepend("Date"); // Should not be a variable but is also interesting

  // And now insert entries
  int row = 0;
  QString name;
  QCheckBox* cb;

  mFilterView.setColumnCount(1);
  mFilterView.setRowCount(var.size());

  // Restore saved settings, if some
  QString filterPath;
  filterPath = mRcFile->getPath("FiluHome");
  filterPath.append("IndicatorFilterSettings/");
  SettingsFile sfile(filterPath + mIndicator);

  foreach(name, var)
  {
    cb = new QCheckBox(name);
    if(sfile.getBL(name))
    {
      cb->setCheckState(Qt::Checked);
    }
    else
    {
      cb->setCheckState(Qt::Unchecked);
    }
    connect(cb, SIGNAL(stateChanged(int)), this, SLOT(filterChanged(int)));
    mFilterView.setCellWidget(row++, 0, cb);
  }
Пример #4
0
void
WidgetVpzPropertyExpCond::refresh()
{
    // First, clear the current list content
    bool oldBlock = QListWidget::blockSignals(true);
    QListWidget::clear();
    QString dyn = mVpz->modelDynFromDoc(mModQuery);
    // TODO only way to see if it is an atomic model ??
    QDomNodeList conds = mVpz->condsListFromConds(mVpz->condsFromDoc());
    for (int i = 0; i < conds.length(); i++) {
        QDomNode cond = conds.at(i);
        QString condName = DomFunctions::attributeValue(cond, "name");
        QListWidgetItem* wi = new QListWidgetItem(this);
        QListWidget::addItem(wi);
        QCheckBox* cb = new QCheckBox(this);
        cb->setText(condName);
        if (mVpz->isAttachedCond(mModQuery, condName)) {
            cb->setCheckState(Qt::Checked);
        } else {
            cb->setCheckState(Qt::Unchecked);
        }
        QObject::connect(
          cb, SIGNAL(toggled(bool)), this, SLOT(onCheckboxToggle(bool)));
        QListWidget::setItemWidget(wi, cb);
    }
    QListWidget::blockSignals(oldBlock);
}
Пример #5
0
void ParamWidget::SetBool(const QString& name, bool val) {
  QCheckBox* checkbox = dynamic_cast<QCheckBox*>(GetWidget(name));
  if (!checkbox) {
    throw std::invalid_argument("Invalid bool parameter " + name.toStdString());
  }
  if (val) {
    checkbox->setCheckState(Qt::Checked);
  } else {
    checkbox->setCheckState(Qt::Unchecked);
  }
}
Пример #6
0
QWidget* ConfigDialog::buildFlagWidget(const ConfigurationValue *value) {
    
    QCheckBox *checkBox = new QCheckBox();

    if(value->GetScalar() == 0.0) checkBox->setCheckState(Qt::Checked);
    else checkBox->setCheckState(Qt::Unchecked);
    

    QObject::connect(checkBox, SIGNAL(stateChanged(int)), value, SLOT(SetBoolean(int)));
    QObject::connect(checkBox, SIGNAL(stateChanged(int)), this, SLOT(valueChanged()));
    
    return checkBox;
}
Пример #7
0
// MODELVIEW PAGE //
ModelViewPage::ModelViewPage(QWidget* parent, QSettings* appSettings) :
    QWidget(parent),
    m_pAppSettings(appSettings)
{
    QLabel* backgroundColor = new QLabel("Window Background Color", this);
    ColorWidget* bgColorSelect = new ColorWidget(this);
    QCheckBox* dragEnabled = new QCheckBox("Tool Dragging Enabled", this);
    QCheckBox* previewEnabled = new QCheckBox("Tool Preview Enabled", this);

    QGroupBox* modelViewGroup = new QGroupBox();

    QGridLayout* gridLayout = new QGridLayout;
    gridLayout->addWidget(backgroundColor, 0, 0);
    gridLayout->addWidget(bgColorSelect, 0, 1);
    gridLayout->addWidget(dragEnabled, 2, 0);
    gridLayout->addWidget(previewEnabled, 3, 0);
    modelViewGroup->setLayout(gridLayout);

    QVBoxLayout* mainLayout = new QVBoxLayout;
    mainLayout->addWidget(modelViewGroup);
    mainLayout->addStretch(1);
    setLayout(mainLayout);

    // Populate the settings
    bgColorSelect->setColor(m_pAppSettings->value("GLModelWidget/backgroundColor",
                                                  QColor(161,161,161)).value<QColor>());
    if (m_pAppSettings->value("GLModelWidget/dragEnabled", true).toBool())
        dragEnabled->setCheckState(Qt::Checked);
    else
        dragEnabled->setCheckState(Qt::Unchecked);
    if (m_pAppSettings->value("GLModelWidget/previewEnabled", true).toBool())
        previewEnabled->setCheckState(Qt::Checked);
    else
        previewEnabled->setCheckState(Qt::Unchecked);


    // Backup original values
    m_backgroundColorOrig = bgColorSelect->color();
    m_dragEnabledOrig = dragEnabled->isChecked();
    m_previewEnabledOrig = previewEnabled->isChecked();

    // Hook up the signals
    QObject::connect(bgColorSelect, SIGNAL(colorChanged(QColor)),
                     this, SLOT(setBackgroundColor(QColor)));
    QObject::connect(dragEnabled, SIGNAL(stateChanged(int)),
                     this, SLOT(setDragEnabled(int)));
    QObject::connect(previewEnabled, SIGNAL(stateChanged(int)),
                     this, SLOT(setPreviewEnabled(int)));
}
void DelegateInfoCheckBox::setEditorData(QWidget *editor, const QModelIndex &index) const
{
    if(index.column() == 0){
        return;
    }

    bool value = index.model()->data(index, Qt::DisplayRole).toBool();
    QCheckBox *checkBox = static_cast<QCheckBox*>(editor);

    if(value){
        checkBox->setCheckState(Qt::Checked);
    }else{
        checkBox->setCheckState(Qt::Unchecked);
    }
}
/**
 * Applies the stored lists of which fittings and logs have been selected/deselected by the user.
 */
void MuonAnalysisResultTableTab::applyUserSettings()
{
  // If we're just starting the tab for the first time (and there are no user choices),
  // then don't bother.
  if( m_savedLogsState.isEmpty() && m_unselectedFittings.isEmpty() )
    return;
  
  // If any of the logs have previously been selected by the user, select them again.
  for (int row = 0; row < m_uiForm.valueTable->rowCount(); ++row)
  {
    if(QTableWidgetItem * log = m_uiForm.valueTable->item(row,0))
    {
      if( m_savedLogsState.contains(log->text()) )
      {
        QCheckBox* logCheckBox = static_cast<QCheckBox*>(m_uiForm.valueTable->cellWidget(row,1));
        logCheckBox->setCheckState(m_savedLogsState[log->text()]);
      }
    }
  }

  // If any of the fittings have previously been deselected by the user, deselect them again.
  for (int row = 0; row < m_uiForm.fittingResultsTable->rowCount(); ++row)
  {
    QTableWidgetItem * temp = m_uiForm.fittingResultsTable->item(row,0);
    if( temp )
    {
      if( m_unselectedFittings.contains(temp->text()) )
      {
        QCheckBox* fittingChoice = static_cast<QCheckBox*>(m_uiForm.fittingResultsTable->cellWidget(row,1));
        fittingChoice->setChecked(false);
      }
    }
  }
}
Пример #10
0
//! [7]
QGroupBox *Window::createNonExclusiveGroup()
{
    QGroupBox *groupBox = new QGroupBox(tr("Non-Exclusive Checkboxes"));
    groupBox->setFlat(true);
//! [7]

//! [8]
    QCheckBox *checkBox1 = new QCheckBox(tr("&Checkbox 1"));
    QCheckBox *checkBox2 = new QCheckBox(tr("C&heckbox 2"));
    checkBox2->setChecked(true);
    QCheckBox *tristateBox = new QCheckBox(tr("Tri-&state button"));
    tristateBox->setTristate(true);
//! [8]
    tristateBox->setCheckState(Qt::PartiallyChecked);

//! [9]
    QVBoxLayout *vbox = new QVBoxLayout;
    vbox->addWidget(checkBox1);
    vbox->addWidget(checkBox2);
    vbox->addWidget(tristateBox);
    vbox->addStretch(1);
    groupBox->setLayout(vbox);

    return groupBox;
}
Пример #11
0
void GroupSelWidget::sceneChanged()
{
    QSet<QString> groupSet = _scene->getAllGroups();
    if(groupSet == _prevGroupSet)
        return;
    _prevGroupSet = groupSet;

    QList<QString> groups = groupSet.toList();
    qSort(groups);

    for(int i = 0; i < (int)_checkBoxes.size(); ++i)
        delete _checkBoxes[i];
    _checkBoxes.clear();

    int childWidth = 0;
    for(int i = 0; i < (int)groups.size(); ++i) {
        QCheckBox *box =  new QCheckBox(groups[i], this);
        QFont font = box->font();
        font.setPointSize(14);
        box->setFont(font);
        box->setCheckState(_scene->isGroupVisible(groups[i]) ? Qt::Checked : Qt::Unchecked);
        new VisibilitySetter(box, _scene, groups[i]);
        layout()->addWidget(box);
        childWidth = max(childWidth, box->sizeHint().width());
        _checkBoxes.push_back(box);
    }

    setMinimumWidth(150);

    QWidget *scrollArea = parentWidget()->parentWidget()->parentWidget();
    scrollArea->setMinimumWidth(childWidth + 20);
}
Пример #12
0
int drv_checkbox(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
    handle_head* head = (handle_head*)a0;
    QCheckBox *self = (QCheckBox*)head->native;
    switch (drvid) {
    case CHECKBOX_INIT: {
        drvNewObj(a0,new QCheckBox);
        break;
    }
    case CHECKBOX_SETCHECK: {
        self->setCheckState((Qt::CheckState)drvGetInt(a1));
        break;
    }
    case CHECKBOX_CHECK: {
        drvSetInt(a1,self->checkState());
        break;
    }
    case CHECKBOX_SETTRISTATE: {
        self->setTristate(drvGetBool(a1));
        break;
    }
    case CHECKBOX_ISTRISTATE: {
        drvSetBool(a1,self->isTristate());
        break;
    }
    case CHECKBOX_ONSTATECHANGED: {
        QObject::connect(self,SIGNAL(stateChanged(int)),drvNewSignal(self,a1,a2),SLOT(call(int)));
        break;
    }
    default:
        return 0;
    }
    return 1;
}
void core::DatabaseMapperDialog::fillTable(const QString &sqlTableName)
{
	if(!_db.isOpen()) _db.open();

	QString strQuery = "show columns from " + sqlTableName;

	QSqlQuery query(strQuery, _db);

	tblMapView->clear();

	tblMapView->setHorizontalHeaderLabels(QStringList()
										  << tr("Source columns")
										  << tr("Map to")
										  << tr("Field type")
										  << tr("Enabled"));
	while(query.next())
	{
		tblMapView->setItem(tblMapView->rowCount() - 1, 0, new QTableWidgetItem(query.value("Field").toString()));
		tblMapView->setItem(tblMapView->rowCount() - 1, 1, new QTableWidgetItem(tr("in")));

		QComboBox *cb = new QComboBox();
		cb->addItems(QStringList()
					 << tr("Input")
					 << tr("Target"));
		tblMapView->setCellWidget(tblMapView->rowCount() - 1, 2, cb);

		QCheckBox *tbw = new QCheckBox();
		tbw->setCheckState(Qt::Checked);
		tblMapView->setItem(tblMapView->rowCount() - 1, 3, new QTableWidgetItem());
		tblMapView->setCellWidget(tblMapView->rowCount() - 1, 3, tbw);
		tblMapView->item(tblMapView->rowCount() - 1, 3)->setTextAlignment(Qt::AlignLeft);

		tblMapView->insertRow(tblMapView->rowCount());
	}
}
void TemplateOptionsPage::load(const SourceFileTemplate& fileTemplate, TemplateRenderer* renderer)
{
    d->entries.clear();

    QLayout* layout = new QVBoxLayout();
    QHash<QString, QList<SourceFileTemplate::ConfigOption> > options = fileTemplate.customOptions(renderer);
    QHash<QString, QList<SourceFileTemplate::ConfigOption> >::const_iterator it;

    for (it = options.constBegin(); it != options.constEnd(); ++it)
    {
        QGroupBox* box = new QGroupBox(this);
        box->setTitle(it.key());

        QFormLayout* formLayout = new QFormLayout;

        d->entries << it.value();
        foreach (const SourceFileTemplate::ConfigOption& entry, it.value())
        {
            QLabel* label = new QLabel(entry.label, box);
            QWidget* control = 0;
            const QString type = entry.type;
            if (type == "String")
            {
                control = new KLineEdit(entry.value.toString(), box);
            }
            else if (type == "Int")
            {
                KIntNumInput* input = new KIntNumInput(entry.value.toInt(), box);
                if (!entry.minValue.isEmpty())
                {
                    input->setMinimum(entry.minValue.toInt());
                }
                if (!entry.maxValue.isEmpty())
                {
                    input->setMaximum(entry.maxValue.toInt());
                }
                control = input;
            }
            else if (type == "Bool")
            {
                bool checked = (QString::compare(entry.value.toString(), "true", Qt::CaseInsensitive) == 0);
                QCheckBox* checkBox = new QCheckBox(entry.label, box);
                checkBox->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
            }
            else
            {
                kDebug() << "Unrecognized option type" << entry.type;
            }
            if (control)
            {
                formLayout->addRow(label, control);
                d->controls.insert(entry.name, control);
            }
        }

        box->setLayout(formLayout);
        layout->addWidget(box);
    }
    setLayout(layout);
}
Пример #15
0
void
pcl::modeler::BoolParameter::setEditorData(QWidget *editor)
{
  QCheckBox *checkBox = static_cast<QCheckBox*>(editor);

  bool value = bool (*this);
  checkBox->setCheckState(value?(Qt::Checked):(Qt::Unchecked));
}
Пример #16
0
void ObjectsChoicesPage::checkAll()
{
	for(kint i=0; i<_table->rowCount(); i++)
	{
		QCheckBox* checkbox = (QCheckBox*)_table->cellWidget(i, 0);
		checkbox->setCheckState(Qt::Checked);
	}
}
Пример #17
0
SaveOnExitDialogWidget::SaveOnExitDialogWidget(MainWindow *mainWindow, QList<RideItem *>dirtyList) :
    QDialog(mainWindow, Qt::Dialog), mainWindow(mainWindow), dirtyList(dirtyList)
{
    setWindowTitle("Save Changes");
    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    // Warning text
    warnText = new QLabel(tr("WARNING\n\nYou have made changes to some rides which\nhave not been saved. They are listed below."));
    mainLayout->addWidget(warnText);

    // File List
    dirtyFiles = new QTableWidget(dirtyList.count(), 0, this);
    dirtyFiles->setColumnCount(2);
    dirtyFiles->horizontalHeader()->hide();
    dirtyFiles->verticalHeader()->hide();

    // Populate with dirty List
    for (int i=0; i<dirtyList.count(); i++) {
        // checkbox
        QCheckBox *c = new QCheckBox;
        c->setCheckState(Qt::Checked);
        dirtyFiles->setCellWidget(i,0,c);

        // filename
        QTableWidgetItem *t = new QTableWidgetItem;
        t->setText(dirtyList.at(i)->fileName);
        t->setFlags(t->flags() & (~Qt::ItemIsEditable));
        dirtyFiles->setItem(i,1,t);
    }

    // prettify the list
    dirtyFiles->setShowGrid(false);
    dirtyFiles->resizeColumnToContents(0);
    dirtyFiles->resizeColumnToContents(1);
    mainLayout->addWidget(dirtyFiles);

    // Buttons
    QHBoxLayout *buttonLayout = new QHBoxLayout;
    saveButton = new QPushButton(tr("&Save and Exit"), this);
    buttonLayout->addWidget(saveButton);
    abandonButton = new QPushButton(tr("&Discard and Exit"), this);
    buttonLayout->addWidget(abandonButton);
    cancelButton = new QPushButton(tr("&Cancel Exit"), this);
    buttonLayout->addWidget(cancelButton);
    mainLayout->addLayout(buttonLayout);

    // Don't warn me!
    exitWarnCheckBox = new QCheckBox(tr("Always check for unsaved changes on exit"), this);
    exitWarnCheckBox->setChecked(true);
    mainLayout->addWidget(exitWarnCheckBox);

    // connect up slots
    connect(saveButton, SIGNAL(clicked()), this, SLOT(saveClicked()));
    connect(abandonButton, SIGNAL(clicked()), this, SLOT(abandonClicked()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()));
    connect(exitWarnCheckBox, SIGNAL(clicked()), this, SLOT(warnSettingClicked()));
}
Пример #18
0
QWidget *OBSPropertiesView::AddCheckbox(obs_property_t prop)
{
	const char *name = obs_property_name(prop);
	const char *desc = obs_property_description(prop);
	bool       val   = obs_data_getbool(settings, name);

	QCheckBox *checkbox = new QCheckBox(QT_UTF8(desc));
	checkbox->setCheckState(val ? Qt::Checked : Qt::Unchecked);
	return NewWidget(prop, checkbox, SIGNAL(stateChanged(int)));
}
Пример #19
0
void CWizFolderSelector::setCopyStyle(bool showKeepTagsOption)
{
    QVBoxLayout* lay = qobject_cast<QVBoxLayout*>(layout());

    QCheckBox* checkKeepTime = new QCheckBox(tr("Keep create/update time"), this);
    checkKeepTime->setCheckState(m_bKeepTime ? Qt::Checked : Qt::Unchecked);
    connect(checkKeepTime, SIGNAL(stateChanged(int)), SLOT(on_checkKeepTime_stateChanged(int)));

    lay->insertWidget(1, checkKeepTime);

    if (showKeepTagsOption)
    {
        QCheckBox* checkKeepTags = new QCheckBox(tr("Keep tags"), this);
        checkKeepTags->setCheckState(m_bKeepTags ? Qt::Checked : Qt::Unchecked);
        connect(checkKeepTags, SIGNAL(stateChanged(int)), SLOT(on_checkKeepTags_stateChanged(int)));

        lay->insertWidget(2, checkKeepTags);
    }
}
Пример #20
0
	QCheckBox* ConfigPage::newCheckbox(QString label, QString ID, bool checked)
	{
		QCheckBox* widget = new QCheckBox(label);
		widget->setCheckState(BOOL_TO_CHECKED(checked));
		WidgetCache<bool> cache(widget, checked);
		checkboxCache.insert(std::pair<QString, WidgetCache<bool> >(ID, cache));
		connect(widget, SIGNAL(released()), ConfigDialog::getInstance(), SLOT(flushCache()));
		connect(widget, SIGNAL(released()), ConfigDialog::getInstance(), SIGNAL(settingsChanged()));
		return widget;
	}
Пример #21
0
	void ConfigPage::reloadFromCache()
	{
		// update widgets based on the cache
		for (std::map<QString, WidgetCache<bool> >::iterator it = checkboxCache.begin(); it != checkboxCache.end(); it++)
		{
			QCheckBox* checkbox = dynamic_cast<QCheckBox*>((it->second).widget);
			Q_ASSERT(checkbox);
			checkbox->setCheckState(BOOL_TO_CHECKED((it->second).value));
		}
	}
Пример #22
0
void GameParamBoolean::createWidget(QString value, QWidget** left, QWidget** right)
{
	QCheckBox* box = new QCheckBox(m_strText);
	if(value.startsWith("true", Qt::CaseInsensitive))
		box->setCheckState(Qt::Checked);
	
	applyPalette(box, PaletteCheck);
	
	*right = box;
	*left = 0;
}
Пример #23
0
void MainWindow::on_masterCheck_stateChanged(int arg1)
{
    int rCount = ui->tableWidget->rowCount();
    for(int i = 1 ; i<rCount-1;i++)
    {
        QCheckBox* cBox = qobject_cast<QCheckBox*> (ui->tableWidget->cellWidget(i,1));
        if(!cBox)
            continue;
        cBox->setCheckState((Qt::CheckState)arg1);
    }
}
Пример #24
0
void PropertyWidgetBuilder::visitValue(ValueProperty<bool> & property)
{
    QCheckBox * checkBox = new QCheckBox(m_active_widget);
    checkBox->setText(property.description());
    if (property.value())
        checkBox->setCheckState(Qt::Checked);
    else
        checkBox->setCheckState(Qt::Unchecked);

    m_active_layout->addWidget(checkBox);

    QObject::connect(checkBox, &QCheckBox::stateChanged,
        [&property] (int state) {
            property.setValue(state);
            qDebug("Set Property %s = %i",
                   qPrintable(property.name()),
                   property.value());
        }
    );
}
Пример #25
0
void CTicTacToe::setCheckBoxCheckedForPlayer(QObject* sender, int player)
{
    /**
     * @param: QObject sender: Object to the pressed Checkbox
     * @param: int player: Player who play
     */

    Qt::CheckState pCheckState = getPlayerCheckBoxState(player);
    QCheckBox* box = static_cast<QCheckBox*>(sender);
    box->setCheckState(pCheckState);
    box->setEnabled(false);
}
Пример #26
0
// VOXEL PAGE //
VoxelPage::VoxelPage(QWidget* parent, QSettings* appSettings) :
    QWidget(parent),
    m_pAppSettings(appSettings)
{
    QCheckBox* drawOutlines = new QCheckBox("Draw Outlines", this);
    QCheckBox* drawSmooth   = new QCheckBox("Draw Smooth Voxels", this);

    QGroupBox* gridGroup = new QGroupBox();

    QGridLayout* gridLayout = new QGridLayout;
    gridLayout->addWidget(drawOutlines, 0, 0);
    gridLayout->addWidget(drawSmooth, 1, 0);
    gridGroup->setLayout(gridLayout);

    QVBoxLayout* mainLayout = new QVBoxLayout;
    mainLayout->addWidget(gridGroup);
    mainLayout->addStretch(1);
    setLayout(mainLayout);

    // Populate the settings
    if (m_pAppSettings->value("GLModelWidget/drawVoxelOutlines", false).toBool())
        drawOutlines->setCheckState(Qt::Checked);
    else
        drawOutlines->setCheckState(Qt::Unchecked);

    if (m_pAppSettings->value("GLModelWidget/drawSmoothVoxels", false).toBool())
        drawSmooth->setCheckState(Qt::Checked);
    else
        drawSmooth->setCheckState(Qt::Unchecked);

    // Backup original values
    m_drawOutlinesOrig = drawOutlines->isChecked();
    m_drawSmoothOrig = drawSmooth->isChecked();

    // Hook up the signals
    QObject::connect(drawOutlines, SIGNAL(stateChanged(int)),
                     this, SLOT(setDrawOutlines(int)));
    QObject::connect(drawSmooth, SIGNAL(stateChanged(int)),
                     this, SLOT(setDrawSmooth(int)));
}
Пример #27
0
	void ItemHandlerCheckbox::SetValue (QWidget *widget,
			const QVariant& value) const
	{
		QCheckBox *checkbox = qobject_cast<QCheckBox*> (widget);
		if (!checkbox)
		{
			qWarning () << Q_FUNC_INFO
				<< "not a QCheckBox"
				<< widget;
			return;
		}
		checkbox->setCheckState (value.toBool () ? Qt::Checked : Qt::Unchecked);
	}
void
ChooseProvidersPage::setFields( const QList<qint64> &fields, qint64 checkedFields )
{
    QLayout *fieldsLayout = fieldsBox->layout();
    foreach( qint64 field, fields )
    {
        QString name = Meta::i18nForField( field );
        QCheckBox *checkBox = new QCheckBox( name );
        fieldsLayout->addWidget( checkBox );
        checkBox->setCheckState( ( field & checkedFields ) ? Qt::Checked : Qt::Unchecked );
        checkBox->setProperty( "field", field );
        connect( checkBox, SIGNAL(stateChanged(int)), SIGNAL(checkedFieldsChanged()) );
    }
Пример #29
0
////////////////////////////////////////////////////////////////////////////////
// Preference Sub-Pages ////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
GeneralPage::GeneralPage(QWidget* parent, QSettings* appSettings) :
    QWidget(parent),
    m_pAppSettings(appSettings)
{
    QCheckBox* saveWindowPositions = new QCheckBox("Save Window Positions On Exit", this);
    QCheckBox* frameOnOpen = new QCheckBox("Frame Model On Open", this);

    QVBoxLayout* stuffzLayout = new QVBoxLayout;
    stuffzLayout->addWidget(saveWindowPositions);
    stuffzLayout->addWidget(frameOnOpen);

    QGroupBox* configGroup = new QGroupBox();
    configGroup->setLayout(stuffzLayout);

    QVBoxLayout* mainLayout = new QVBoxLayout;
    mainLayout->addWidget(configGroup);
    mainLayout->addStretch(1);
    setLayout(mainLayout);

    // Populate the settings
    if (m_pAppSettings->value("saveUILayout", true).toBool())
        saveWindowPositions->setCheckState(Qt::Checked);
    else
        saveWindowPositions->setCheckState(Qt::Unchecked);
    if (m_pAppSettings->value("frameOnOpen", false).toBool())
        frameOnOpen->setCheckState(Qt::Checked);
    else
        frameOnOpen->setCheckState(Qt::Unchecked);

    // Backup original values
    m_saveWindowPositionsOrig = saveWindowPositions->isChecked();
    m_frameOnOpenOrig = frameOnOpen->isChecked();

    // Hook up the signals
    QObject::connect(saveWindowPositions, SIGNAL(stateChanged(int)),
                     this, SLOT(setSaveWindowPositions(int)));
    QObject::connect(frameOnOpen, SIGNAL(stateChanged(int)),
                     this, SLOT(setFrameOnOpen(int)));
}
Пример #30
-5
void ParamWidget::AddBooleans(const std::vector<BoolItem>& to_add,
    DisplayHint display_hint) {
  if (display_hint != kCheckBox) {
    throw std::invalid_argument("Invalid display hint");
  }

  QWidget* row_widget = new QWidget(this);
  QHBoxLayout* hbox = new QHBoxLayout(row_widget);
  for (const BoolItem& item : to_add) {
    ExpectNameNotFound(item.name);

    QCheckBox* checkbox =
      new QCheckBox(item.name, this);

    if (item.initially_checked) {
      checkbox->setCheckState(Qt::Checked);
    } else {
     checkbox->setCheckState(Qt::Unchecked);
    }
    checkbox->setProperty("param_widget_type", kParamBool);

    widgets_[item.name] = checkbox;
    hbox->addWidget(checkbox);

    connect(checkbox, &QCheckBox::stateChanged,
        [this, item](int val) { emit ParamChanged(item.name); });
  }

  layout_->addWidget(row_widget);
}