removing gui warnings from qwt section

This commit is contained in:
maliakal_d 2020-02-26 16:56:41 +01:00
parent 300b0c8105
commit f38ed8706f
7 changed files with 87 additions and 49 deletions

View File

@ -145,6 +145,10 @@
<property name="windowTitle">
<string>SLS Detector GUI</string>
</property>
<property name="windowIcon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/mountain.png</normaloff>:/icons/images/mountain.png</iconset>
</property>
<property name="inputMethodHints">
<set>Qt::ImhNone</set>
</property>
@ -416,6 +420,8 @@ p, li { white-space: pre-wrap; }
</property>
</action>
</widget>
<resources/>
<resources>
<include location="../include/icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -30,8 +30,7 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
Q_OBJECT
public:
qDetectorMain(int argc, char **argv, QApplication *app,
QWidget *parent = 0);
qDetectorMain(int multiId, std::string fname, bool isDevel);
~qDetectorMain();
private slots:

View File

@ -77,14 +77,14 @@ class SlsQtH1D:public QwtPlotCurve{
int ndata;
int n_array;
double dx;
double *x,*y;
double *x{nullptr},*y{nullptr};
double ymin,ymax;
double firstXgt0,firstYgt0;
void Initailize();
int SetUpArrays(int n);
int CheckIndex(int bx);
QPen* pen_ptr;
QPen* pen_ptr{nullptr};
};
@ -151,12 +151,12 @@ class SlsQt1DPlot:public QwtPlot{
void SetLogY(bool yes=1);
private:
SlsQtH1DList* hist_list;
SlsQt1DZoomer* zoomer;
QwtPlotPanner* panner;
SlsQtH1DList* hist_list{nullptr};
SlsQt1DZoomer* zoomer{nullptr};
QwtPlotPanner* panner{nullptr};
QwtPlotMarker *hline;
QwtPlotMarker *vline;
QwtPlotMarker *hline{nullptr};
QwtPlotMarker *vline{nullptr};
bool disableZoom{false};
int ystep{0};

View File

@ -20,7 +20,7 @@ class SlsQt2DPlot: public QwtPlot{
public:
SlsQt2DPlot(QWidget * = NULL);
~SlsQt2DPlot();
void SetTitle(QString title);
void SetXTitle(QString title);
void SetYTitle(QString title);
@ -77,17 +77,17 @@ private:
QwtLinearColorMap* myColourMap(QVector<double> colourStops);
QwtLinearColorMap* myColourMap(int log=0);
QwtPlotSpectrogram *d_spectrogram;
SlsQt2DHist* hist;
SlsQt2DZoomer* zoomer;
QwtPlotPanner* panner;
QwtScaleWidget *rightAxis;
QwtPlotSpectrogram *d_spectrogram{nullptr};
SlsQt2DHist* hist{nullptr};
SlsQt2DZoomer* zoomer{nullptr};
QwtPlotPanner* panner{nullptr};
QwtScaleWidget *rightAxis{nullptr};
QwtLinearColorMap* colorMapLinearScale;
QwtLinearColorMap* colorMapLogScale;
QwtLinearColorMap* colorMapLinearScale{nullptr};
QwtLinearColorMap* colorMapLogScale{nullptr};
#if QWT_VERSION<0x060000
QwtValueList* contourLevelsLinear;
QwtValueList* contourLevelsLog;
QwtValueList* contourLevelsLinear{nullptr};
QwtValueList* contourLevelsLog{nullptr};
#else
QList<double> contourLevelsLinear;
QList<double> contourLevelsLog;

View File

@ -21,7 +21,7 @@
#define QwtLog10ScaleEngine QwtLogScaleEngine
#endif
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data) : QwtPlotCurve(title) {
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data) : QwtPlotCurve(title), x(nullptr), y(nullptr), pen_ptr(nullptr) {
Initailize();
SetData(n, min, max, data);
}
@ -33,15 +33,18 @@ SlsQtH1D::SlsQtH1D(QString title, int n, double *data_x, double *data_y) : QwtPl
void SlsQtH1D::Initailize() {
ndata = n_array = 0;
x = y = 0;
x = y = nullptr;
pen_ptr = new QPen();
SetLineColor();
}
SlsQtH1D::~SlsQtH1D() {
delete x;
delete y;
delete pen_ptr;
if (x)
delete [] x;
if (y)
delete [] y;
if (pen_ptr)
delete pen_ptr;
}
void SlsQtH1D::Attach(SlsQt1DPlot *p) {
@ -358,12 +361,16 @@ SlsQt1DPlot::SlsQt1DPlot(QWidget *parent) : QwtPlot(parent) {
}
SlsQt1DPlot::~SlsQt1DPlot() {
delete hist_list;
if (hist_list)
delete hist_list;
if (hline)
delete hline;
if (vline)
delete vline;
if (zoomer)
delete zoomer;
if (panner)
delete panner;
}
void SlsQt1DPlot::CalculateNResetZoomBase() {

View File

@ -52,6 +52,30 @@ SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
}
SlsQt2DPlot::~SlsQt2DPlot() {
if (d_spectrogram) {
d_spectrogram->detach();
}
if (hist)
delete hist;
if (colorMapLinearScale)
delete colorMapLinearScale;
if (colorMapLogScale)
delete colorMapLogScale;
if (zoomer)
delete zoomer;
if (panner)
delete panner;
#if QWT_VERSION<0x060000
if (contourLevelsLinear)
delete contourLevelsLinear;
if (contourLevelsLog)
delete contourLevelsLog;
#endif
}
void SlsQt2DPlot::SetTitle(QString title) {
setTitle(title);
}
@ -94,7 +118,7 @@ void SlsQt2DPlot::SetZFont(const QFont& f) {
}
void SlsQt2DPlot::SetupColorMap() {
colorMapLinearScale = myColourMap(0);
#if QWT_VERSION < 0x060000
d_spectrogram->setColorMap(*colorMapLinearScale);

View File

@ -26,27 +26,10 @@
#include <sys/stat.h>
int main(int argc, char **argv) {
QApplication *theApp = new QApplication(argc, argv);
theApp->setStyle(new QPlastiqueStyle);
theApp->setWindowIcon(QIcon(":/icons/images/mountain.png"));
try {
qDetectorMain *det = new qDetectorMain(argc, argv, theApp, 0);
det->show();
theApp->exec();
} catch (const std::exception &e) {
qDefs::Message(qDefs::CRITICAL,
std::string(e.what()) + "\nExiting Gui :'( ", "main");
}
return 0;
}
qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
QWidget *parent)
: QMainWindow(parent), detType(slsDetectorDefs::GENERIC), isDeveloper(0),
heightPlotWindow(0), heightCentralWidget(0) {
// options
std::string fname = "";
bool isDeveloper = false;
int64_t tempval = 0;
int multiId = 0;
@ -81,7 +64,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
break;
case 'd':
isDeveloper = 1;
isDeveloper = true;
break;
case 'i':
@ -92,7 +75,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
tempval = APIGUI;
FILE_LOG(logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
<< std::hex << tempval << ")";
return;
return 0;
case 'h':
default:
@ -107,10 +90,29 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
"\t only when more than one multi "
"detector object is needed.\n\n";
FILE_LOG(logERROR) << help_message;
exit(EXIT_FAILURE);
return -1;
}
}
QApplication app(argc, argv);
app.setStyle(new QPlastiqueStyle);
//app.setWindowIcon(QIcon(":/icons/images/mountain.png"));
try {
qDetectorMain det(multiId, fname, isDeveloper);
det.show();
app.exec();
} catch (const std::exception &e) {
qDefs::Message(qDefs::CRITICAL,
std::string(e.what()) + "\nExiting Gui :'( ", "main");
}
return 0;
}
qDetectorMain::qDetectorMain(int multiId, std::string fname, bool isDevel)
: QMainWindow(0), detType(slsDetectorDefs::GENERIC), isDeveloper(isDevel),
heightPlotWindow(0), heightCentralWidget(0) {
setupUi(this);
SetUpDetector(fname, multiId);
SetUpWidgetWindow();