void VCMatrixPresetSelection::displayProperties(RGBScript *script) { if (script == NULL) return; int gridRowIdx = 0; QList<RGBScriptProperty> properties = script->properties(); if (properties.count() > 0) m_propertiesGroup->show(); else m_propertiesGroup->hide(); foreach(RGBScriptProperty prop, properties) { switch(prop.m_type) { case RGBScriptProperty::List: { QLabel *propLabel = new QLabel(prop.m_displayName); m_propertiesLayout->addWidget(propLabel, gridRowIdx, 0); QComboBox *propCombo = new QComboBox(this); propCombo->addItems(prop.m_listValues); propCombo->setProperty("pName", prop.m_name); QString pValue = script->property(prop.m_name); if (!pValue.isEmpty()) #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) propCombo->setCurrentText(pValue); #else propCombo->setCurrentIndex(propCombo->findText(pValue)); #endif connect(propCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotPropertyComboChanged(QString))); m_propertiesLayout->addWidget(propCombo, gridRowIdx, 1); gridRowIdx++; } break; case RGBScriptProperty::Range: { QLabel *propLabel = new QLabel(prop.m_displayName); m_propertiesLayout->addWidget(propLabel, gridRowIdx, 0); QSpinBox *propSpin = new QSpinBox(this); propSpin->setRange(prop.m_rangeMinValue, prop.m_rangeMaxValue); propSpin->setProperty("pName", prop.m_name); QString pValue = script->property(prop.m_name); if (!pValue.isEmpty()) propSpin->setValue(pValue.toInt()); connect(propSpin, SIGNAL(valueChanged(int)), this, SLOT(slotPropertySpinChanged(int))); m_propertiesLayout->addWidget(propSpin, gridRowIdx, 1); gridRowIdx++; } break; default: qWarning() << "Type" << prop.m_type << "not handled yet"; break; } } }
CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware): GeneralPanel(parent, generalSettings, firmware) { tableWidget = new QTableWidget(); QVBoxLayout * layout = new QVBoxLayout(); layout->addWidget(tableWidget); layout->setContentsMargins(0, 0, 0, 0); this->setLayout(layout); tableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); tableWidget->setColumnCount(3); tableWidget->setShowGrid(false); tableWidget->setSelectionMode(QAbstractItemView::NoSelection); tableWidget->setFrameStyle(QFrame::NoFrame | QFrame::Plain); tableWidget->setStyleSheet("QTableWidget {background-color: transparent;}"); QStringList headerLabels; headerLabels << QObject::tr("Negative span") << QObject::tr("Mid value") << QObject::tr("Positive span"); tableWidget->setHorizontalHeaderLabels(headerLabels); int rows = NUM_STICKS + GetCurrentFirmware()->getCapability(Pots) + GetCurrentFirmware()->getCapability(Sliders); tableWidget->setRowCount(rows); for(int i = 0; i < rows; ++i) { QTableWidgetItem *newItem = new QTableWidgetItem(AnalogString(i)); newItem->setTextAlignment(Qt::AlignLeft); tableWidget->setVerticalHeaderItem(i, newItem); for(int j = 0; j < 3; ++j) { QSpinBox * newItem = new QSpinBox(); newItem->setMinimum(-9999); newItem->setMaximum(9999); newItem->setSingleStep(1); newItem->setValue(getCalibrationValue(i, j)); newItem->setProperty("row", i); newItem->setProperty("column", j); tableWidget->setCellWidget(i, j, newItem); connect(newItem, SIGNAL(valueChanged(int)), this, SLOT(onCellChanged(int))); } } disableMouseScrolling(); }
void EFXEditor::updateIntensityColumn(QTreeWidgetItem* item, EFXFixture* ef) { Q_ASSERT(item != NULL); Q_ASSERT(ef != NULL); if (m_tree->itemWidget(item, KColumnIntensity) == NULL) { QSpinBox* spin = new QSpinBox(m_tree); spin->setAutoFillBackground(true); spin->setRange(0, 255); spin->setValue(ef->fadeIntensity()); m_tree->setItemWidget(item, KColumnIntensity, spin); spin->setProperty(PROPERTY_FIXTURE, (qulonglong) ef); connect(spin, SIGNAL(valueChanged(int)), this, SLOT(slotFixtureIntensityChanged(int))); }
void ParamWidget::AddInt(const QString& name, int min, int max, int step, int initial_value, DisplayHint display_hint) { ExpectNameNotFound(name); if (display_hint == DisplayHint::kSpinBox) { QSpinBox* spinbox = new QSpinBox(this); spinbox->setRange(min, max); spinbox->setSingleStep(step); spinbox->setValue(initial_value); spinbox->setProperty("param_widget_type", kParamInt); widgets_[name] = spinbox; AddLabeledRow(name, spinbox); connect(spinbox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), [this, name](int val) { emit ParamChanged(name); }); } else if (display_hint == DisplayHint::kSlider) { QWidget* row_widget = new QWidget(this); QHBoxLayout* row_hbox = new QHBoxLayout(row_widget); QSlider* slider = new QSlider(Qt::Horizontal, this); slider->setRange(min, max); slider->setSingleStep(step); slider->setValue(initial_value); slider->setProperty("param_widget_type", kParamInt); QLabel* label = new QLabel(this); label->setText(QString::number(initial_value)); row_hbox->addWidget(new QLabel(name, this)); row_hbox->addWidget(slider); row_hbox->addWidget(label); widgets_[name] = slider; layout_->addWidget(row_widget); connect(slider, &QSlider::valueChanged, [this, name, label](int value) { label->setText(QString::number(value)); emit ParamChanged(name); }); } else { throw std::invalid_argument("Invalid display hint"); } }
Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware): ModelPanel(parent, model, generalSettings, firmware) { QGridLayout * gridLayout = new QGridLayout(this); bool minimize = false; int col = 1; if (firmware->getCapability(ChannelsName)) { minimize=true; addLabel(gridLayout, tr("Name"), col++); } addLabel(gridLayout, tr("Subtrim"), col++, minimize); addLabel(gridLayout, tr("Min"), col++, minimize); addLabel(gridLayout, tr("Max"), col++, minimize); addLabel(gridLayout, tr("Direction"), col++, minimize); if (IS_TARANIS(GetEepromInterface()->getBoard())) addLabel(gridLayout, tr("Curve"), col++, minimize); if (firmware->getCapability(PPMCenter)) addLabel(gridLayout, tr("PPM Center"), col++, minimize); if (firmware->getCapability(SYMLimits)) addLabel(gridLayout, tr("Linear Subtrim"), col++, true); for (int i=0; i<firmware->getCapability(Outputs); i++) { col = 0; // Channel label QLabel *label = new QLabel(this); label->setText(tr("Channel %1").arg(i+1)); label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); gridLayout->addWidget(label, i+1, col++, 1, 1); // Channel name int nameLen = firmware->getCapability(ChannelsName); if (nameLen > 0) { QLineEdit * name = new QLineEdit(this); name->setProperty("index", i); name->setMaxLength(nameLen); QRegExp rx(CHAR_FOR_NAMES_REGEX); name->setValidator(new QRegExpValidator(rx, this)); name->setText(model.limitData[i].name); connect(name, SIGNAL(editingFinished()), this, SLOT(nameEdited())); gridLayout->addWidget(name, i+1, col++, 1, 1); } // Channel offset limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].offset, -1000, 1000, 0); // Channel min limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].min, -model.getChannelsMax()*10, 0, -1000); // Channel max limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].max, 0, model.getChannelsMax()*10, 1000); // Channel inversion QComboBox * invCB = new QComboBox(this); invCB->insertItems(0, QStringList() << tr("---") << tr("INV")); invCB->setProperty("index", i); invCB->setCurrentIndex((model.limitData[i].revert) ? 1 : 0); connect(invCB, SIGNAL(currentIndexChanged(int)), this, SLOT(invEdited())); gridLayout->addWidget(invCB, i+1, col++, 1, 1); // Curve if (IS_TARANIS(GetEepromInterface()->getBoard())) { QComboBox * curveCB = new QComboBox(this); curveCB->setProperty("index", i); int numcurves = firmware->getCapability(NumCurves); for (int j=-numcurves; j<=numcurves; j++) { curveCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, j).toString(), j); } curveCB->setCurrentIndex(model.limitData[i].curve.value+numcurves); connect(curveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(curveEdited())); gridLayout->addWidget(curveCB, i+1, col++, 1, 1); } // PPM center if (firmware->getCapability(PPMCenter)) { QSpinBox * center = new QSpinBox(this); center->setProperty("index", i); center->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); center->setSuffix("us"); center->setMinimum(1375); center->setMaximum(1625); center->setValue(1500); center->setValue(model.limitData[i].ppmCenter + 1500); connect(center, SIGNAL(editingFinished()), this, SLOT(ppmcenterEdited())); gridLayout->addWidget(center, i+1, col++, 1, 1); } // Symetrical limits if (firmware->getCapability(SYMLimits)) { QCheckBox * symlimits = new QCheckBox(this); symlimits->setProperty("index", i); symlimits->setChecked(model.limitData[i].symetrical); connect(symlimits, SIGNAL(toggled(bool)), this, SLOT(symlimitsEdited())); gridLayout->addWidget(symlimits, i+1, col++, 1, 1); } }
layoutEditPreviewDialog::layoutEditPreviewDialog(NineMLLayout * inSrcNineMLLayout, glConnectionWidget * glConn, QWidget *parent) : QDialog(parent) { srcNineMLLayout = inSrcNineMLLayout; glView = glConn; QObject::connect(this, SIGNAL(drawLayout(vector<loc>)), glView, SLOT(drawLocations(vector<loc>))); this->setModal(true); this->setMinimumSize(200, 400); this->setWindowTitle("Preview layout"); //this->setWindowIcon(); // add the main layout this->setLayout(new QVBoxLayout); this->layout()->setContentsMargins(0,0,0,0); // make the dialog scrollable this->layout()->addWidget(new QScrollArea); QWidget * content = new QWidget; ((QScrollArea *) this->layout()->itemAt(0)->widget())->setWidget(content); ((QScrollArea *) this->layout()->itemAt(0)->widget())->setWidgetResizable(true); content->setLayout(new QFormLayout); QFormLayout * contentLayout = (QFormLayout *) content->layout(); QSpinBox * numNeurons = new QSpinBox; numNeurons->setRange(1, 20000000); numNeurons->setProperty("name", "numNeurons"); numNeurons->setValue(99.0); QObject::connect(numNeurons, SIGNAL(valueChanged(QString)), this, SLOT(reDraw(QString))); contentLayout->addRow("Number of neurons:", numNeurons); // start adding the items if (srcNineMLLayout->ParameterList.size() > 1) { contentLayout->addRow("<b>Parameters</b>", new QLabel("")); } // add the parameters for (uint i = 0; i < srcNineMLLayout->ParameterList.size(); ++i) { if (srcNineMLLayout->ParameterList[i]->name != "numNeurons") { // add to main layout QDoubleSpinBox * value = new QDoubleSpinBox; value->setRange(-200000, 200000); value->setSingleStep(0.1); value->setDecimals(3); value->setValue(1.0); value->setProperty("name", srcNineMLLayout->ParameterList[i]->name); QObject::connect(value, SIGNAL(valueChanged(QString)), this, SLOT(reDraw(QString))); contentLayout->addRow(srcNineMLLayout->ParameterList[i]->name + ":", value); } } if (srcNineMLLayout->StateVariableList.size() > 3) { contentLayout->addRow("<b>State variables</b>", new QLabel("")); } // add the state vars for (uint i = 0; i < srcNineMLLayout->StateVariableList.size(); ++i) { if (srcNineMLLayout->StateVariableList[i]->name != "x" && srcNineMLLayout->StateVariableList[i]->name != "y" && srcNineMLLayout->StateVariableList[i]->name != "z") { // add to main layout QDoubleSpinBox * value = new QDoubleSpinBox; value->setRange(-200000, 200000); value->setSingleStep(0.1); value->setDecimals(3); value->setValue(1.0); value->setProperty("name", srcNineMLLayout->StateVariableList[i]->name); QObject::connect(value, SIGNAL(valueChanged(QString)), this, SLOT(reDraw(QString))); contentLayout->addRow(srcNineMLLayout->StateVariableList[i]->name + ":", value); } } contentLayoutRef = contentLayout; // force a redraw! numNeurons->setValue(100.0); }
QWidget* XletQueuesConfigure::buildConfigureQueueList(QWidget *parent) { QWidget *root = new QWidget(parent); QGridLayout *layout = new QGridLayout(root); root->setLayout(layout); layout->addWidget(new QLabel(tr("Queue"), root), 0, 0, Qt::AlignLeft); QLabel *label_qos = new QLabel(tr("Qos - X (s)"), root); label_qos->setToolTip(tr( "This is the threshold in seconds to consider that the answer to a " "call was too late to be accounted as an answer of quality.")); layout->addWidget(label_qos, 0, 1, Qt::AlignLeft); QLabel *label_window = new QLabel(tr("Window (s)"), root); label_window->setToolTip(tr( "The window is the period of time used to compute the statistics")); layout->addWidget(label_window, 0, 2, Qt::AlignLeft); QCheckBox *displayQueue; QSpinBox *spinBox; int row; int column; QVariantMap statConfig = b_engine->getConfig("guioptions.queuespanel").toMap(); QString xqueueid; row = 1; QHashIterator<QString, XInfo *> i = \ QHashIterator<QString, XInfo *>(b_engine->iterover("queues")); while (i.hasNext()) { column = 0; i.next(); QueueInfo * queueinfo = (QueueInfo *) i.value(); xqueueid = queueinfo->xid(); displayQueue = new QCheckBox(queueinfo->queueName(), root); displayQueue->setProperty("xqueueid", xqueueid); displayQueue->setProperty("param", "visible"); displayQueue->setChecked(statConfig.value("visible" + xqueueid, true).toBool()); layout->addWidget(displayQueue, row, column++); connect(displayQueue, SIGNAL(stateChanged(int)), this, SLOT(changeQueueStatParam(int))); spinBox = new QSpinBox(root); spinBox->setAlignment(Qt::AlignCenter); spinBox->setMaximum(240); spinBox->setProperty("xqueueid", xqueueid); spinBox->setProperty("param", "xqos"); spinBox->setValue(statConfig.value("xqos" + xqueueid, 60).toInt()); layout->addWidget(spinBox, row, column++); connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(changeQueueStatParam(int))); spinBox = new QSpinBox(root); spinBox->setAlignment(Qt::AlignCenter); spinBox->setMaximum(3600*3); spinBox->setProperty("xqueueid", xqueueid); spinBox->setProperty("param", "window"); spinBox->setValue(statConfig.value("window" + xqueueid, 3600).toInt()); layout->addWidget(spinBox, row, column++); connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(changeQueueStatParam(int))); row++; } return root; }