Skip to content

Commit fd4630f

Browse files
committed
added click astig table selectes wave front and highlights polar plot line. Second click restore line
1 parent 94da42f commit fd4630f

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

astigpolargraph.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,42 @@ int astigPolargraph::findClosestPoint(const QPointF clickedPoint){
150150
}
151151
return closeNdx;
152152
}
153+
154+
void astigPolargraph::on_waveFrontTable_itemClicked(QTableWidgetItem *item)
155+
{
156+
QString name = ui->waveFrontTable->item(item->row(),0)->text();
157+
emit waveSeleted(name);
158+
159+
int lastndx = name.lastIndexOf('/');
160+
if (lastndx != -1)
161+
name = name.mid(lastndx);
162+
163+
164+
int seriesCount = chart->series().count();
165+
166+
for (int i = 0; i < seriesCount; ++i) {
167+
QAbstractSeries* series = chart->series().at(i);
168+
if (series) {
169+
170+
if (series->type()== QAbstractSeries::SeriesTypeLine){
171+
if (series->name() == name){
172+
QLineSeries *line = static_cast<QLineSeries*>(series);
173+
// Create a pen object to get the current pen attributes.
174+
QPen pen = line->pen();
175+
if (pen.style() == Qt::DotLine){
176+
pen.setStyle(Qt::SolidLine);
177+
pen.setWidth(pen.width()/4);
178+
}
179+
else {
180+
pen.setStyle(Qt::DotLine);
181+
pen.setWidth(pen.width() * 4);
182+
}
183+
184+
line->setPen(pen);
185+
}
186+
}
187+
188+
}
189+
}
190+
}
191+

astigpolargraph.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <QtCharts/QValueAxis>
1010
#include <QtCharts/QPolarChart>
1111
#include "wavefront.h"
12+
#include <QTableWidgetItem>
13+
1214
QT_CHARTS_USE_NAMESPACE
1315
namespace Ui {
1416
class astigPolargraph;
@@ -35,6 +37,8 @@ class astigPolargraph : public QDialog
3537
private slots:
3638
void tooltip(QPointF point, bool state);
3739

40+
void on_waveFrontTable_itemClicked(QTableWidgetItem *item);
41+
3842
private:
3943
int findClosestPoint(const QPointF clickedPoint );
4044
Ui::astigPolargraph *ui;

0 commit comments

Comments
 (0)