Skip to content

Commit 3aaa69f

Browse files
committed
Change curPlot to customPlot
1 parent 615f7b0 commit 3aaa69f

3 files changed

Lines changed: 201 additions & 179 deletions

File tree

src/app/dialog/mainwindow.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,10 +1020,11 @@ void MainWindow::CalculateFittingAndDisplay()
10201020
}
10211021

10221022
// Save QCustomPlot Plots
1023-
void MainWindow::SavePlot(QCustomPlot *curPlot, QString fileName)
1023+
void MainWindow::SavePlot(QCustomPlot *customPlot, QString fileName)
10241024
{
10251025
//Save Data
10261026
QString filesTypes = tr("PNG (*.png);;JPEG (*.jpg);;BMP (*.bmp);;PDF (*.pdf)");
1027+
10271028
QString name = QFileDialog::
10281029
getSaveFileName(this, tr("Save Plot"),fileName,
10291030
filesTypes);
@@ -1032,13 +1033,13 @@ void MainWindow::SavePlot(QCustomPlot *curPlot, QString fileName)
10321033
else
10331034
{
10341035
if (name.endsWith(".png", Qt::CaseInsensitive))
1035-
curPlot->savePng(name,QPrinter::HighResolution);
1036+
customPlot->savePng(name,QPrinter::HighResolution);
10361037
if (name.endsWith(".jpg", Qt::CaseInsensitive))
1037-
curPlot->saveJpg(name);
1038+
customPlot->saveJpg(name);
10381039
if (name.endsWith(".bmp", Qt::CaseInsensitive))
1039-
curPlot->saveBmp(name);
1040+
customPlot->saveBmp(name);
10401041
if (name.endsWith(".pdf", Qt::CaseInsensitive))
1041-
curPlot->savePdf(name);
1042+
customPlot->savePdf(name);
10421043
RememberLastDirectory(name);
10431044
}
10441045
}
@@ -1051,13 +1052,13 @@ void MainWindow::RememberLastDirectory(QString fileName)
10511052
}
10521053

10531054
//Display x and y values
1054-
void MainWindow::DisplayGraphData(QMouseEvent *event, QCustomPlot *curPlot,
1055+
void MainWindow::DisplayGraphData(QMouseEvent *event, QCustomPlot *customPlot,
10551056
QString strNameX, QString strNameY)
10561057
{
1057-
QCPAbstractPlottable *plottable = curPlot->plottableAt(event->position());
1058+
QCPAbstractPlottable *plottable = customPlot->plottableAt(event->position());
10581059
if(plottable)
10591060
{
1060-
double x = curPlot->xAxis->pixelToCoord(event->position().x());
1061+
double x = customPlot->xAxis->pixelToCoord(event->position().x());
10611062
double *dx;
10621063

10631064
QCPGraph *graph = qobject_cast<QCPGraph*>(plottable);
@@ -1102,7 +1103,7 @@ void MainWindow::DisplayGraphData(QMouseEvent *event, QCustomPlot *curPlot,
11021103
"<td>%L3:</td>" "<td>%L4</td>"
11031104
"</tr>"
11041105
"</table>").arg(strNameX).arg(key).arg(strNameY).arg(value),
1105-
curPlot, curPlot->rect());
1106+
customPlot, customPlot->rect());
11061107
}
11071108
}
11081109
}
@@ -1112,15 +1113,15 @@ void MainWindow::DisplayGraphData(QMouseEvent *event, QCustomPlot *curPlot,
11121113
}
11131114

11141115
//Display x and y values
1115-
void MainWindow::DisplayPolarCurveData(QMouseEvent *event, QCustomPlot *curPlot,
1116+
void MainWindow::DisplayPolarCurveData(QMouseEvent *event, QCustomPlot *customPlot,
11161117
QString strNameX, QString strNameY)
11171118
{
11181119
PlotData plot;
11191120

1120-
QCPAbstractPlottable *plottable = curPlot->plottableAt(event->position());
1121+
QCPAbstractPlottable *plottable = customPlot->plottableAt(event->position());
11211122
if(plottable)
11221123
{
1123-
double x = curPlot->xAxis->pixelToCoord(event->position().x());
1124+
double x = customPlot->xAxis->pixelToCoord(event->position().x());
11241125
double *dx;
11251126

11261127
QCPCurve *curve = qobject_cast<QCPCurve*>(plottable);
@@ -1176,7 +1177,7 @@ void MainWindow::DisplayPolarCurveData(QMouseEvent *event, QCustomPlot *curPlot,
11761177
"<td>%L3:</td>" "<td>%L4</td>"
11771178
"</tr>"
11781179
"</table>").arg(strNameX).arg(angle).arg(strNameY).arg(rho),
1179-
curPlot, curPlot->rect());
1180+
customPlot, customPlot->rect());
11801181
}
11811182
}
11821183
}

src/app/dialog/mainwindow.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ class MainWindow : public QMainWindow
2828
void UpdateMuspFitPlot();
2929
void UpdateMuspFitErrorDisplay();
3030
void CalculateFittingAndDisplay();
31-
void SavePlot(QCustomPlot *curPlot, QString fileName);
31+
void SavePlot(QCustomPlot *customPlot, QString fileName);
3232
void RememberLastDirectory(QString fileName);
33-
void DisplayGraphData(QMouseEvent *event, QCustomPlot *curPlot,
33+
void DisplayGraphData(QMouseEvent *event, QCustomPlot *customPlot,
3434
QString strNameX, QString strNameY);
35-
void DisplayPolarCurveData(QMouseEvent *event, QCustomPlot *curPlot,
35+
void DisplayPolarCurveData(QMouseEvent *event, QCustomPlot *customPlot,
3636
QString strNameX, QString strNameY);
3737

3838
private slots:

0 commit comments

Comments
 (0)