added new scale options for the display plots. Log appends correctly.

This commit is contained in:
Blake Leverington 2023-09-06 13:17:05 +02:00
parent 391143ed66
commit 6b8961ecc5
40 changed files with 434 additions and 89 deletions

File diff suppressed because one or more lines are too long

View File

@ -42,16 +42,22 @@ static constexpr auto qt_meta_stringdata_CLASSDisplayENDCLASS = QtMocHelpers::st
"showEvent", "showEvent",
"", "",
"QShowEvent*", "QShowEvent*",
"event" "event",
"onButtonClicked",
"QAbstractButton*",
"button"
); );
#else // !QT_MOC_HAS_STRING_DATA #else // !QT_MOC_HAS_STRING_DATA
struct qt_meta_stringdata_CLASSDisplayENDCLASS_t { struct qt_meta_stringdata_CLASSDisplayENDCLASS_t {
uint offsetsAndSizes[10]; uint offsetsAndSizes[16];
char stringdata0[8]; char stringdata0[8];
char stringdata1[10]; char stringdata1[10];
char stringdata2[1]; char stringdata2[1];
char stringdata3[12]; char stringdata3[12];
char stringdata4[6]; char stringdata4[6];
char stringdata5[16];
char stringdata6[17];
char stringdata7[7];
}; };
#define QT_MOC_LITERAL(ofs, len) \ #define QT_MOC_LITERAL(ofs, len) \
uint(sizeof(qt_meta_stringdata_CLASSDisplayENDCLASS_t::offsetsAndSizes) + ofs), len uint(sizeof(qt_meta_stringdata_CLASSDisplayENDCLASS_t::offsetsAndSizes) + ofs), len
@ -61,13 +67,19 @@ Q_CONSTINIT static const qt_meta_stringdata_CLASSDisplayENDCLASS_t qt_meta_strin
QT_MOC_LITERAL(8, 9), // "showEvent" QT_MOC_LITERAL(8, 9), // "showEvent"
QT_MOC_LITERAL(18, 0), // "" QT_MOC_LITERAL(18, 0), // ""
QT_MOC_LITERAL(19, 11), // "QShowEvent*" QT_MOC_LITERAL(19, 11), // "QShowEvent*"
QT_MOC_LITERAL(31, 5) // "event" QT_MOC_LITERAL(31, 5), // "event"
QT_MOC_LITERAL(37, 15), // "onButtonClicked"
QT_MOC_LITERAL(53, 16), // "QAbstractButton*"
QT_MOC_LITERAL(70, 6) // "button"
}, },
"Display", "Display",
"showEvent", "showEvent",
"", "",
"QShowEvent*", "QShowEvent*",
"event" "event",
"onButtonClicked",
"QAbstractButton*",
"button"
}; };
#undef QT_MOC_LITERAL #undef QT_MOC_LITERAL
#endif // !QT_MOC_HAS_STRING_DATA #endif // !QT_MOC_HAS_STRING_DATA
@ -79,7 +91,7 @@ Q_CONSTINIT static const uint qt_meta_data_CLASSDisplayENDCLASS[] = {
11, // revision 11, // revision
0, // classname 0, // classname
0, 0, // classinfo 0, 0, // classinfo
1, 14, // methods 2, 14, // methods
0, 0, // properties 0, 0, // properties
0, 0, // enums/sets 0, 0, // enums/sets
0, 0, // constructors 0, 0, // constructors
@ -87,10 +99,12 @@ Q_CONSTINIT static const uint qt_meta_data_CLASSDisplayENDCLASS[] = {
0, // signalCount 0, // signalCount
// slots: name, argc, parameters, tag, flags, initial metatype offsets // slots: name, argc, parameters, tag, flags, initial metatype offsets
1, 1, 20, 2, 0x0a, 1 /* Public */, 1, 1, 26, 2, 0x0a, 1 /* Public */,
5, 1, 29, 2, 0x0a, 3 /* Public */,
// slots: parameters // slots: parameters
QMetaType::Void, 0x80000000 | 3, 4, QMetaType::Void, 0x80000000 | 3, 4,
QMetaType::Void, 0x80000000 | 6, 7,
0 // eod 0 // eod
}; };
@ -106,7 +120,10 @@ Q_CONSTINIT const QMetaObject Display::staticMetaObject = { {
QtPrivate::TypeAndForceComplete<Display, std::true_type>, QtPrivate::TypeAndForceComplete<Display, std::true_type>,
// method 'showEvent' // method 'showEvent'
QtPrivate::TypeAndForceComplete<void, std::false_type>, QtPrivate::TypeAndForceComplete<void, std::false_type>,
QtPrivate::TypeAndForceComplete<QShowEvent *, std::false_type> QtPrivate::TypeAndForceComplete<QShowEvent *, std::false_type>,
// method 'onButtonClicked'
QtPrivate::TypeAndForceComplete<void, std::false_type>,
QtPrivate::TypeAndForceComplete<QAbstractButton *, std::false_type>
>, >,
nullptr nullptr
} }; } };
@ -118,8 +135,20 @@ void Display::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, voi
(void)_t; (void)_t;
switch (_id) { switch (_id) {
case 0: _t->showEvent((*reinterpret_cast< std::add_pointer_t<QShowEvent*>>(_a[1]))); break; case 0: _t->showEvent((*reinterpret_cast< std::add_pointer_t<QShowEvent*>>(_a[1]))); break;
case 1: _t->onButtonClicked((*reinterpret_cast< std::add_pointer_t<QAbstractButton*>>(_a[1]))); break;
default: ; default: ;
} }
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
switch (_id) {
default: *reinterpret_cast<QMetaType *>(_a[0]) = QMetaType(); break;
case 1:
switch (*reinterpret_cast<int*>(_a[1])) {
default: *reinterpret_cast<QMetaType *>(_a[0]) = QMetaType(); break;
case 0:
*reinterpret_cast<QMetaType *>(_a[0]) = QMetaType::fromType< QAbstractButton* >(); break;
}
break;
}
} }
} }
@ -142,13 +171,13 @@ int Display::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
if (_id < 0) if (_id < 0)
return _id; return _id;
if (_c == QMetaObject::InvokeMetaMethod) { if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 1) if (_id < 2)
qt_static_metacall(this, _c, _id, _a); qt_static_metacall(this, _c, _id, _a);
_id -= 1; _id -= 2;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 1) if (_id < 2)
*reinterpret_cast<QMetaType *>(_a[0]) = QMetaType(); qt_static_metacall(this, _c, _id, _a);
_id -= 1; _id -= 2;
} }
return _id; return _id;
} }

View File

@ -11,10 +11,13 @@
#include <QtCore/QVariant> #include <QtCore/QVariant>
#include <QtWidgets/QApplication> #include <QtWidgets/QApplication>
#include <QtWidgets/QCheckBox> #include <QtWidgets/QButtonGroup>
#include <QtWidgets/QDialog> #include <QtWidgets/QDialog>
#include <QtWidgets/QFrame>
#include <QtWidgets/QHBoxLayout> #include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLineEdit> #include <QtWidgets/QLineEdit>
#include <QtWidgets/QRadioButton>
#include <QtWidgets/QSpinBox>
#include <QtWidgets/QVBoxLayout> #include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget> #include <QtWidgets/QWidget>
#include "qcustomplot.h" #include "qcustomplot.h"
@ -26,30 +29,42 @@ class Ui_display
public: public:
QWidget *verticalLayoutWidget; QWidget *verticalLayoutWidget;
QVBoxLayout *verticalLayout; QVBoxLayout *verticalLayout;
QLineEdit *lineTitle;
QCustomPlot *plot; QCustomPlot *plot;
QLineEdit *lineTitle;
QHBoxLayout *horizontalLayout; QHBoxLayout *horizontalLayout;
QCheckBox *checkAutoscale; QRadioButton *radioButtonMaxScale;
QFrame *line;
QRadioButton *radioButtonAutoscale;
QFrame *line_2;
QRadioButton *radioButtonFixedScale;
QSpinBox *spinBox_fixedmin;
QSpinBox *spinBox_fixedmax;
QButtonGroup *buttonGroup;
void setupUi(QDialog *display) void setupUi(QDialog *display)
{ {
if (display->objectName().isEmpty()) if (display->objectName().isEmpty())
display->setObjectName("display"); display->setObjectName("display");
display->resize(602, 360); display->resize(603, 392);
QPalette palette;
QBrush brush(QColor(255, 255, 255, 255));
brush.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Active, QPalette::Button, brush);
QBrush brush1(QColor(221, 221, 221, 255));
brush1.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Active, QPalette::Midlight, brush1);
QBrush brush2(QColor(85, 85, 255, 255));
brush2.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Active, QPalette::Highlight, brush2);
palette.setBrush(QPalette::Disabled, QPalette::Highlight, brush2);
display->setPalette(palette);
verticalLayoutWidget = new QWidget(display); verticalLayoutWidget = new QWidget(display);
verticalLayoutWidget->setObjectName("verticalLayoutWidget"); verticalLayoutWidget->setObjectName("verticalLayoutWidget");
verticalLayoutWidget->setGeometry(QRect(9, 10, 581, 341)); verticalLayoutWidget->setGeometry(QRect(10, 10, 581, 371));
verticalLayout = new QVBoxLayout(verticalLayoutWidget); verticalLayout = new QVBoxLayout(verticalLayoutWidget);
verticalLayout->setObjectName("verticalLayout"); verticalLayout->setObjectName("verticalLayout");
verticalLayout->setSizeConstraint(QLayout::SetDefaultConstraint);
verticalLayout->setContentsMargins(0, 0, 0, 0); verticalLayout->setContentsMargins(0, 0, 0, 0);
lineTitle = new QLineEdit(verticalLayoutWidget);
lineTitle->setObjectName("lineTitle");
lineTitle->setFrame(false);
lineTitle->setAlignment(Qt::AlignCenter);
lineTitle->setReadOnly(true);
verticalLayout->addWidget(lineTitle);
plot = new QCustomPlot(verticalLayoutWidget); plot = new QCustomPlot(verticalLayoutWidget);
plot->setObjectName("plot"); plot->setObjectName("plot");
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
@ -57,19 +72,97 @@ public:
sizePolicy.setVerticalStretch(0); sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(plot->sizePolicy().hasHeightForWidth()); sizePolicy.setHeightForWidth(plot->sizePolicy().hasHeightForWidth());
plot->setSizePolicy(sizePolicy); plot->setSizePolicy(sizePolicy);
lineTitle = new QLineEdit(plot);
lineTitle->setObjectName("lineTitle");
lineTitle->setGeometry(QRect(230, 0, 106, 22));
QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Fixed);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
sizePolicy1.setHeightForWidth(lineTitle->sizePolicy().hasHeightForWidth());
lineTitle->setSizePolicy(sizePolicy1);
lineTitle->setFrame(false);
lineTitle->setAlignment(Qt::AlignCenter);
lineTitle->setReadOnly(true);
verticalLayout->addWidget(plot); verticalLayout->addWidget(plot);
horizontalLayout = new QHBoxLayout(); horizontalLayout = new QHBoxLayout();
horizontalLayout->setObjectName("horizontalLayout"); horizontalLayout->setObjectName("horizontalLayout");
checkAutoscale = new QCheckBox(verticalLayoutWidget); radioButtonMaxScale = new QRadioButton(verticalLayoutWidget);
checkAutoscale->setObjectName("checkAutoscale"); buttonGroup = new QButtonGroup(display);
buttonGroup->setObjectName("buttonGroup");
buttonGroup->addButton(radioButtonMaxScale);
radioButtonMaxScale->setObjectName("radioButtonMaxScale");
radioButtonMaxScale->setEnabled(true);
radioButtonMaxScale->setMouseTracking(false);
radioButtonMaxScale->setIconSize(QSize(25, 25));
radioButtonMaxScale->setChecked(true);
radioButtonMaxScale->setAutoExclusive(false);
horizontalLayout->addWidget(checkAutoscale); horizontalLayout->addWidget(radioButtonMaxScale);
line = new QFrame(verticalLayoutWidget);
line->setObjectName("line");
line->setFrameShape(QFrame::VLine);
line->setFrameShadow(QFrame::Sunken);
horizontalLayout->addWidget(line);
radioButtonAutoscale = new QRadioButton(verticalLayoutWidget);
buttonGroup->addButton(radioButtonAutoscale);
radioButtonAutoscale->setObjectName("radioButtonAutoscale");
radioButtonAutoscale->setEnabled(true);
radioButtonAutoscale->setMouseTracking(false);
radioButtonAutoscale->setIconSize(QSize(25, 25));
radioButtonAutoscale->setChecked(false);
radioButtonAutoscale->setAutoExclusive(false);
horizontalLayout->addWidget(radioButtonAutoscale);
line_2 = new QFrame(verticalLayoutWidget);
line_2->setObjectName("line_2");
line_2->setFrameShape(QFrame::VLine);
line_2->setFrameShadow(QFrame::Sunken);
horizontalLayout->addWidget(line_2);
radioButtonFixedScale = new QRadioButton(verticalLayoutWidget);
buttonGroup->addButton(radioButtonFixedScale);
radioButtonFixedScale->setObjectName("radioButtonFixedScale");
radioButtonFixedScale->setMouseTracking(false);
radioButtonFixedScale->setText(QString::fromUtf8("Fixed Scale"));
radioButtonFixedScale->setIconSize(QSize(25, 25));
radioButtonFixedScale->setChecked(false);
radioButtonFixedScale->setAutoExclusive(false);
horizontalLayout->addWidget(radioButtonFixedScale);
spinBox_fixedmin = new QSpinBox(verticalLayoutWidget);
spinBox_fixedmin->setObjectName("spinBox_fixedmin");
spinBox_fixedmin->setMinimum(-2000);
spinBox_fixedmin->setMaximum(60000);
spinBox_fixedmin->setSingleStep(100);
spinBox_fixedmin->setValue(-2000);
horizontalLayout->addWidget(spinBox_fixedmin);
spinBox_fixedmax = new QSpinBox(verticalLayoutWidget);
spinBox_fixedmax->setObjectName("spinBox_fixedmax");
spinBox_fixedmax->setMouseTracking(true);
spinBox_fixedmax->setAutoFillBackground(true);
spinBox_fixedmax->setAccelerated(true);
spinBox_fixedmax->setMinimum(2000);
spinBox_fixedmax->setMaximum(65000);
spinBox_fixedmax->setSingleStep(100);
spinBox_fixedmax->setValue(20000);
horizontalLayout->addWidget(spinBox_fixedmax);
verticalLayout->addLayout(horizontalLayout); verticalLayout->addLayout(horizontalLayout);
QWidget::setTabOrder(radioButtonFixedScale, spinBox_fixedmin);
QWidget::setTabOrder(spinBox_fixedmin, spinBox_fixedmax);
retranslateUi(display); retranslateUi(display);
@ -79,7 +172,8 @@ public:
void retranslateUi(QDialog *display) void retranslateUi(QDialog *display)
{ {
display->setWindowTitle(QCoreApplication::translate("display", "Online Display", nullptr)); display->setWindowTitle(QCoreApplication::translate("display", "Online Display", nullptr));
checkAutoscale->setText(QCoreApplication::translate("display", "Autoscale", nullptr)); radioButtonMaxScale->setText(QCoreApplication::translate("display", "Max Scale", nullptr));
radioButtonAutoscale->setText(QCoreApplication::translate("display", "Auto-Scale", nullptr));
} // retranslateUi } // retranslateUi
}; };

View File

@ -56,7 +56,6 @@ public:
QMenuBar *menuBar; QMenuBar *menuBar;
QMenu *menuDevice; QMenu *menuDevice;
QMenu *menuSettings; QMenu *menuSettings;
QMenu *menuAuto;
QToolBar *mainToolBar; QToolBar *mainToolBar;
QStatusBar *statusBar; QStatusBar *statusBar;
@ -148,8 +147,6 @@ public:
menuDevice->setObjectName("menuDevice"); menuDevice->setObjectName("menuDevice");
menuSettings = new QMenu(menuBar); menuSettings = new QMenu(menuBar);
menuSettings->setObjectName("menuSettings"); menuSettings->setObjectName("menuSettings");
menuAuto = new QMenu(menuBar);
menuAuto->setObjectName("menuAuto");
MainWindow->setMenuBar(menuBar); MainWindow->setMenuBar(menuBar);
mainToolBar = new QToolBar(MainWindow); mainToolBar = new QToolBar(MainWindow);
mainToolBar->setObjectName("mainToolBar"); mainToolBar->setObjectName("mainToolBar");
@ -160,22 +157,13 @@ public:
menuBar->addAction(menuDevice->menuAction()); menuBar->addAction(menuDevice->menuAction());
menuBar->addAction(menuSettings->menuAction()); menuBar->addAction(menuSettings->menuAction());
menuBar->addAction(menuAuto->menuAction());
menuDevice->addAction(actionConnect); menuDevice->addAction(actionConnect);
menuDevice->addAction(actionDisconnect); menuDevice->addAction(actionDisconnect);
menuDevice->addSeparator(); menuDevice->addSeparator();
menuDevice->addAction(actionConnect_Keithley);
menuDevice->addAction(actionDisconnect_Keithley);
menuDevice->addSeparator(); menuDevice->addSeparator();
menuDevice->addAction(actionConnect_Stepper);
menuDevice->addAction(actionDisconnect_Stepper);
menuSettings->addAction(actionHost_IP); menuSettings->addAction(actionHost_IP);
menuSettings->addAction(actionDevices); menuSettings->addAction(actionDevices);
menuSettings->addAction(actionTrigger_config); menuSettings->addAction(actionTrigger_config);
menuAuto->addAction(actionLinearity_test);
menuAuto->addAction(actionIntegration_time_scan);
menuAuto->addAction(actionProfile_viewer);
menuAuto->addAction(actionBeta_Scanner);
retranslateUi(MainWindow); retranslateUi(MainWindow);
@ -205,7 +193,6 @@ public:
pushLogSettings->setText(QCoreApplication::translate("MainWindow", "Log settings...", nullptr)); pushLogSettings->setText(QCoreApplication::translate("MainWindow", "Log settings...", nullptr));
menuDevice->setTitle(QCoreApplication::translate("MainWindow", "Device", nullptr)); menuDevice->setTitle(QCoreApplication::translate("MainWindow", "Device", nullptr));
menuSettings->setTitle(QCoreApplication::translate("MainWindow", "Settings", nullptr)); menuSettings->setTitle(QCoreApplication::translate("MainWindow", "Settings", nullptr));
menuAuto->setTitle(QCoreApplication::translate("MainWindow", "Auto", nullptr));
} // retranslateUi } // retranslateUi
}; };

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 11.0.0, 2023-08-03T10:04:40. --> <!-- Written by QtCreator 11.0.0, 2023-09-06T11:43:00. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View File

@ -13,10 +13,10 @@
#define DATA_SYNC_HEADER_SIZE 6 #define DATA_SYNC_HEADER_SIZE 6
#define DATA_BYTES_PER_SAMPLE 2 #define DATA_BYTES_PER_SAMPLE 2
#define DATA_SAMPLES_PER_SENSOR 64 #define DATA_SAMPLES_PER_SENSOR 64
#define DATA_SENSORS_PER_BOARD 2 #define DATA_SENSORS_PER_BOARD 5
#define DATA_MAX_BUNCH 16 //max. product of dmaBunch * ethBunch #define DATA_MAX_BUNCH 16 //max. product of dmaBunch * ethBunch
#define DATA_RESULTS_PER_BOARD 2 #define DATA_RESULTS_PER_BOARD 0
#define DATA_BYTES_PER_RESULT 2 #define DATA_BYTES_PER_RESULT 0
#define DATA_BLOCK_SIZE (DATA_SENSORS_PER_BOARD * DATA_SAMPLES_PER_SENSOR * DATA_BYTES_PER_SAMPLE + DATA_RESULTS_PER_BOARD * DATA_BYTES_PER_RESULT ) #define DATA_BLOCK_SIZE (DATA_SENSORS_PER_BOARD * DATA_SAMPLES_PER_SENSOR * DATA_BYTES_PER_SAMPLE + DATA_RESULTS_PER_BOARD * DATA_BYTES_PER_RESULT )

View File

@ -6,6 +6,24 @@ Display::Display(QWidget *parent) :
ui(new Ui::display) ui(new Ui::display)
{ {
ui->setupUi(this); ui->setupUi(this);
// Copy/Create and initialize radio buttons
radioButtonFixedScale = ui->radioButtonFixedScale;//new QRadioButton("Fixed Scale", this);
radioButtonAutoscale = ui->radioButtonAutoscale;//new QRadioButton("Autoscale", this);
// Copy/Create and initialize the button group
buttonGroup = ui->buttonGroup;//new QButtonGroup(this);
buttonGroup->setExclusive(true); // Ensure exclusivity
// Add radio buttons to the button group
buttonGroup->addButton(ui->radioButtonFixedScale);
buttonGroup->addButton(ui->radioButtonAutoscale);
buttonGroup->addButton(ui->radioButtonMaxScale);
// Connect the buttonClicked signal of the button group
connect(buttonGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(onButtonClicked(QAbstractButton*)));
} }
Display::~Display() Display::~Display()
@ -54,9 +72,13 @@ void Display::plot(const QVector<unsigned short> &data)
if (dataY[i] > max) if (dataY[i] > max)
max = dataY[i]; max = dataY[i];
} }
if (ui->checkAutoscale->isChecked())
if (ui->radioButtonAutoscale->isChecked())
ui->plot->yAxis->setRange(min-0.05*(max-min),max+0.05*(max-min)); ui->plot->yAxis->setRange(min-0.05*(max-min),max+0.05*(max-min));
else if (ui->radioButtonFixedScale->isChecked())
ui->plot->yAxis->setRange(ui->spinBox_fixedmin->value(), ui->spinBox_fixedmax->value());
else else
ui->plot->yAxis->setRange(-1000,66000); ui->plot->yAxis->setRange(-1000,66000);
@ -76,3 +98,25 @@ void Display::setTitle(QString title)
{ {
ui->lineTitle->setText(title); ui->lineTitle->setText(title);
} }
// Slot to handle button clicks
void Display::onButtonClicked(QAbstractButton *button)
{
// Handle button clicks here
if (button == radioButtonFixedScale)
{
// Fixed Scale radio button clicked
// Handle the Fixed Scale selection
// Perform actions when Fixed Scale is selected
radioButtonFixedScale->setChecked(true); // Enable relevant controls
radioButtonAutoscale->setChecked(false); // Disable other controls
}//
else if (button == radioButtonAutoscale)
{
// Autoscale radio button clicked
// Handle the Autoscale selection
// Perform actions when Autoscale is selected
ui->radioButtonFixedScale->setChecked(false); // Disable relevant controls
ui->radioButtonAutoscale->setChecked(true); // setEnabled(true); // Enable other controls
}
}

View File

@ -3,7 +3,8 @@
#include <QDialog> #include <QDialog>
#include <QVector> #include <QVector>
#include <QRadioButton>
#include <QButtonGroup>
namespace Ui { namespace Ui {
class display; class display;
} }
@ -13,7 +14,7 @@ class Display : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit Display(QWidget *parent = 0); explicit Display(QWidget *parent = nullptr);
~Display(); ~Display();
@ -25,12 +26,16 @@ public:
public slots: public slots:
void showEvent(QShowEvent *event); void showEvent(QShowEvent *event);
void onButtonClicked(QAbstractButton *button);
protected: protected:
int nrPoints = 0; int nrPoints = 0;
QVector<double> dataX; QVector<double> dataX;
QVector<double> dataY; QVector<double> dataY;
private: private:
Ui::display *ui; Ui::display *ui;
QRadioButton *radioButtonFixedScale; // Pointer to the Fixed Scale radio button
QRadioButton *radioButtonAutoscale; // Pointer to the Autoscale radio button
QButtonGroup *buttonGroup;
}; };

View File

@ -6,36 +6,71 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>602</width> <width>603</width>
<height>360</height> <height>392</height>
</rect> </rect>
</property> </property>
<property name="palette">
<palette>
<active>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>221</red>
<green>221</green>
<blue>221</blue>
</color>
</brush>
</colorrole>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive/>
<disabled>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>85</red>
<green>85</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Online Display</string> <string>Online Display</string>
</property> </property>
<widget class="QWidget" name="verticalLayoutWidget"> <widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>9</x> <x>10</x>
<y>10</y> <y>10</y>
<width>581</width> <width>581</width>
<height>341</height> <height>371</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <property name="sizeConstraint">
<widget class="QLineEdit" name="lineTitle"> <enum>QLayout::SetDefaultConstraint</enum>
<property name="frame"> </property>
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QCustomPlot" name="plot" native="true"> <widget class="QCustomPlot" name="plot" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
@ -44,14 +79,168 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<widget class="QLineEdit" name="lineTitle">
<property name="geometry">
<rect>
<x>230</x>
<y>0</y>
<width>106</width>
<height>22</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frame">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QCheckBox" name="checkAutoscale"> <widget class="QRadioButton" name="radioButtonMaxScale">
<property name="enabled">
<bool>true</bool>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>Autoscale</string> <string>Max Scale</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonAutoscale">
<property name="enabled">
<bool>true</bool>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="text">
<string>Auto-Scale</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoExclusive">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonFixedScale">
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="text">
<string notr="true">Fixed Scale</string>
</property>
<property name="iconSize">
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoExclusive">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_fixedmin">
<property name="minimum">
<number>-2000</number>
</property>
<property name="maximum">
<number>60000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>-2000</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_fixedmax">
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
<property name="minimum">
<number>2000</number>
</property>
<property name="maximum">
<number>65000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>20000</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -68,6 +257,14 @@
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops>
<tabstop>radioButtonFixedScale</tabstop>
<tabstop>spinBox_fixedmin</tabstop>
<tabstop>spinBox_fixedmax</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
<buttongroups>
<buttongroup name="buttonGroup"/>
</buttongroups>
</ui> </ui>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 11.0.0, 2023-08-03T10:46:34. --> <!-- Written by QtCreator 11.0.0, 2023-09-06T13:15:13. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View File

@ -29,8 +29,9 @@ MainWindow::MainWindow(QWidget *parent) :
theKeithley = new keithley_thr; theKeithley = new keithley_thr;
theStepper = new Stepper; theStepper = new Stepper;
connect(&timer, QTimer::timeout, this, on_timer); //connect(&timer, QTimer::timeout, this, on_timer);
connect(theKeithley, keithley_thr::esig_newCurrentReadout, this, MainWindow::on_newCurrentReadout); connect(&timer, &QTimer::timeout, this, &MainWindow::on_timer);
// connect(theKeithley, keithley_thr::esig_newCurrentReadout, this, MainWindow::on_newCurrentReadout);
} }

View File

@ -97,11 +97,7 @@
<addaction name="actionConnect"/> <addaction name="actionConnect"/>
<addaction name="actionDisconnect"/> <addaction name="actionDisconnect"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionConnect_Keithley"/>
<addaction name="actionDisconnect_Keithley"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionConnect_Stepper"/>
<addaction name="actionDisconnect_Stepper"/>
</widget> </widget>
<widget class="QMenu" name="menuSettings"> <widget class="QMenu" name="menuSettings">
<property name="title"> <property name="title">
@ -111,18 +107,8 @@
<addaction name="actionDevices"/> <addaction name="actionDevices"/>
<addaction name="actionTrigger_config"/> <addaction name="actionTrigger_config"/>
</widget> </widget>
<widget class="QMenu" name="menuAuto">
<property name="title">
<string>Auto</string>
</property>
<addaction name="actionLinearity_test"/>
<addaction name="actionIntegration_time_scan"/>
<addaction name="actionProfile_viewer"/>
<addaction name="actionBeta_Scanner"/>
</widget>
<addaction name="menuDevice"/> <addaction name="menuDevice"/>
<addaction name="menuSettings"/> <addaction name="menuSettings"/>
<addaction name="menuAuto"/>
</widget> </widget>
<widget class="QToolBar" name="mainToolBar"> <widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea"> <attribute name="toolBarArea">

View File

@ -6,7 +6,9 @@ Q_DebugStream::Q_DebugStream(std::ostream &stream, QTextBrowser* text_edit) : m_
{ {
debugStreamHandle = this; //we can use a global variable as only one instance of QDebugStream can be active debugStreamHandle = this; //we can use a global variable as only one instance of QDebugStream can be active
displayMask = DS_INFO | DS_WARNING | DS_CRITICAL | DS_FATAL; displayMask = DS_INFO | DS_WARNING | DS_CRITICAL | DS_FATAL;
detailsMask = DS_WARNING | DS_CRITICAL | DS_FATAL; //detailsMask = DS_WARNING | DS_CRITICAL | DS_FATAL; //why not DS_INFO here too?
detailsMask = DS_CRITICAL | DS_FATAL; //why not DS_INFO here too?
log_window = text_edit; log_window = text_edit;
m_old_buf = stream.rdbuf(); m_old_buf = stream.rdbuf();
stream.rdbuf(this); stream.rdbuf(this);
@ -98,7 +100,7 @@ std::streamsize Q_DebugStream::xsputn(const char *p, std::streamsize n)
{ {
QStringList strSplitted = str.split("\n"); QStringList strSplitted = str.split("\n");
//log_window->moveCursor (QTextCursor::End); log_window->moveCursor (QTextCursor::End);
//log_window->insertPlainText (strSplitted.at(0)); //Index 0 is still on the same old line //log_window->insertPlainText (strSplitted.at(0)); //Index 0 is still on the same old line
for(int i = 0; i < strSplitted.size(); i++) for(int i = 0; i < strSplitted.size(); i++)