Skip to content

Commit db77b46

Browse files
gui not scaling appropriately
1 parent 46fbed6 commit db77b46

File tree

2 files changed

+38
-20
lines changed

2 files changed

+38
-20
lines changed

src/Interface/Modules/Math/SolveLinearSystem.ui

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,14 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>730</width>
10-
<height>570</height>
9+
<width>350</width>
10+
<height>250</height>
1111
</rect>
1212
</property>
13-
<property name="sizePolicy">
14-
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
15-
<horstretch>0</horstretch>
16-
<verstretch>0</verstretch>
17-
</sizepolicy>
18-
</property>
1913
<property name="minimumSize">
2014
<size>
21-
<width>389</width>
22-
<height>192</height>
15+
<width>350</width>
16+
<height>250</height>
2317
</size>
2418
</property>
2519
<property name="windowTitle">
@@ -165,16 +159,6 @@
165159
</layout>
166160
</item>
167161
</layout>
168-
<zorder>label_2</zorder>
169-
<zorder>maxIterationsSpinBox_</zorder>
170-
<zorder>methodComboBox_</zorder>
171-
<zorder>label_3</zorder>
172-
<zorder>label_4</zorder>
173-
<zorder>preconditionerComboBox_</zorder>
174-
<zorder>targetErrorSpinBox_</zorder>
175-
<zorder>label</zorder>
176-
<zorder>qwtPlot</zorder>
177-
<zorder>horizontalSpacer</zorder>
178162
</widget>
179163
</item>
180164
</layout>

src/Interface/Modules/Math/SolveLinearSystemDialog.cc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@
3030
#include <Core/Algorithms/Base/AlgorithmVariableNames.h>
3131
#include <Core/Logging/Log.h>
3232
#include <Dataflow/Network/ModuleStateInterface.h> //TODO: extract into intermediate
33+
#include <qwt_plot.h>
34+
#include <qwt_plot_curve.h>
35+
#include <qwt_legend.h>
3336

3437
using namespace SCIRun::Gui;
3538
using namespace SCIRun::Dataflow::Networks;
3639
using namespace SCIRun::Core::Algorithms;
3740

41+
3842
namespace SCIRun {
3943
namespace Gui {
4044
class SolveLinearSystemDialogImpl
@@ -62,6 +66,36 @@ SolveLinearSystemDialog::SolveLinearSystemDialog(const std::string& name, Module
6266
addSpinBoxManager(maxIterationsSpinBox_, Variables::MaxIterations);
6367
addDoubleSpinBoxManager(targetErrorSpinBox_, Variables::TargetError);
6468

69+
QwtPlot *myPlot = this->qwtPlot;
70+
QwtLegend *myLegend = new QwtLegend;
71+
QwtPlotCurve *curve1 = new QwtPlotCurve("Current Target");
72+
QwtPlotCurve *curve2 = new QwtPlotCurve("Target Error");
73+
QwtPlotCurve *curve3 = new QwtPlotCurve("CurrentError");
74+
double x[5] = { 0, 10, 15, 20, 25 };
75+
double y[5] = { 0, 2, 4, 16, 64 };
76+
77+
curve1->setSamples(&x[0], &y[0], (size_t)5);
78+
curve1->setPen(Qt::blue);
79+
curve1->setLegendAttribute(QwtPlotCurve::LegendShowLine);
80+
curve1->setItemAttribute(QwtPlotItem::Legend, true);
81+
82+
curve2->setPen(Qt::darkRed);
83+
curve2->setLegendAttribute(QwtPlotCurve::LegendShowLine);
84+
curve2->setItemAttribute(QwtPlotItem::Legend, true);
85+
86+
curve3->setPen(Qt::darkGreen);
87+
curve3->setLegendAttribute(QwtPlotCurve::LegendShowLine);
88+
curve3->setItemAttribute(QwtPlotItem::Legend, true);
89+
90+
myPlot->setAxisTitle(2, QString("Iteration"));
91+
myPlot->setAxisTitle(0, QString("Error (RMS)"));
92+
myPlot->setTitle(QString("Convergence"));
93+
myPlot->insertLegend(myLegend, QwtPlot::RightLegend);
94+
95+
curve1->attach(myPlot);
96+
myPlot->replot();
97+
myPlot->show();
98+
6599
addComboBoxManager(preconditionerComboBox_, Variables::Preconditioner);
66100
addComboBoxManager(methodComboBox_, Variables::Method, impl_->solverNameLookup_);
67101
}

0 commit comments

Comments
 (0)