Skip to content

Commit bfc2c36

Browse files
author
JJPPeters
committed
Tidied some dialog code
1 parent cd0fff5 commit bfc2c36

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

Plotting/imageplot.h

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ enum ShowComplex{
2929
Amplitude,
3030
PowerSpectrum};
3131

32-
typedef std::map<std::string, std::map<std::string, std::string>>::iterator it_type;
33-
3432
// this wrapper class just serves to return a data array. I could just store an array, but it is
3533
// stored anyway and it is only needed for saving images.
3634
class QCPDataColorMap : public QCPColorMap

mainwindow.cpp

+12-17
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ void MainWindow::showImageAndFFT(Eigen::MatrixXcd &image)
231231
}
232232
catch (const std::exception& e)
233233
{
234-
QMessageBox messageBox;
235-
messageBox.critical(nullptr,"Error", e.what());
234+
QMessageBox::critical(nullptr,"Error", e.what());
236235
return;
237236
}
238237

@@ -243,8 +242,7 @@ void MainWindow::showImageAndFFT(Eigen::MatrixXcd &image)
243242
}
244243
catch (const std::exception& e)
245244
{
246-
QMessageBox messageBox;
247-
messageBox.critical(nullptr,"Error", e.what());
245+
QMessageBox::critical(nullptr,"Error", e.what());
248246
return;
249247
}
250248

@@ -381,8 +379,7 @@ void MainWindow::clickBraggSpot(QMouseEvent *event)
381379
}
382380
catch (const std::exception& e)
383381
{
384-
QMessageBox messageBox;
385-
messageBox.critical(nullptr,"Error", e.what());
382+
QMessageBox::critical(nullptr,"Error", e.what());
386383
return;
387384
}
388385

@@ -405,8 +402,7 @@ void MainWindow::continuePhase()
405402
}
406403
catch (const std::exception& e)
407404
{
408-
QMessageBox messageBox;
409-
messageBox.critical(nullptr,"Error", e.what());
405+
QMessageBox::critical(nullptr,"Error", e.what());
410406
return;
411407
}
412408

@@ -557,8 +553,7 @@ void MainWindow::doRefinement(double top, double left, double bottom, double rig
557553
}
558554
catch (const std::exception& e)
559555
{
560-
QMessageBox messageBox;
561-
messageBox.critical(nullptr, "Error", e.what());
556+
QMessageBox::critical(nullptr, "Error", e.what());
562557
return;
563558
}
564559

@@ -865,18 +860,18 @@ void MainWindow::on_angleSpin_editingFinished()
865860
// These are to account for the size of the text
866861
// there might be a better way using rects and setting the alignment to centre
867862
// but I can't be botthered to work it out
868-
QPoint ysz(-3, 4.5);
869-
QPoint xsz(-3, 3);
863+
QPointF ysz(-3, 4.5);
864+
QPointF xsz(-3, 3);
870865
// This is the size of our area to draw in
871866
QSize size(100, 100);
872867
// This is the pixmap that will eventually be shown, we start with it transparent
873868
QPixmap newmap(size);
874869
newmap.fill(Qt::transparent);
875870
// this is the midpoint of our image (so we can rotate around it)
876-
QPoint mid(size.height()/2, size.width()/2);
871+
QPointF mid(size.height()/2., size.width()/2.);
877872
// this is the position of our labels
878-
QPoint xp(65, 65);
879-
QPoint yp(35, 35);
873+
QPointF xp(65, 65);
874+
QPointF yp(35, 35);
880875

881876
// here we rotate these positions about the mid point
882877
xp = xp - mid;
@@ -904,9 +899,9 @@ void MainWindow::on_angleSpin_editingFinished()
904899
p->setPen(yPen);
905900
p->drawText(yp + ysz, "y");
906901
// now rotate the svg about hte mid point and draw it
907-
p->translate(size.height()/2,size.height()/2);
902+
p->translate(size.height()/2.,size.height()/2.);
908903
p->rotate(-angle);
909-
p->translate(-size.height()/2,-size.height()/2);
904+
p->translate(-size.height()/2.,-size.height()/2.);
910905
renderer.render(p);
911906
// done, phew...
912907
p->end();

0 commit comments

Comments
 (0)