changed Display class to BPMDisplay to resolve qt conflict

This commit is contained in:
Blake Leverington 2023-09-16 14:48:46 +02:00
parent 7b63d9d661
commit 99ed8f54d6
7 changed files with 27 additions and 27 deletions

View File

@ -99,7 +99,7 @@
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Display</string> <string>BPMDisplay</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -4,7 +4,7 @@
#include <QFileDialog> #include <QFileDialog>
#include <QCheckBox> #include <QCheckBox>
Display::Display(QWidget *parent) : BPMDisplay::BPMDisplay(QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::display) ui(new Ui::display)
{ {
@ -27,12 +27,12 @@ Display::Display(QWidget *parent) :
// Connect the buttonClicked signal of the button group // Connect the buttonClicked signal of the button group
connect(buttonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(onButtonClicked(QAbstractButton*))); connect(buttonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(onButtonClicked(QAbstractButton*)));
connect(ui->pushButton_savebkg, &QPushButton::clicked, this, &Display::onSaveBackgroundClicked); connect(ui->pushButton_savebkg, &QPushButton::clicked, this, &BPMDisplay::onSaveBackgroundClicked);
connect(ui->pushButton_loadbkg, &QPushButton::clicked, this, &Display::onLoadBackgroundClicked); connect(ui->pushButton_loadbkg, &QPushButton::clicked, this, &BPMDisplay::onLoadBackgroundClicked);
connect(ui->checkBox_subbkg, &QCheckBox::stateChanged, this, &Display::onCheckBoxStateChanged); connect(ui->checkBox_subbkg, &QCheckBox::stateChanged, this, &BPMDisplay::onCheckBoxStateChanged);
connect(ui->pushButton_savecalib, &QPushButton::clicked, this, &Display::onSaveCalibrationClicked); connect(ui->pushButton_savecalib, &QPushButton::clicked, this, &BPMDisplay::onSaveCalibrationClicked);
connect(ui->pushButton_loadcalib, &QPushButton::clicked, this, &Display::onLoadCalibrationClicked); connect(ui->pushButton_loadcalib, &QPushButton::clicked, this, &BPMDisplay::onLoadCalibrationClicked);
connect(ui->checkBox_expertmode, &QCheckBox::stateChanged, this, &Display::onExpertModeStateChanged); connect(ui->checkBox_expertmode, &QCheckBox::stateChanged, this, &BPMDisplay::onExpertModeStateChanged);
// Enable or disable the "Save Background" and "Save Calib" buttons accordingly // Enable or disable the "Save Background" and "Save Calib" buttons accordingly
ui->pushButton_savebkg->setEnabled(expertModeEnabled); ui->pushButton_savebkg->setEnabled(expertModeEnabled);
@ -45,12 +45,12 @@ Display::Display(QWidget *parent) :
} }
Display::~Display() BPMDisplay::~BPMDisplay()
{ {
delete ui; delete ui;
} }
void Display::showEvent(QShowEvent * event) void BPMDisplay::showEvent(QShowEvent * event)
{ {
if (!event->spontaneous()) if (!event->spontaneous())
{ {
@ -62,7 +62,7 @@ void Display::showEvent(QShowEvent * event)
//*********************************************** //***********************************************
void Display::plot(const QVector<unsigned short> &data) void BPMDisplay::plot(const QVector<unsigned short> &data)
{ {
//resize data vectors and fill X values - only if needed //resize data vectors and fill X values - only if needed
if (data.length() != nrPoints) if (data.length() != nrPoints)
@ -138,18 +138,18 @@ void Display::plot(const QVector<unsigned short> &data)
ui->plot->replot(); ui->plot->replot();
} }
void Display::plot() void BPMDisplay::plot()
{ {
plot(buffer); plot(buffer);
} }
void Display::setTitle(QString title) void BPMDisplay::setTitle(QString title)
{ {
ui->lineTitle->setText(title); ui->lineTitle->setText(title);
} }
// Slot to handle button clicks // Slot to handle button clicks
void Display::onButtonClicked(QAbstractButton *button) void BPMDisplay::onButtonClicked(QAbstractButton *button)
{ {
// Handle button clicks here // Handle button clicks here
if (button == radioButtonFixedScale) if (button == radioButtonFixedScale)
@ -170,7 +170,7 @@ void Display::onButtonClicked(QAbstractButton *button)
} }
} }
void Display::onSaveBackgroundClicked() void BPMDisplay::onSaveBackgroundClicked()
{ {
// Check if there is data to save // Check if there is data to save
if (buffer.isEmpty()) { if (buffer.isEmpty()) {
@ -208,7 +208,7 @@ void Display::onSaveBackgroundClicked()
} }
} }
void Display::onLoadBackgroundClicked() void BPMDisplay::onLoadBackgroundClicked()
{ {
// Get the plane's name (you might need to adjust how you retrieve it) // Get the plane's name (you might need to adjust how you retrieve it)
QString planeName = ui->lineTitle->text(); QString planeName = ui->lineTitle->text();
@ -246,13 +246,13 @@ void Display::onLoadBackgroundClicked()
} }
} }
void Display::onCheckBoxStateChanged(int state) void BPMDisplay::onCheckBoxStateChanged(int state)
{ {
// The state argument will be Qt::Unchecked (0) or Qt::Checked (2) // The state argument will be Qt::Unchecked (0) or Qt::Checked (2)
subtractBackground = (state == Qt::Checked); subtractBackground = (state == Qt::Checked);
} }
void Display::onSaveCalibrationClicked() void BPMDisplay::onSaveCalibrationClicked()
{ {
// Check if there is data to save // Check if there is data to save
@ -291,7 +291,7 @@ void Display::onSaveCalibrationClicked()
} }
} }
void Display::onLoadCalibrationClicked() void BPMDisplay::onLoadCalibrationClicked()
{ {
// Get the plane's name (you might need to adjust how you retrieve it) // Get the plane's name (you might need to adjust how you retrieve it)
QString planeName = ui->lineTitle->text(); QString planeName = ui->lineTitle->text();
@ -361,14 +361,14 @@ void Display::onLoadCalibrationClicked()
} }
} }
void Display::onCalibrationCheckBoxChanged(int state) { void BPMDisplay::onCalibrationCheckBoxChanged(int state) {
// Check the state and update the subtractCalibration flag accordingly // Check the state and update the subtractCalibration flag accordingly
applyCalibration = (state == Qt::Checked); applyCalibration = (state == Qt::Checked);
} }
// Slot to handle the state change of the "Expert Mode" checkbox // Slot to handle the state change of the "Expert Mode" checkbox
void Display::onExpertModeStateChanged(int state) void BPMDisplay::onExpertModeStateChanged(int state)
{ {
// Check if the checkbox is checked (Expert Mode enabled) // Check if the checkbox is checked (Expert Mode enabled)
expertModeEnabled = (state == Qt::Checked); expertModeEnabled = (state == Qt::Checked);

View File

@ -13,13 +13,13 @@ namespace Ui {
class display; class display;
} }
class Display : public QDialog class BPMDisplay : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Display(QWidget *parent = 0); explicit BPMDisplay(QWidget *parent = 0);
~Display(); ~BPMDisplay();
void plot(const QVector<unsigned short> &data); void plot(const QVector<unsigned short> &data);

View File

@ -17,7 +17,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Online Display</string> <string>Online BPMDisplay</string>
</property> </property>
<widget class="QWidget" name="verticalLayoutWidget"> <widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry"> <property name="geometry">

View File

@ -66,7 +66,7 @@ void DisplayServer::show()
displays.clear(); displays.clear();
for (int plane = 0; plane < planeConfig.length(); plane++) for (int plane = 0; plane < planeConfig.length(); plane++)
{ {
Display* newDisplay = new Display; BPMDisplay* newDisplay = new BPMDisplay;
newDisplay->setTitle(planeConfig[plane]->name); newDisplay->setTitle(planeConfig[plane]->name);
newDisplay->show(); newDisplay->show();
displays.append(newDisplay); displays.append(newDisplay);

View File

@ -38,7 +38,7 @@ protected:
int active = 0; int active = 0;
HW* theHW; HW* theHW;
QVector<PlaneConfig*> planeConfig; QVector<PlaneConfig*> planeConfig;
QVector<Display*> displays; QVector<BPMDisplay*> displays;
PlaneConfig *findPlane(int plane_nr); PlaneConfig *findPlane(int plane_nr);
}; };

Binary file not shown.