Modeledit, rearrange curve dialog to avoid vertical scrolls

This commit is contained in:
Romolo Manfredini
2015-04-26 11:57:27 +02:00
committed by Romolo Manfredini
parent 2fdde52fcd
commit c0e9b196f9
2 changed files with 52 additions and 23 deletions
+31 -5
View File
@@ -109,18 +109,29 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
QGraphicsScene *scene = new QGraphicsScene(ui->curvePreview);
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
ui->curvePreview->setScene(scene);
for (int i=0; i<firmware->getCapability(NumCurves); i++) {
int numcurves=firmware->getCapability(NumCurves);
int limit;
if (numcurves>16) {
limit=numcurves/2;
} else {
limit=numcurves;
}
for (int i=0; i<numcurves; i++) {
visibleCurves[i] = false;
// The reset curve button
QPushButton * reset = new QPushButton(this);
reset->setProperty("index", i);
reset->setMinimumSize(QSize(0, 0));
reset->setMaximumSize(QSize(16, 16));
reset->setIcon(CompanionIcon("clear.png"));
reset->setIconSize(QSize(14, 14));
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
QPushButton * edit = new QPushButton(this);
@@ -136,14 +147,29 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
edit->setPalette(palette);
edit->setText(tr("Curve %1").arg(i+1));
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
QCheckBox * plot = new QCheckBox(this);
plot->setProperty("index", i);
plot->setPalette(palette);
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++) {
+21 -18
View File
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>718</width>
<width>624</width>
<height>539</height>
</rect>
</property>
@@ -125,6 +125,9 @@
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="curvesLayout2"/>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
@@ -173,6 +176,9 @@
<string>Curve Creator</string>
</property>
<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">
<widget class="QLabel" name="yMidLabel">
<property name="text">
@@ -268,6 +274,19 @@
</property>
</widget>
</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">
<widget class="QSpinBox" name="yMid">
<property name="sizePolicy">
@@ -284,9 +303,6 @@
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QComboBox" name="curveType"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="curveTypeLabel_2">
<property name="text">
@@ -308,19 +324,6 @@
</property>
</widget>
</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>
</widget>
</item>
@@ -331,7 +334,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>10</width>
<height>20</height>
</size>
</property>