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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,27 +26,10 @@
#include <sys/stat.h> #include <sys/stat.h>
int main(int argc, char **argv) { 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 // options
std::string fname = ""; std::string fname = "";
bool isDeveloper = false;
int64_t tempval = 0; int64_t tempval = 0;
int multiId = 0; int multiId = 0;
@ -81,7 +64,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
break; break;
case 'd': case 'd':
isDeveloper = 1; isDeveloper = true;
break; break;
case 'i': case 'i':
@ -92,7 +75,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
tempval = APIGUI; tempval = APIGUI;
FILE_LOG(logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x" FILE_LOG(logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
<< std::hex << tempval << ")"; << std::hex << tempval << ")";
return; return 0;
case 'h': case 'h':
default: default:
@ -107,10 +90,29 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
"\t only when more than one multi " "\t only when more than one multi "
"detector object is needed.\n\n"; "detector object is needed.\n\n";
FILE_LOG(logERROR) << help_message; 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); setupUi(this);
SetUpDetector(fname, multiId); SetUpDetector(fname, multiId);
SetUpWidgetWindow(); SetUpWidgetWindow();