本文整理汇总了C++中ModelData::getChannelsMax方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelData::getChannelsMax方法的具体用法?C++ ModelData::getChannelsMax怎么用?C++ ModelData::getChannelsMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelData
的用法示例。
在下文中一共展示了ModelData::getChannelsMax方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModelPanel
LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
ModelPanel(parent, model, generalSettings, firmware),
selectedSwitch(0)
{
int channelsMax = model.getChannelsMax(true);
QGridLayout * gridLayout = new QGridLayout(this);
int col = 1;
addLabel(gridLayout, tr("Function"), col++);
addLabel(gridLayout, tr("V1"), col++);
addLabel(gridLayout, tr("V2"), col++);
addLabel(gridLayout, tr("AND Switch"), col++);
if (firmware->getCapability(LogicalSwitchesExt)) {
addLabel(gridLayout, tr("Duration"), col++);
addLabel(gridLayout, tr("Delay"), col++);
}
lock = true;
for (int i=0; i<firmware->getCapability(LogicalSwitches); i++) {
// The label
QLabel * label = new QLabel(this);
label->setProperty("index", i);
label->setText(tr("L%1").arg(i+1));
label->setContextMenuPolicy(Qt::CustomContextMenu);
label->setMouseTracking(true);
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(csw_customContextMenuRequested(QPoint)));
gridLayout->addWidget(label, i+1, 0);
// The function
csw[i] = new QComboBox(this);
csw[i]->setProperty("index", i);
connect(csw[i], SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
gridLayout->addWidget(csw[i], i+1, 1);
// V1
cswitchSource1[i] = new QComboBox(this);
cswitchSource1[i]->setProperty("index",i);
connect(cswitchSource1[i], SIGNAL(currentIndexChanged(int)), this, SLOT(v1Edited(int)));
gridLayout->addWidget(cswitchSource1[i], i+1, 2);
cswitchSource1[i]->setVisible(false);
cswitchValue[i] = new QDoubleSpinBox(this);
cswitchValue[i]->setMaximum(channelsMax);
cswitchValue[i]->setMinimum(-channelsMax);
cswitchValue[i]->setAccelerated(true);
cswitchValue[i]->setDecimals(0);
cswitchValue[i]->setProperty("index", i);
connect(cswitchValue[i], SIGNAL(valueChanged(double)), this, SLOT(edited()));
gridLayout->addWidget(cswitchValue[i], i+1, 2);
cswitchValue[i]->setVisible(false);
// V2
QHBoxLayout *v2Layout = new QHBoxLayout();
cswitchSource2[i] = new QComboBox(this);
cswitchSource2[i]->setProperty("index", i);
connect(cswitchSource2[i], SIGNAL(currentIndexChanged(int)), this, SLOT(v2Edited(int)));
v2Layout->addWidget(cswitchSource2[i]);
cswitchSource2[i]->setVisible(false);
cswitchOffset[i] = new QDoubleSpinBox(this);
cswitchOffset[i]->setProperty("index",i);
cswitchOffset[i]->setMaximum(channelsMax);
cswitchOffset[i]->setMinimum(-channelsMax);
cswitchOffset[i]->setAccelerated(true);
cswitchOffset[i]->setDecimals(0);
connect(cswitchOffset[i], SIGNAL(valueChanged(double)), this, SLOT(edited()));
cswitchOffset[i]->setVisible(false);
v2Layout->addWidget(cswitchOffset[i]);
cswitchOffset2[i] = new QDoubleSpinBox(this);
cswitchOffset2[i]->setProperty("index",i);
cswitchOffset2[i]->setMaximum(channelsMax);
cswitchOffset2[i]->setMinimum(-channelsMax);
cswitchOffset2[i]->setAccelerated(true);
cswitchOffset2[i]->setDecimals(0);
connect(cswitchOffset2[i], SIGNAL(valueChanged(double)), this, SLOT(edited()));
cswitchOffset2[i]->setVisible(false);
v2Layout->addWidget(cswitchOffset2[i]);
cswitchTOffset[i] = new QTimeEdit(this);
cswitchTOffset[i]->setProperty("index",i);
cswitchTOffset[i]->setAccelerated(true);
connect(cswitchTOffset[i],SIGNAL(editingFinished()),this,SLOT(edited()));
v2Layout->addWidget(cswitchTOffset[i]);
cswitchTOffset[i]->setVisible(false);
gridLayout->addLayout(v2Layout, i+1, 3);
// AND
cswitchAnd[i] = new QComboBox(this);
cswitchAnd[i]->setProperty("index", i);
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
gridLayout->addWidget(cswitchAnd[i], i+1, 4);
if (firmware->getCapability(LogicalSwitchesExt)) {
// Duration
cswitchDuration[i] = new QDoubleSpinBox(this);
cswitchDuration[i]->setProperty("index", i);
cswitchDuration[i]->setSingleStep(0.1);
cswitchDuration[i]->setMaximum(25);
cswitchDuration[i]->setMinimum(0);
cswitchDuration[i]->setAccelerated(true);
cswitchDuration[i]->setDecimals(1);
//.........这里部分代码省略.........
示例2: rx
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);
}
}
示例3: ModelPanel
LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
ModelPanel(parent, model, generalSettings, firmware),
selectedSwitch(0)
{
Stopwatch s1("LogicalSwitchesPanel");
int channelsMax = model.getChannelsMax(true);
QStringList headerLabels;
headerLabels << "#" << tr("Function") << tr("V1") << tr("V2") << tr("AND Switch");
if (firmware->getCapability(LogicalSwitchesExt)) {
headerLabels << tr("Duration") << tr("Delay");
}
TableLayout * tableLayout = new TableLayout(this, firmware->getCapability(LogicalSwitches), headerLabels);
s1.report("header");
lock = true;
for (int i=0; i<firmware->getCapability(LogicalSwitches); i++) {
// The label
QLabel * label = new QLabel(this);
label->setProperty("index", i);
label->setText(tr("L%1").arg(i+1));
label->setContextMenuPolicy(Qt::CustomContextMenu);
label->setMouseTracking(true);
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(csw_customContextMenuRequested(QPoint)));
tableLayout->addWidget(i, 0, label);
// The function
csw[i] = new QComboBox(this);
csw[i]->setProperty("index", i);
connect(csw[i], SIGNAL(currentIndexChanged(int)), this, SLOT(edited()));
tableLayout->addWidget(i, 1, csw[i]);
// V1
QHBoxLayout *v1Layout = new QHBoxLayout();
cswitchSource1[i] = new QComboBox(this);
cswitchSource1[i]->setProperty("index",i);
connect(cswitchSource1[i], SIGNAL(currentIndexChanged(int)), this, SLOT(v1Edited(int)));
v1Layout->addWidget(cswitchSource1[i]);
cswitchSource1[i]->setVisible(false);
cswitchValue[i] = new QDoubleSpinBox(this);
cswitchValue[i]->setMaximum(channelsMax);
cswitchValue[i]->setMinimum(-channelsMax);
cswitchValue[i]->setAccelerated(true);
cswitchValue[i]->setDecimals(0);
cswitchValue[i]->setProperty("index", i);
connect(cswitchValue[i], SIGNAL(valueChanged(double)), this, SLOT(edited()));
v1Layout->addWidget(cswitchValue[i]);
cswitchValue[i]->setVisible(false);
tableLayout->addLayout(i, 2, v1Layout);
// V2
QHBoxLayout *v2Layout = new QHBoxLayout();
cswitchSource2[i] = new QComboBox(this);
cswitchSource2[i]->setProperty("index", i);
connect(cswitchSource2[i], SIGNAL(currentIndexChanged(int)), this, SLOT(v2Edited(int)));
v2Layout->addWidget(cswitchSource2[i]);
cswitchSource2[i]->setVisible(false);
cswitchOffset[i] = new QDoubleSpinBox(this);
cswitchOffset[i]->setProperty("index",i);
cswitchOffset[i]->setMaximum(channelsMax);
cswitchOffset[i]->setMinimum(-channelsMax);
cswitchOffset[i]->setAccelerated(true);
cswitchOffset[i]->setDecimals(0);
connect(cswitchOffset[i], SIGNAL(valueChanged(double)), this, SLOT(edited()));
cswitchOffset[i]->setVisible(false);
v2Layout->addWidget(cswitchOffset[i]);
cswitchOffset2[i] = new QDoubleSpinBox(this);
cswitchOffset2[i]->setProperty("index",i);
cswitchOffset2[i]->setMaximum(channelsMax);
cswitchOffset2[i]->setMinimum(-channelsMax);
cswitchOffset2[i]->setAccelerated(true);
cswitchOffset2[i]->setDecimals(0);
connect(cswitchOffset2[i], SIGNAL(valueChanged(double)), this, SLOT(edited()));
cswitchOffset2[i]->setVisible(false);
v2Layout->addWidget(cswitchOffset2[i]);
cswitchTOffset[i] = new QTimeEdit(this);
cswitchTOffset[i]->setProperty("index",i);
cswitchTOffset[i]->setAccelerated(true);
connect(cswitchTOffset[i],SIGNAL(editingFinished()),this,SLOT(edited()));
v2Layout->addWidget(cswitchTOffset[i]);
cswitchTOffset[i]->setVisible(false);
tableLayout->addLayout(i, 3, v2Layout);
// AND
cswitchAnd[i] = new QComboBox(this);
cswitchAnd[i]->setProperty("index", i);
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
tableLayout->addWidget(i, 4, cswitchAnd[i]);
if (firmware->getCapability(LogicalSwitchesExt)) {
// Duration
cswitchDuration[i] = new QDoubleSpinBox(this);
cswitchDuration[i]->setProperty("index", i);
cswitchDuration[i]->setSingleStep(0.1);
cswitchDuration[i]->setMaximum(25);
cswitchDuration[i]->setMinimum(0);
cswitchDuration[i]->setAccelerated(true);
//.........这里部分代码省略.........