Updated width settings for the Channels, Logical Switches and Special Functions tabs. Used to look good for Taranis and not at all good for 9x. Both OK now.
This commit is contained in:
@@ -10,20 +10,24 @@ Channels::Channels(QWidget * parent, ModelData & model):
|
||||
ModelPanel(parent, model)
|
||||
{
|
||||
QGridLayout * gridLayout = new QGridLayout(this);
|
||||
bool minimize = false;
|
||||
|
||||
int col = 1;
|
||||
if (GetEepromInterface()->getCapability(ChannelsName))
|
||||
{
|
||||
minimize=true;
|
||||
addLabel(gridLayout, tr("Name"), col++);
|
||||
addLabel(gridLayout, tr("Offset"), col++);
|
||||
addLabel(gridLayout, tr("Min"), col++);
|
||||
addLabel(gridLayout, tr("Max"), col++);
|
||||
addLabel(gridLayout, tr("Invert"), col++);
|
||||
}
|
||||
addLabel(gridLayout, tr("Offset"), col++, minimize);
|
||||
addLabel(gridLayout, tr("Min"), col++, minimize);
|
||||
addLabel(gridLayout, tr("Max"), col++, minimize);
|
||||
addLabel(gridLayout, tr("Invert"), col++, minimize);
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard()))
|
||||
addLabel(gridLayout, tr("Curve"), col++);
|
||||
addLabel(gridLayout, tr("Curve"), col++, minimize);
|
||||
if (GetEepromInterface()->getCapability(PPMCenter))
|
||||
addLabel(gridLayout, tr("Center"), col++);
|
||||
addLabel(gridLayout, tr("Center"), col++, minimize);
|
||||
if (GetEepromInterface()->getCapability(SYMLimits))
|
||||
addLabel(gridLayout, tr("Sym"), col++);
|
||||
addLabel(gridLayout, tr("Sym"), col++, true);
|
||||
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(Outputs); i++) {
|
||||
col = 0;
|
||||
@@ -31,6 +35,7 @@ Channels::Channels(QWidget * parent, ModelData & model):
|
||||
// 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
|
||||
@@ -125,9 +130,8 @@ Channels::Channels(QWidget * parent, ModelData & model):
|
||||
gridLayout->addWidget(symlimits, i+1, col++, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
QSpacerItem * verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
gridLayout->addItem(verticalSpacer, GetEepromInterface()->getCapability(Outputs)+1, 0, 1, 1);
|
||||
// Push the rows up
|
||||
addVSpring(gridLayout, 0,GetEepromInterface()->getCapability(Outputs)+1);
|
||||
}
|
||||
|
||||
Channels::~Channels()
|
||||
|
||||
@@ -57,7 +57,8 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
addLabel(gridLayout, tr("Switch"), 1);
|
||||
addLabel(gridLayout, tr("Action"), 2);
|
||||
addLabel(gridLayout, tr("Parameters"), 3);
|
||||
addLabel(gridLayout, tr("Enable"), 4);
|
||||
addLabel(gridLayout, tr("Enable"), 4, true );
|
||||
addEmptyLabel(gridLayout, 5 );
|
||||
|
||||
lock = true;
|
||||
int num_fsw = GetEepromInterface()->getCapability(CustomFunctions);
|
||||
@@ -104,12 +105,14 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
label->setMouseTracking(true);
|
||||
label->setProperty("index", i);
|
||||
label->setText(tr("SF%1").arg(i+1));
|
||||
gridLayout->addWidget(label, i+1, 0);
|
||||
label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
|
||||
connect(label, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(fsw_customContextMenuRequested(QPoint)));
|
||||
gridLayout->addWidget(label, i+1, 0);
|
||||
|
||||
// The switch
|
||||
fswtchSwtch[i] = new QComboBox(this);
|
||||
fswtchSwtch[i]->setProperty("index", i);
|
||||
fswtchSwtch[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
|
||||
connect(fswtchSwtch[i], SIGNAL(currentIndexChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
gridLayout->addWidget(fswtchSwtch[i], i+1, 1);
|
||||
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, POPULATE_ONOFF);
|
||||
@@ -183,14 +186,13 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
||||
fswtchEnable[i] = new QCheckBox(this);
|
||||
fswtchEnable[i]->setProperty("index", i);
|
||||
fswtchEnable[i]->setText(tr("ON"));
|
||||
fswtchEnable[i]->setFixedWidth( 50 );
|
||||
repeatLayout->addWidget(fswtchEnable[i], i+1);
|
||||
fswtchEnable[i]->setChecked(model.funcSw[i].enabled);
|
||||
connect(fswtchEnable[i], SIGNAL(stateChanged(int)), this, SLOT(customFunctionEdited()));
|
||||
}
|
||||
|
||||
QSpacerItem * verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
gridLayout->addItem(verticalSpacer, num_fsw+1, 0);
|
||||
|
||||
// Push rows upward
|
||||
addDoubleSpring(gridLayout, 5, num_fsw+1);
|
||||
lock = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
|
||||
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);
|
||||
|
||||
@@ -113,10 +114,8 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
|
||||
gridLayout->addWidget(cswitchDelay[i], i+1, 6);
|
||||
}
|
||||
}
|
||||
|
||||
QSpacerItem * verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
gridLayout->addItem(verticalSpacer, GetEepromInterface()->getCapability(LogicalSwitches)+1, 0, 1, 1);
|
||||
|
||||
// Push rows upward
|
||||
addVSpring(gridLayout,0,GetEepromInterface()->getCapability(LogicalSwitches)+1);
|
||||
lock = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,15 +16,42 @@ void ModelPanel::update()
|
||||
{
|
||||
}
|
||||
|
||||
void ModelPanel::addLabel(QGridLayout * gridLayout, QString text, int col)
|
||||
void ModelPanel::addLabel(QGridLayout * gridLayout, QString text, int col, bool minimize)
|
||||
{
|
||||
QLabel *label = new QLabel(this);
|
||||
label->setFrameShape(QFrame::Panel);
|
||||
label->setFrameShadow(QFrame::Raised);
|
||||
label->setMidLineWidth(0);
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
label->setMargin(3);
|
||||
label->setMargin(5);
|
||||
label->setText(text);
|
||||
if (!minimize)
|
||||
label->setMinimumWidth(100);
|
||||
gridLayout->addWidget(label, 0, col, 1, 1);
|
||||
}
|
||||
|
||||
void ModelPanel::addEmptyLabel(QGridLayout * gridLayout, int col)
|
||||
{
|
||||
QLabel *label = new QLabel(this);
|
||||
label->setText("");
|
||||
gridLayout->addWidget(label, 0, col, 1, 1);
|
||||
}
|
||||
|
||||
void ModelPanel::addHSpring(QGridLayout * gridLayout, int col, int row)
|
||||
{
|
||||
QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
||||
gridLayout->addItem(spacer, row, col);
|
||||
}
|
||||
|
||||
void ModelPanel::addVSpring(QGridLayout * gridLayout, int col, int row)
|
||||
{
|
||||
QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
|
||||
gridLayout->addItem(spacer, row, col);
|
||||
}
|
||||
|
||||
void ModelPanel::addDoubleSpring(QGridLayout * gridLayout, int col, int row)
|
||||
{
|
||||
QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||
gridLayout->addItem(spacer, row, col);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,11 @@ class ModelPanel : public QWidget
|
||||
protected:
|
||||
ModelData & model;
|
||||
bool lock;
|
||||
void addLabel(QGridLayout * gridLayout, QString text, int col);
|
||||
|
||||
void addLabel(QGridLayout * gridLayout, QString text, int col, bool mimimize=false);
|
||||
void addEmptyLabel(QGridLayout * gridLayout, int col);
|
||||
void addHSpring(QGridLayout *, int col, int row);
|
||||
void addVSpring(QGridLayout *, int col, int row);
|
||||
void addDoubleSpring(QGridLayout *, int col, int row);
|
||||
};
|
||||
|
||||
#endif // CHANNELS_H
|
||||
|
||||
Reference in New Issue
Block a user