mirror of
https://github.com/opentx/opentx.git
synced 2025-07-16 12:55:12 +03:00
Merge pull request #3091 from opentx/projectkk2glider/issue_2861_header_always_visible
Use new TableLayout for Logical switches, Outputs and Special functions
This commit is contained in:
commit
731faa82ad
6 changed files with 122 additions and 75 deletions
|
@ -995,3 +995,38 @@ QStringList extractLatLon(const QString & position)
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
TableLayout::TableLayout(QWidget * parent, int rowCount, const QStringList & headerLabels)
|
||||
{
|
||||
tableWidget = new QTableWidget(parent);
|
||||
QVBoxLayout * layout = new QVBoxLayout();
|
||||
layout->addWidget(tableWidget);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
parent->setLayout(layout);
|
||||
|
||||
tableWidget->setRowCount(rowCount);
|
||||
tableWidget->setColumnCount(headerLabels.size());
|
||||
tableWidget->setShowGrid(false);
|
||||
tableWidget->verticalHeader()->setVisible(false);
|
||||
tableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
tableWidget->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
tableWidget->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
|
||||
tableWidget->setStyleSheet("QTableWidget {background-color: transparent;}");
|
||||
tableWidget->setHorizontalHeaderLabels(headerLabels);
|
||||
}
|
||||
|
||||
void TableLayout::addWidget(int row, int column, QWidget * widget)
|
||||
{
|
||||
QHBoxLayout * layout = new QHBoxLayout(tableWidget);
|
||||
layout->addWidget(widget);
|
||||
addLayout(row, column, layout);
|
||||
}
|
||||
|
||||
void TableLayout::addLayout(int row, int column, QLayout * layout)
|
||||
{
|
||||
layout->setContentsMargins(1, 3, 1, 3);
|
||||
QWidget * containerWidget = new QWidget(tableWidget);
|
||||
containerWidget->setLayout(layout);
|
||||
tableWidget->setCellWidget(row, column, containerWidget);
|
||||
}
|
||||
|
|
|
@ -201,4 +201,18 @@ private:
|
|||
double toDecimalCoordinate(const QString & value);
|
||||
QStringList extractLatLon(const QString & position);
|
||||
|
||||
class TableLayout
|
||||
{
|
||||
public:
|
||||
TableLayout(QWidget * parent, int rowCount, const QStringList & headerLabels);
|
||||
// ~TableLayout() ;
|
||||
|
||||
void addWidget(int row, int column, QWidget * widget);
|
||||
void addLayout(int row, int column, QLayout * layout);
|
||||
|
||||
QTableWidget * getTableWidget() { return tableWidget; };
|
||||
private:
|
||||
QTableWidget * tableWidget;
|
||||
};
|
||||
|
||||
#endif // HELPERS_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <QCheckBox>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
LimitsGroup::LimitsGroup(Firmware * firmware, QGridLayout *gridLayout, int row, int col, int & value, int min, int max, int deflt):
|
||||
LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, int min, int max, int deflt):
|
||||
firmware(firmware),
|
||||
spinbox(new QDoubleSpinBox()),
|
||||
value(value),
|
||||
|
@ -45,8 +45,10 @@ LimitsGroup::LimitsGroup(Firmware * firmware, QGridLayout *gridLayout, int row,
|
|||
horizontalLayout->addWidget(gv);
|
||||
QComboBox * cb = new QComboBox();
|
||||
horizontalLayout->addWidget(cb);
|
||||
cb->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
horizontalLayout->addWidget(spinbox);
|
||||
gridLayout->addLayout(horizontalLayout, row, col, 1, 1);
|
||||
spinbox->setMinimumWidth(80);
|
||||
tableLayout->addLayout(row, col, horizontalLayout);
|
||||
gvarGroup = new GVarGroup(gv, spinbox, cb, value, deflt, min, max, displayStep, allowGVars);
|
||||
}
|
||||
|
||||
|
@ -74,55 +76,51 @@ void LimitsGroup::updateMinMax(int max)
|
|||
Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
ModelPanel(parent, model, generalSettings, firmware)
|
||||
{
|
||||
QGridLayout * gridLayout = new QGridLayout(this);
|
||||
bool minimize = false;
|
||||
int channelNameMaxLen = firmware->getCapability(ChannelsName);
|
||||
|
||||
int col = 1;
|
||||
if (firmware->getCapability(ChannelsName)) {
|
||||
minimize=true;
|
||||
addLabel(gridLayout, tr("Name"), col++);
|
||||
QStringList headerLabels;
|
||||
headerLabels << "#";
|
||||
if (channelNameMaxLen > 0) {
|
||||
headerLabels << tr("Name");
|
||||
}
|
||||
addLabel(gridLayout, tr("Subtrim"), col++, minimize);
|
||||
addLabel(gridLayout, tr("Min"), col++, minimize);
|
||||
addLabel(gridLayout, tr("Max"), col++, minimize);
|
||||
addLabel(gridLayout, tr("Direction"), col++, minimize);
|
||||
headerLabels << tr("Subtrim") << tr("Min") << tr("Max") << tr("Direction");
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
||||
addLabel(gridLayout, tr("Curve"), col++, minimize);
|
||||
headerLabels << tr("Curve");
|
||||
if (firmware->getCapability(PPMCenter))
|
||||
addLabel(gridLayout, tr("PPM Center"), col++, minimize);
|
||||
headerLabels << tr("PPM Center");
|
||||
if (firmware->getCapability(SYMLimits))
|
||||
addLabel(gridLayout, tr("Linear Subtrim"), col++, true);
|
||||
headerLabels << tr("Linear Subtrim");
|
||||
TableLayout * tableLayout = new TableLayout(this, firmware->getCapability(LogicalSwitches), headerLabels);
|
||||
|
||||
for (int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
col = 0;
|
||||
int col = 0;
|
||||
|
||||
// Channel label
|
||||
QLabel *label = new QLabel(this);
|
||||
label->setText(tr("Channel %1").arg(i+1));
|
||||
label->setText(tr("CH%1").arg(i+1));
|
||||
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
|
||||
gridLayout->addWidget(label, i+1, col++, 1, 1);
|
||||
tableLayout->addWidget(i, col++, label);
|
||||
|
||||
// Channel name
|
||||
int nameLen = firmware->getCapability(ChannelsName);
|
||||
if (nameLen > 0) {
|
||||
if (channelNameMaxLen > 0) {
|
||||
QLineEdit * name = new QLineEdit(this);
|
||||
name->setProperty("index", i);
|
||||
name->setMaxLength(nameLen);
|
||||
name->setMaxLength(channelNameMaxLen);
|
||||
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);
|
||||
tableLayout->addWidget(i, col++, name);
|
||||
}
|
||||
|
||||
// Channel offset
|
||||
limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].offset, -1000, 1000, 0);
|
||||
limitsGroups << new LimitsGroup(firmware, tableLayout, i, 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);
|
||||
limitsGroups << new LimitsGroup(firmware, tableLayout, i, 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);
|
||||
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].max, 0, model.getChannelsMax()*10, 1000);
|
||||
|
||||
// Channel inversion
|
||||
QComboBox * invCB = new QComboBox(this);
|
||||
|
@ -130,7 +128,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
|||
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);
|
||||
tableLayout->addWidget(i, col++, invCB);
|
||||
|
||||
// Curve
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
|
@ -142,7 +140,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
|||
}
|
||||
curveCB->setCurrentIndex(model.limitData[i].curve.value+numcurves);
|
||||
connect(curveCB, SIGNAL(currentIndexChanged(int)), this, SLOT(curveEdited()));
|
||||
gridLayout->addWidget(curveCB, i+1, col++, 1, 1);
|
||||
tableLayout->addWidget(i, col++, curveCB);
|
||||
}
|
||||
|
||||
// PPM center
|
||||
|
@ -157,7 +155,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
|||
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);
|
||||
tableLayout->addWidget(i, col++, center);
|
||||
}
|
||||
|
||||
// Symetrical limits
|
||||
|
@ -166,14 +164,12 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
|||
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);
|
||||
tableLayout->addWidget(i, col++, symlimits);
|
||||
}
|
||||
}
|
||||
|
||||
// Push the rows up
|
||||
addVSpring(gridLayout, 0,firmware->getCapability(Outputs)+1);
|
||||
|
||||
disableMouseScrolling();
|
||||
tableLayout->getTableWidget()->resizeColumnsToContents();
|
||||
}
|
||||
|
||||
Channels::~Channels()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef CHANNELS_H
|
||||
#define CHANNELS_H
|
||||
|
||||
#include "helpers.h"
|
||||
#include "modeledit.h"
|
||||
#include <QSpinBox>
|
||||
|
||||
|
@ -9,7 +10,7 @@ class GVarGroup;
|
|||
class LimitsGroup
|
||||
{
|
||||
public:
|
||||
LimitsGroup(Firmware * firmware, QGridLayout *gridLayout, int row, int col, int & value, int min, int max, int deflt);
|
||||
LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, int min, int max, int deflt);
|
||||
~LimitsGroup();
|
||||
|
||||
void updateMinMax(int max);
|
||||
|
|
|
@ -52,14 +52,6 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
|||
clickOutput(NULL)
|
||||
#endif
|
||||
{
|
||||
QGridLayout * gridLayout = new QGridLayout(this);
|
||||
|
||||
addLabel(gridLayout, tr("Switch"), 1);
|
||||
addLabel(gridLayout, tr("Action"), 2);
|
||||
addLabel(gridLayout, tr("Parameters"), 3);
|
||||
addLabel(gridLayout, tr("Enable"), 4, true );
|
||||
addEmptyLabel(gridLayout, 5 );
|
||||
|
||||
lock = true;
|
||||
int num_fsw = model ? firmware->getCapability(CustomFunctions) : firmware->getCapability(GlobalFunctions);
|
||||
|
||||
|
@ -89,6 +81,10 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
|||
|
||||
CompanionIcon playIcon("play.png");
|
||||
|
||||
QStringList headerLabels;
|
||||
headerLabels << "#" << tr("Switch") << tr("Action") << tr("Parameters") << tr("Enable");
|
||||
TableLayout * tableLayout = new TableLayout(this, num_fsw, headerLabels);
|
||||
|
||||
for (int i=0; i<num_fsw; i++) {
|
||||
// The label
|
||||
QLabel * label = new QLabel(this);
|
||||
|
@ -101,35 +97,36 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
|||
label->setText(tr("GF%1").arg(i+1));
|
||||
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
|
||||
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint)));
|
||||
gridLayout->addWidget(label, i+1, 0);
|
||||
tableLayout->addWidget(i, 0, label);
|
||||
|
||||
// The switch
|
||||
fswtchSwtch[i] = new QComboBox(this);
|
||||
fswtchSwtch[i]->setProperty("index", i);
|
||||
fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||
fswtchSwtch[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
fswtchSwtch[i]->setMaxVisibleItems(10);
|
||||
connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
gridLayout->addWidget(fswtchSwtch[i], i+1, 1);
|
||||
tableLayout->addWidget(i, 1, fswtchSwtch[i]);
|
||||
|
||||
// The function
|
||||
fswtchFunc[i] = new QComboBox(this);
|
||||
fswtchFunc[i]->setProperty("index", i);
|
||||
fswtchFunc[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(fswtchFunc[i], SIGNAL(currentIndexChanged(int)), this, SLOT(functionEdited()));
|
||||
gridLayout->addWidget(fswtchFunc[i], i+1, 2);
|
||||
tableLayout->addWidget(i, 2, fswtchFunc[i]);
|
||||
|
||||
// The parameters
|
||||
QHBoxLayout *paramLayout = new QHBoxLayout();
|
||||
gridLayout->addLayout(paramLayout, i+1, 3);
|
||||
QHBoxLayout * paramLayout = new QHBoxLayout();
|
||||
tableLayout->addLayout(i, 3, paramLayout);
|
||||
|
||||
fswtchGVmode[i] = new QComboBox(this);
|
||||
fswtchGVmode[i]->setProperty("index", i);
|
||||
fswtchGVmode[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(fswtchGVmode[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
paramLayout->addWidget(fswtchGVmode[i]);
|
||||
|
||||
fswtchParamGV[i] = new QCheckBox(this);
|
||||
fswtchParamGV[i]->setProperty("index", i);
|
||||
fswtchParamGV[i]->setText("GV");
|
||||
fswtchParamGV[i]->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
|
||||
connect(fswtchParamGV[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
paramLayout->addWidget(fswtchParamGV[i]);
|
||||
|
||||
|
@ -150,11 +147,13 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
|||
fswtchParamT[i] = new QComboBox(this);
|
||||
fswtchParamT[i]->setProperty("index", i);
|
||||
paramLayout->addWidget(fswtchParamT[i]);
|
||||
fswtchParamT[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(fswtchParamT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
|
||||
fswtchParamArmT[i] = new QComboBox(this);
|
||||
fswtchParamArmT[i]->setProperty("index", i);
|
||||
fswtchParamArmT[i]->setEditable(true);
|
||||
fswtchParamArmT[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
paramLayout->addWidget(fswtchParamArmT[i]);
|
||||
|
||||
connect(fswtchParamArmT[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
|
@ -177,28 +176,31 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
|
|||
connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic()));
|
||||
#endif
|
||||
|
||||
QHBoxLayout *repeatLayout = new QHBoxLayout();
|
||||
gridLayout->addLayout(repeatLayout, i+1, 4);
|
||||
QHBoxLayout * repeatLayout = new QHBoxLayout();
|
||||
tableLayout->addLayout(i, 4, repeatLayout);
|
||||
fswtchRepeat[i] = new RepeatComboBox(this, functions[i].repeatParam);
|
||||
fswtchRepeat[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
repeatLayout->addWidget(fswtchRepeat[i], i+1);
|
||||
connect(fswtchRepeat[i], SIGNAL(modified()), this, SLOT(onChildModified()));
|
||||
|
||||
fswtchEnable[i] = new QCheckBox(this);
|
||||
fswtchEnable[i]->setProperty("index", i);
|
||||
fswtchEnable[i]->setText(tr("ON"));
|
||||
fswtchEnable[i]->setFixedWidth( 80 );
|
||||
fswtchEnable[i]->setFixedWidth(200);
|
||||
repeatLayout->addWidget(fswtchEnable[i], i+1);
|
||||
connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
}
|
||||
|
||||
// Push rows upward
|
||||
addDoubleSpring(gridLayout, 5, num_fsw+1);
|
||||
|
||||
disableMouseScrolling();
|
||||
|
||||
lock = false;
|
||||
|
||||
update();
|
||||
tableLayout->getTableWidget()->resizeColumnsToContents();
|
||||
tableLayout->getTableWidget()->setColumnWidth(3, 300);
|
||||
}
|
||||
|
||||
|
||||
CustomFunctionsPanel::~CustomFunctionsPanel()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,17 +13,13 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
|||
{
|
||||
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++);
|
||||
QStringList headerLabels;
|
||||
headerLabels << "#" << tr("Function") << tr("V1") << tr("V2") << tr("AND Switch");
|
||||
if (firmware->getCapability(LogicalSwitchesExt)) {
|
||||
addLabel(gridLayout, tr("Duration"), col++);
|
||||
addLabel(gridLayout, tr("Delay"), col++);
|
||||
headerLabels << tr("Duration") << tr("Delay");
|
||||
}
|
||||
TableLayout * tableLayout = new TableLayout(this, firmware->getCapability(LogicalSwitches), headerLabels);
|
||||
|
||||
|
||||
lock = true;
|
||||
for (int i=0; i<firmware->getCapability(LogicalSwitches); i++) {
|
||||
|
@ -35,20 +31,21 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
|||
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);
|
||||
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()));
|
||||
gridLayout->addWidget(csw[i], i+1, 1);
|
||||
tableLayout->addWidget(i, 1, csw[i]);
|
||||
|
||||
// V1
|
||||
QHBoxLayout *v1Layout = new QHBoxLayout();
|
||||
cswitchSource1[i] = new QComboBox(this);
|
||||
cswitchSource1[i]->setProperty("index",i);
|
||||
cswitchSource1[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(cswitchSource1[i], SIGNAL(currentIndexChanged(int)), this, SLOT(v1Edited(int)));
|
||||
gridLayout->addWidget(cswitchSource1[i], i+1, 2);
|
||||
cswitchSource1[i]->setVisible(false);
|
||||
v1Layout->addWidget(cswitchSource1[i]);
|
||||
cswitchValue[i] = new QDoubleSpinBox(this);
|
||||
cswitchValue[i]->setMaximum(channelsMax);
|
||||
cswitchValue[i]->setMinimum(-channelsMax);
|
||||
|
@ -56,13 +53,15 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
|||
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);
|
||||
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);
|
||||
cswitchSource2[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(cswitchSource2[i], SIGNAL(currentIndexChanged(int)), this, SLOT(v2Edited(int)));
|
||||
v2Layout->addWidget(cswitchSource2[i]);
|
||||
cswitchSource2[i]->setVisible(false);
|
||||
|
@ -90,13 +89,14 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
|||
connect(cswitchTOffset[i],SIGNAL(editingFinished()),this,SLOT(edited()));
|
||||
v2Layout->addWidget(cswitchTOffset[i]);
|
||||
cswitchTOffset[i]->setVisible(false);
|
||||
gridLayout->addLayout(v2Layout, i+1, 3);
|
||||
tableLayout->addLayout(i, 3, v2Layout);
|
||||
|
||||
// AND
|
||||
cswitchAnd[i] = new QComboBox(this);
|
||||
cswitchAnd[i]->setProperty("index", i);
|
||||
cswitchAnd[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int)));
|
||||
gridLayout->addWidget(cswitchAnd[i], i+1, 4);
|
||||
tableLayout->addWidget(i, 4, cswitchAnd[i]);
|
||||
|
||||
if (firmware->getCapability(LogicalSwitchesExt)) {
|
||||
// Duration
|
||||
|
@ -108,7 +108,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
|||
cswitchDuration[i]->setAccelerated(true);
|
||||
cswitchDuration[i]->setDecimals(1);
|
||||
connect(cswitchDuration[i], SIGNAL(valueChanged(double)), this, SLOT(durationEdited(double)));
|
||||
gridLayout->addWidget(cswitchDuration[i], i+1, 5);
|
||||
tableLayout->addWidget(i, 5, cswitchDuration[i]);
|
||||
|
||||
// Delay
|
||||
cswitchDelay[i] = new QDoubleSpinBox(this);
|
||||
|
@ -119,15 +119,14 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
|||
cswitchDelay[i]->setAccelerated(true);
|
||||
cswitchDelay[i]->setDecimals(1);
|
||||
connect(cswitchDelay[i], SIGNAL(valueChanged(double)), this, SLOT(delayEdited(double)));
|
||||
gridLayout->addWidget(cswitchDelay[i], i+1, 6);
|
||||
tableLayout->addWidget(i, 6, cswitchDelay[i]);
|
||||
}
|
||||
}
|
||||
// Push rows upward
|
||||
addVSpring(gridLayout,0,firmware->getCapability(LogicalSwitches)+1);
|
||||
|
||||
disableMouseScrolling();
|
||||
|
||||
lock = false;
|
||||
update();
|
||||
tableLayout->getTableWidget()->resizeColumnsToContents();
|
||||
}
|
||||
|
||||
LogicalSwitchesPanel::~LogicalSwitchesPanel()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue