Modeledit, rearrange curve dialog to avoid vertical scrolls
This commit is contained in:
committed by
Romolo Manfredini
parent
2fdde52fcd
commit
c0e9b196f9
@@ -109,18 +109,29 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
|
|||||||
QGraphicsScene *scene = new QGraphicsScene(ui->curvePreview);
|
QGraphicsScene *scene = new QGraphicsScene(ui->curvePreview);
|
||||||
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||||
ui->curvePreview->setScene(scene);
|
ui->curvePreview->setScene(scene);
|
||||||
|
int numcurves=firmware->getCapability(NumCurves);
|
||||||
for (int i=0; i<firmware->getCapability(NumCurves); i++) {
|
int limit;
|
||||||
|
if (numcurves>16) {
|
||||||
|
limit=numcurves/2;
|
||||||
|
} else {
|
||||||
|
limit=numcurves;
|
||||||
|
}
|
||||||
|
for (int i=0; i<numcurves; i++) {
|
||||||
visibleCurves[i] = false;
|
visibleCurves[i] = false;
|
||||||
|
|
||||||
// The reset curve button
|
// The reset curve button
|
||||||
QPushButton * reset = new QPushButton(this);
|
QPushButton * reset = new QPushButton(this);
|
||||||
reset->setProperty("index", i);
|
reset->setProperty("index", i);
|
||||||
reset->setMinimumSize(QSize(0, 0));
|
reset->setMinimumSize(QSize(0, 0));
|
||||||
|
reset->setMaximumSize(QSize(16, 16));
|
||||||
reset->setIcon(CompanionIcon("clear.png"));
|
reset->setIcon(CompanionIcon("clear.png"));
|
||||||
reset->setIconSize(QSize(14, 14));
|
reset->setIconSize(QSize(14, 14));
|
||||||
connect(reset, SIGNAL(clicked()), this, SLOT(resetCurve()));
|
connect(reset, SIGNAL(clicked()), this, SLOT(resetCurve()));
|
||||||
ui->curvesLayout->addWidget(reset, i, 0, 1, 1);
|
if (i<limit) {
|
||||||
|
ui->curvesLayout->addWidget(reset, i, 0, 1, 1);
|
||||||
|
} else {
|
||||||
|
ui->curvesLayout2->addWidget(reset, i-limit, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// The edit curve button
|
// The edit curve button
|
||||||
QPushButton * edit = new QPushButton(this);
|
QPushButton * edit = new QPushButton(this);
|
||||||
@@ -136,14 +147,29 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
|
|||||||
edit->setPalette(palette);
|
edit->setPalette(palette);
|
||||||
edit->setText(tr("Curve %1").arg(i+1));
|
edit->setText(tr("Curve %1").arg(i+1));
|
||||||
connect(edit, SIGNAL(clicked()), this, SLOT(editCurve()));
|
connect(edit, SIGNAL(clicked()), this, SLOT(editCurve()));
|
||||||
ui->curvesLayout->addWidget(edit, i, 1, 1, 1);
|
if (i<limit) {
|
||||||
|
ui->curvesLayout->addWidget(edit, i, 1, 1, 1);
|
||||||
|
} else {
|
||||||
|
ui->curvesLayout2->addWidget(edit, i-limit, 1, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// The curve plot checkbox
|
// The curve plot checkbox
|
||||||
QCheckBox * plot = new QCheckBox(this);
|
QCheckBox * plot = new QCheckBox(this);
|
||||||
plot->setProperty("index", i);
|
plot->setProperty("index", i);
|
||||||
plot->setPalette(palette);
|
plot->setPalette(palette);
|
||||||
connect(plot, SIGNAL(toggled(bool)), this, SLOT(plotCurve(bool)));
|
connect(plot, SIGNAL(toggled(bool)), this, SLOT(plotCurve(bool)));
|
||||||
ui->curvesLayout->addWidget(plot, i, 2, 1, 1);
|
if (i<limit) {
|
||||||
|
ui->curvesLayout->addWidget(plot, i, 2, 1, 1);
|
||||||
|
} else {
|
||||||
|
ui->curvesLayout2->addWidget(plot, i-limit, 2, 1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QSpacerItem * item = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
ui->curvesLayout->addItem(item,limit+1,1,1,1,0);
|
||||||
|
if (limit!=numcurves) {
|
||||||
|
QSpacerItem * item2 = new QSpacerItem(1,1, QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||||
|
ui->curvesLayout2->addItem(item2,limit+1,1,1,1,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<C9X_MAX_POINTS; i++) {
|
for (int i=0; i<C9X_MAX_POINTS; i++) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>718</width>
|
<width>624</width>
|
||||||
<height>539</height>
|
<height>539</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -125,6 +125,9 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="curvesLayout2"/>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
@@ -173,6 +176,9 @@
|
|||||||
<string>Curve Creator</string>
|
<string>Curve Creator</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_76" rowstretch="0,0,0,0,0,0,0,0">
|
<layout class="QGridLayout" name="gridLayout_76" rowstretch="0,0,0,0,0,0,0,0">
|
||||||
|
<item row="0" column="1" colspan="3">
|
||||||
|
<widget class="QComboBox" name="curveType"/>
|
||||||
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="yMidLabel">
|
<widget class="QLabel" name="yMidLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -268,6 +274,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item row="3" column="1" colspan="3">
|
<item row="3" column="1" colspan="3">
|
||||||
<widget class="QSpinBox" name="yMid">
|
<widget class="QSpinBox" name="yMid">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -284,9 +303,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" colspan="3">
|
|
||||||
<widget class="QComboBox" name="curveType"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="curveTypeLabel_2">
|
<widget class="QLabel" name="curveTypeLabel_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -308,19 +324,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
|
||||||
<spacer name="verticalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -331,7 +334,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>10</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user