removed warning, updated lohmann::json, fix qt6 static assertion error

This commit is contained in:
Jan Käberich 2023-03-27 00:13:01 +02:00
parent ac2d532b0c
commit c18845fce5
10 changed files with 6784 additions and 7638 deletions

View File

@ -346,17 +346,17 @@ bool CompoundDeviceEditDialog::eventFilter(QObject *object, QEvent *event)
insertIndicator->setMaximumSize(2, frameSize); insertIndicator->setMaximumSize(2, frameSize);
insertIndicator->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); insertIndicator->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
insertIndicator->setStyleSheet("background-color:red;"); insertIndicator->setStyleSheet("background-color:red;");
updateInsertIndicator(dragEvent->pos().x()); updateInsertIndicator(dragEvent->position().toPoint().x());
return true; return true;
} }
} else if(event->type() == QEvent::DragMove) { } else if(event->type() == QEvent::DragMove) {
auto dragEvent = static_cast<QDragMoveEvent*>(event); auto dragEvent = static_cast<QDragMoveEvent*>(event);
updateInsertIndicator(dragEvent->pos().x()); updateInsertIndicator(dragEvent->position().toPoint().x());
return true; return true;
} else if(event->type() == QEvent::Drop) { } else if(event->type() == QEvent::Drop) {
auto dragEvent = static_cast<QDropEvent*>(event); auto dragEvent = static_cast<QDropEvent*>(event);
delete insertIndicator; delete insertIndicator;
addFrameAtPosition(dragEvent->pos().x(), dropFrame); addFrameAtPosition(dragEvent->position().toPoint().x(), dropFrame);
return true; return true;
} else if(event->type() == QEvent::DragLeave) { } else if(event->type() == QEvent::DragLeave) {
dropPending = false; dropPending = false;

View File

@ -200,6 +200,7 @@ bool SSA3000XDriver::setSA(const DeviceDriver::SASettings &s, std::function<void
windowName = "HAMMing"; // kaiser is not available windowName = "HAMMing"; // kaiser is not available
break; break;
case SASettings::Window::None: case SASettings::Window::None:
case SASettings::Window::Last:
windowName = "RECTangular"; windowName = "RECTangular";
break; break;
} }
@ -217,6 +218,7 @@ bool SSA3000XDriver::setSA(const DeviceDriver::SASettings &s, std::function<void
detName = "NEGative"; detName = "NEGative";
break; break;
case SASettings::Detector::PPeak: case SASettings::Detector::PPeak:
case SASettings::Detector::Last:
detName = "POSitive"; detName = "POSitive";
break; break;
case SASettings::Detector::Sample: case SASettings::Detector::Sample:
@ -287,6 +289,8 @@ QStringList SSA3000XDriver::availableExtRefOutSettings()
bool SSA3000XDriver::setExtRef(QString option_in, QString option_out) bool SSA3000XDriver::setExtRef(QString option_in, QString option_out)
{ {
Q_UNUSED(option_in)
Q_UNUSED(option_out)
return false; return false;
} }

View File

@ -10,9 +10,9 @@ template<typename T, int minUnchanged>
class TraceDifferenceGenerator { class TraceDifferenceGenerator {
public: public:
TraceDifferenceGenerator(std::function<void(const T&)> changeCallback) : TraceDifferenceGenerator(std::function<void(const T&)> changeCallback) :
nextCallbackIndex(0),
last{}, last{},
callback(changeCallback), callback(changeCallback)
nextCallbackIndex(0)
{} {}
void reset() { void reset() {

View File

@ -523,7 +523,7 @@ void TracePlot::dragEnterEvent(QDragEnterEvent *event)
void TracePlot::dropEvent(QDropEvent *event) void TracePlot::dropEvent(QDropEvent *event)
{ {
if(dropTrace) { if(dropTrace) {
traceDropped(dropTrace, event->pos() - - QPoint(marginLeft, marginTop)); traceDropped(dropTrace, event->position().toPoint() - - QPoint(marginLeft, marginTop));
} }
dropPending = false; dropPending = false;
dropTrace = nullptr; dropTrace = nullptr;

View File

@ -9,7 +9,7 @@ public:
: ptr(static_cast<void*>(ptr)), : ptr(static_cast<void*>(ptr)),
variant(QVariant(*ptr)){} variant(QVariant(*ptr)){}
void setValue(const QVariant &value) { void setValue(const QVariant &value) {
auto destType = variant.type(); auto destType = variant.metaType();
if(!value.canConvert(destType)) { if(!value.canConvert(destType)) {
throw std::runtime_error("Unable to convert QVariant to requested type"); throw std::runtime_error("Unable to convert QVariant to requested type");
} }

View File

@ -428,17 +428,17 @@ bool MatchingNetwork::eventFilter(QObject *object, QEvent *event)
insertIndicator->setMaximumSize(2, imageHeight); insertIndicator->setMaximumSize(2, imageHeight);
insertIndicator->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); insertIndicator->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
insertIndicator->setStyleSheet("background-color:red;"); insertIndicator->setStyleSheet("background-color:red;");
updateInsertIndicator(dragEvent->pos().x()); updateInsertIndicator(dragEvent->position().toPoint().x());
return true; return true;
} }
} else if(event->type() == QEvent::DragMove) { } else if(event->type() == QEvent::DragMove) {
auto dragEvent = static_cast<QDragMoveEvent*>(event); auto dragEvent = static_cast<QDragMoveEvent*>(event);
updateInsertIndicator(dragEvent->pos().x()); updateInsertIndicator(dragEvent->position().toPoint().x());
return true; return true;
} else if(event->type() == QEvent::Drop) { } else if(event->type() == QEvent::Drop) {
auto dragEvent = static_cast<QDropEvent*>(event); auto dragEvent = static_cast<QDropEvent*>(event);
delete insertIndicator; delete insertIndicator;
addComponentAtPosition(dragEvent->pos().x(), dropComponent); addComponentAtPosition(dragEvent->position().toPoint().x(), dropComponent);
return true; return true;
} else if(event->type() == QEvent::DragLeave) { } else if(event->type() == QEvent::DragLeave) {
dropPending = false; dropPending = false;

View File

@ -1,6 +1,7 @@
#ifndef APPWINDOW_H #ifndef APPWINDOW_H
#define APPWINDOW_H #define APPWINDOW_H
#include "json.hpp"
#include "Traces/traceplot.h" #include "Traces/traceplot.h"
#include "Traces/tracemodel.h" #include "Traces/tracemodel.h"
#include "Traces/Marker/markermodel.h" #include "Traces/Marker/markermodel.h"
@ -66,11 +67,11 @@ private slots:
void DeviceStatusUpdated(); void DeviceStatusUpdated();
void DeviceFlagsUpdated(); void DeviceFlagsUpdated();
void DeviceInfoUpdated(); void DeviceInfoUpdated();
nlohmann::json SaveSetup();
void SaveSetup(QString filename); void SaveSetup(QString filename);
void LoadSetup(QString filename); void LoadSetup(QString filename);
void LoadSetup(nlohmann::json j);
private: private:
nlohmann::json SaveSetup();
void LoadSetup(nlohmann::json j);
enum class DeviceStatusBar { enum class DeviceStatusBar {
Connected, Connected,

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,7 @@ public:
} }
// json library does not now about QVariant, handle used cases // json library does not now about QVariant, handle used cases
auto val = e.var.value(); auto val = e.var.value();
switch(static_cast<QMetaType::Type>(val.type())) { switch(val.metaType().id()) {
case QMetaType::Double: e.var.setValue((*json_entry).get<double>()); break; case QMetaType::Double: e.var.setValue((*json_entry).get<double>()); break;
case QMetaType::Int: e.var.setValue((*json_entry).get<int>()); break; case QMetaType::Int: e.var.setValue((*json_entry).get<int>()); break;
case QMetaType::UInt: e.var.setValue((*json_entry).get<unsigned int>()); break; case QMetaType::UInt: e.var.setValue((*json_entry).get<unsigned int>()); break;
@ -80,7 +80,7 @@ public:
} }
// json library does not now about QVariant, handle used cases // json library does not now about QVariant, handle used cases
auto val = e.var.value(); auto val = e.var.value();
switch(static_cast<QMetaType::Type>(val.type())) { switch(val.metaType().id()) {
case QMetaType::Double: *json_entry = val.toDouble(); break; case QMetaType::Double: *json_entry = val.toDouble(); break;
case QMetaType::Int: *json_entry = val.toInt(); break; case QMetaType::Int: *json_entry = val.toInt(); break;
case QMetaType::UInt: *json_entry = val.toUInt(); break; case QMetaType::UInt: *json_entry = val.toUInt(); break;

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH export LD_LIBRARY_PATH
QT_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH} QT_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt6/plugins${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}
export QT_PLUGIN_PATH export QT_PLUGIN_PATH
exec "$@" exec "$@"