mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Fix input and output configuration layout issues.
This commit is contained in:
parent
949785d212
commit
91e3ee13fd
@ -62,7 +62,7 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
Q_ASSERT(index < ManualControlSettings::CHANNELGROUPS_NUMELEM);
|
||||
inputChannelForm * inp=new inputChannelForm(this,index==0);
|
||||
m_config->channelSettings->layout()->addWidget(inp);
|
||||
inp->ui->channelName->setText(name);
|
||||
inp->setName(name);
|
||||
addUAVObjectToWidgetRelation("ManualControlSettings","ChannelGroups",inp->ui->channelGroup,index);
|
||||
addUAVObjectToWidgetRelation("ManualControlSettings","ChannelNumber",inp->ui->channelNumber,index);
|
||||
addUAVObjectToWidgetRelation("ManualControlSettings","ChannelMin",inp->ui->channelMin,index);
|
||||
|
@ -23,7 +23,6 @@ inputChannelForm::inputChannelForm(QWidget *parent,bool showlegend) :
|
||||
delete ui->legend4;
|
||||
delete ui->legend5;
|
||||
}
|
||||
|
||||
connect(ui->channelMin,SIGNAL(valueChanged(int)),this,SLOT(minMaxUpdated()));
|
||||
connect(ui->channelMax,SIGNAL(valueChanged(int)),this,SLOT(minMaxUpdated()));
|
||||
connect(ui->channelGroup,SIGNAL(currentIndexChanged(int)),this,SLOT(groupUpdated()));
|
||||
@ -40,6 +39,22 @@ inputChannelForm::~inputChannelForm()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
void inputChannelForm::setName(QString &name)
|
||||
{
|
||||
ui->channelName->setText(name);
|
||||
QFontMetrics metrics(ui->channelName->font());
|
||||
int width=metrics.width(name)+5;
|
||||
foreach(inputChannelForm * form,parent()->findChildren<inputChannelForm*>())
|
||||
{
|
||||
if(form==this)
|
||||
continue;
|
||||
if(form->ui->channelName->minimumSize().width()<width)
|
||||
form->ui->channelName->setMinimumSize(width,0);
|
||||
else
|
||||
width=form->ui->channelName->minimumSize().width();
|
||||
}
|
||||
ui->channelName->setMinimumSize(width,0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the direction of the slider and boundaries
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
explicit inputChannelForm(QWidget *parent = 0,bool showlegend=false);
|
||||
~inputChannelForm();
|
||||
friend class ConfigInputWidget;
|
||||
|
||||
void setName(QString &name);
|
||||
private slots:
|
||||
void minMaxUpdated();
|
||||
void neutralUpdated(int);
|
||||
|
@ -36,7 +36,7 @@
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<width>10</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
|
@ -185,6 +185,18 @@ void OutputChannelForm::neutral(int value)
|
||||
void OutputChannelForm::setAssignment(const QString &assignment)
|
||||
{
|
||||
ui.actuatorName->setText(assignment);
|
||||
QFontMetrics metrics(ui.actuatorName->font());
|
||||
int width=metrics.width(assignment)+1;
|
||||
foreach(OutputChannelForm * form,parent()->findChildren<OutputChannelForm*>())
|
||||
{
|
||||
if(form==this)
|
||||
continue;
|
||||
if(form->ui.actuatorName->minimumSize().width()<width)
|
||||
form->ui.actuatorName->setMinimumSize(width,0);
|
||||
else
|
||||
width=form->ui.actuatorName->minimumSize().width();
|
||||
}
|
||||
ui.actuatorName->setMinimumSize(width,0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user