mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
gui: fixed gain plot size
This commit is contained in:
parent
3ef8b392db
commit
058e16b872
@ -23,6 +23,12 @@
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="boxPlot">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
|
@ -20,8 +20,20 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="layout">
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="boxPlot">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
@ -39,7 +51,7 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="plotLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
|
@ -26,6 +26,9 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
||||
private slots:
|
||||
void SavePlot();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow(QString title);
|
||||
void DisplayStats(bool enable, QString min, QString max, QString sum);
|
||||
|
@ -22,6 +22,7 @@ class qDefs : public QWidget {
|
||||
qDefs(){};
|
||||
|
||||
static const int Q_FONT_SIZE=9;
|
||||
static const int DATA_GAIN_PLOT_RATIO=5;
|
||||
|
||||
static void DisplayExceptions(std::string emsg, std::string src) {
|
||||
try {
|
||||
|
@ -8,6 +8,7 @@ class SlsQt1DPlot;
|
||||
class SlsQtH1D;
|
||||
class SlsQt2DPlot;
|
||||
class qCloneWidget;
|
||||
class QResizeEvent;
|
||||
|
||||
#include <QFutureWatcher>
|
||||
|
||||
@ -53,6 +54,9 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
void ClonePlot();
|
||||
void SavePlot();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private slots:
|
||||
void SetSaveFileName(QString val);
|
||||
void AcquireFinished();
|
||||
|
@ -47,10 +47,11 @@ void qCloneWidget::SetupWidgetWindow(QString title) {
|
||||
if (gainplot2d == nullptr) {
|
||||
plotLayout->addWidget(plot2d);
|
||||
} else {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / 4);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / 4);
|
||||
plotLayout->addWidget(plot2d, 0, 0, 4, 4);
|
||||
plotLayout->addWidget(gainplot2d, 0, 4, 1, 1);
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||
plotLayout->addWidget(plot2d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1, Qt::AlignRight | Qt::AlignTop);
|
||||
}
|
||||
}
|
||||
connect(actionSaveClone, SIGNAL(triggered()), this, SLOT(SavePlot()));
|
||||
@ -89,3 +90,11 @@ void qCloneWidget::SavePlot() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void qCloneWidget::resizeEvent(QResizeEvent *event) {
|
||||
if (gainplot2d != nullptr) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
event->accept();
|
||||
}
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "versionAPI.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QResizeEvent>
|
||||
#include <QScrollArea>
|
||||
#include <QFileDialog>
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <QFileDialog>
|
||||
#include <QPainter>
|
||||
#include <QtConcurrentRun>
|
||||
|
||||
#include <QResizeEvent>
|
||||
|
||||
|
||||
qDrawPlot::qDrawPlot(QWidget *parent, multiSlsDetector *detector) : QWidget(parent), myDet(detector) {
|
||||
@ -124,8 +124,8 @@ void qDrawPlot::SetupPlots() {
|
||||
plot1d->SetTitle("--");
|
||||
plot1d->SetXTitle(xTitle1d);
|
||||
plot1d->SetYTitle(yTitle1d);
|
||||
plot1d->hide();
|
||||
h->Attach(plot1d);
|
||||
plot1d->hide();
|
||||
|
||||
// setup 2d data
|
||||
if (data2d)
|
||||
@ -163,8 +163,7 @@ void qDrawPlot::SetupPlots() {
|
||||
plot2d->SetZTitle(zTitle2d);
|
||||
|
||||
gainplot2d = new SlsQt2DPlot(boxPlot);
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
|
||||
-0.5, nPixelsY - 0.5, gainData);
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
|
||||
gainplot2d->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot2d->setTitle("");
|
||||
gainplot2d->enableAxis(0, false);
|
||||
@ -173,9 +172,18 @@ void qDrawPlot::SetupPlots() {
|
||||
gainplot2d->hide();
|
||||
|
||||
// layout of plots
|
||||
plotLayout->addWidget(plot1d, 0, 0, 4, 4);
|
||||
plotLayout->addWidget(plot2d, 0, 0, 4, 4);
|
||||
plotLayout->addWidget(gainplot2d, 0, 4, 1, 1);
|
||||
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||
plotLayout->addWidget(plot1d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(plot2d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1, Qt::AlignRight | Qt::AlignTop);
|
||||
}
|
||||
|
||||
void qDrawPlot::resizeEvent(QResizeEvent *event) {
|
||||
if (gainplot2d->isVisible()) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
||||
bool qDrawPlot::GetIsRunning() {
|
||||
@ -442,7 +450,7 @@ void qDrawPlot::ClonePlot() {
|
||||
clonegainplot2D->enableAxis(1, false);
|
||||
clonegainplot2D->enableAxis(2, false);
|
||||
clonegainplot2D->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
|
||||
clonegainplot2D->SetTitle(gainplot2d->title().text());
|
||||
clonegainplot2D->SetTitle("");
|
||||
}
|
||||
}
|
||||
|
||||
@ -787,16 +795,15 @@ void qDrawPlot::Update2dPlot() {
|
||||
plot2d->SetXTitle(xTitle2d);
|
||||
plot2d->SetYTitle(yTitle2d);
|
||||
plot2d->SetZTitle(zTitle2d);
|
||||
plot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5,
|
||||
nPixelsY, -0.5, nPixelsY - 0.5, data2d);
|
||||
plot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, data2d);
|
||||
if (isGainDataExtracted) {
|
||||
gainplot2d->SetTitle(indexTitle);
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
|
||||
-0.5, nPixelsY - 0.5, gainData);
|
||||
gainplot2d->setFixedWidth(plot2d->width() / 4);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / 4);
|
||||
gainplot2d->show();
|
||||
} else {
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
|
||||
if (!gainplot2d->isVisible()) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->show();
|
||||
}
|
||||
} else if (gainplot2d->isVisible()) {
|
||||
gainplot2d->hide();
|
||||
}
|
||||
if (xyRangeChanged) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user