Merge branch 'qt6'

This commit is contained in:
Jan Käberich 2023-03-28 11:54:20 +02:00
commit 50dd9e6002
30 changed files with 6857 additions and 7706 deletions

View File

@ -10,14 +10,15 @@ on:
jobs: jobs:
PC_Application_Ubuntu: PC_Application_Ubuntu:
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y libusb-1.0-0-dev qt5-default qt5-qmake qtbase5-dev sudo apt-get install -y libusb-1.0-0-dev qt6-tools-dev qt6-base-dev
qtchooser -install qt6 $(which qmake6)
- name: Get build timestamp - name: Get build timestamp
id: id_date id: id_date
@ -35,6 +36,7 @@ jobs:
- name: Build application - name: Build application
run: | run: |
cd Software/PC_Application/LibreVNA-GUI cd Software/PC_Application/LibreVNA-GUI
export QT_SELECT=qt6
qmake LibreVNA-GUI.pro qmake LibreVNA-GUI.pro
make -j9 make -j9
shell: bash shell: bash
@ -56,14 +58,14 @@ jobs:
- name: Install Qt - name: Install Qt
uses: jurplel/install-qt-action@v2 uses: jurplel/install-qt-action@v2
with: with:
version: '5.15.2' version: '6.2.0'
arch: 'win64_mingw81' arch: 'win64_mingw81'
- name: Download libusb - name: Download libusb
run: | run: |
curl -o libusb.7z -L https://github.com/libusb/libusb/releases/download/v1.0.25/libusb-1.0.25.7z curl -o libusb.7z -L https://github.com/libusb/libusb/releases/download/v1.0.25/libusb-1.0.25.7z
7z x libusb.7z -r -olibusb 7z x libusb.7z -r -olibusb
Xcopy /E /I /Y libusb\include ..\Qt\5.15.2\mingw81_64\include Xcopy /E /I /Y libusb\include ..\Qt\6.2.0\mingw81_64\include
Xcopy /E /I /Y libusb\MinGW64\static\libusb-1.0.a Software\PC_Application\LibreVNA-GUI Xcopy /E /I /Y libusb\MinGW64\static\libusb-1.0.a Software\PC_Application\LibreVNA-GUI
shell: cmd shell: cmd
@ -94,10 +96,10 @@ jobs:
cd Software/PC_Application/LibreVNA-GUI/release cd Software/PC_Application/LibreVNA-GUI/release
del *.o *.cpp del *.o *.cpp
windeployqt.exe . windeployqt.exe .
copy ..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\libwinpthread-1.dll . copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libwinpthread-1.dll .
copy ..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\libgcc_s_seh-1.dll . copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libgcc_s_seh-1.dll .
copy "..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\libstdc++-6.dll" . copy "..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libstdc++-6.dll" .
copy ..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\Qt5OpenGL.dll . copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\Qt6OpenGL.dll .
shell: cmd shell: cmd
- name: Upload - name: Upload
@ -115,11 +117,11 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
brew install qt@5 libusb pcre brew install qt@6 libusb pcre
- name: Set Environment - name: Set Environment
run: | run: |
echo "/usr/local/opt/qt@5/bin" >> $GITHUB_PATH echo "/usr/local/opt/qt@6/bin" >> $GITHUB_PATH
- name: Get build timestamp - name: Get build timestamp
id: id_date id: id_date

View File

@ -8,7 +8,7 @@ on:
jobs: jobs:
PC_Application_Ubuntu: PC_Application_Ubuntu:
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
outputs: outputs:
upload_url: ${{ steps.bump_release.outputs.upload_url }} upload_url: ${{ steps.bump_release.outputs.upload_url }}
steps: steps:
@ -17,7 +17,8 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y libusb-1.0-0-dev qt5-default qt5-qmake qtbase5-dev zip sudo apt-get install -y libusb-1.0-0-dev qt6-tools-dev qt6-base-dev zip
qtchooser -install qt6 $(which qmake6)
- name: Get app version - name: Get app version
id: id_version id: id_version
@ -31,6 +32,7 @@ jobs:
- name: Build application - name: Build application
run: | run: |
cd Software/PC_Application/LibreVNA-GUI cd Software/PC_Application/LibreVNA-GUI
export QT_SELECT=qt6
qmake LibreVNA-GUI.pro qmake LibreVNA-GUI.pro
make -j9 make -j9
zip LibreVNA-GUI.zip LibreVNA-GUI zip LibreVNA-GUI.zip LibreVNA-GUI
@ -71,14 +73,14 @@ jobs:
- name: Install Qt - name: Install Qt
uses: jurplel/install-qt-action@v2 uses: jurplel/install-qt-action@v2
with: with:
version: '5.15.2' version: '6.2.0'
arch: 'win64_mingw81' arch: 'win64_mingw81'
- name: Download libusb - name: Download libusb
run: | run: |
curl -o libusb.7z -L https://github.com/libusb/libusb/releases/download/v1.0.25/libusb-1.0.25.7z curl -o libusb.7z -L https://github.com/libusb/libusb/releases/download/v1.0.25/libusb-1.0.25.7z
7z x libusb.7z -r -olibusb 7z x libusb.7z -r -olibusb
Xcopy /E /I /Y libusb\include ..\Qt\5.15.2\mingw81_64\include Xcopy /E /I /Y libusb\include ..\Qt\6.2.0\mingw81_64\include
Xcopy /E /I /Y libusb\MinGW64\static\libusb-1.0.a Software\PC_Application\LibreVNA-GUI Xcopy /E /I /Y libusb\MinGW64\static\libusb-1.0.a Software\PC_Application\LibreVNA-GUI
shell: cmd shell: cmd
@ -104,10 +106,10 @@ jobs:
cd Software/PC_Application/LibreVNA-GUI/release cd Software/PC_Application/LibreVNA-GUI/release
del *.o *.cpp del *.o *.cpp
windeployqt.exe . windeployqt.exe .
copy ..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\libwinpthread-1.dll . copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libwinpthread-1.dll .
copy ..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\libgcc_s_seh-1.dll . copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libgcc_s_seh-1.dll .
copy "..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\libstdc++-6.dll" . copy "..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libstdc++-6.dll" .
copy ..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\Qt5OpenGL.dll . copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\Qt6OpenGL.dll .
shell: cmd shell: cmd
- name: Zip app - name: Zip app
@ -136,11 +138,11 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
brew install qt@5 libusb pcre brew install qt@6 libusb pcre
- name: Set Environment - name: Set Environment
run: | run: |
echo "/usr/local/opt/qt@5/bin" >> $GITHUB_PATH echo "/usr/local/opt/qt@6/bin" >> $GITHUB_PATH
- name: Get app version - name: Get app version
id: id_version id: id_version

View File

@ -12,7 +12,7 @@ Creating all the different parts from the source code requires quite a few tools
## Building the PC application: ## Building the PC application:
* Install the required tools (Qt and libusb-1.0): * Install the required tools (Qt and libusb-1.0):
``` ```
sudo apt-get install qt5-default qt5-qmake qtbase5-dev libusb-1.0-0-dev sudo apt-get install libusb-1.0-0-dev qt6-tools-dev qt6-base-dev
``` ```
* Build the application: * Build the application:
* either: * either:

View File

@ -17,7 +17,7 @@ This is the improved version of my [first attempt](https://www.github.com/jankae
* Download the latest [Release](https://github.com/jankae/LibreVNA/releases) and unpack the zip file * Download the latest [Release](https://github.com/jankae/LibreVNA/releases) and unpack the zip file
* Install the required libraries: * Install the required libraries:
```console ```console
sudo apt install libqt5widgets5 sudo apt install libqt6widgets6
``` ```
* Install the udev rule (otherwise you don't have the permissions to access the USB device): * Install the udev rule (otherwise you don't have the permissions to access the USB device):
```console ```console

View File

@ -64,7 +64,7 @@ USBDevice::USBDevice(QString serial)
libusb_exit(m_context); libusb_exit(m_context);
throw std::runtime_error(message.toStdString()); throw std::runtime_error(message.toStdString());
} }
qInfo() << "USB connection established" << flush; qInfo() << "USB connection established" << Qt::flush;
} }
USBDevice::~USBDevice() USBDevice::~USBDevice()

View File

@ -124,7 +124,7 @@ QWidget *CalibrationMeasurement::Base::createStandardWidget()
{ {
auto cbStandard = new QComboBox(); auto cbStandard = new QComboBox();
for(auto s : supportedStandards()) { for(auto s : supportedStandards()) {
cbStandard->addItem(s->getDescription(), qVariantFromValue((void*) s)); cbStandard->addItem(s->getDescription(), QVariant::fromValue((void*) s));
if(standard == s) { if(standard == s) {
cbStandard->setCurrentText(s->getDescription()); cbStandard->setCurrentText(s->getDescription());
} }
@ -232,10 +232,10 @@ QTableWidgetItem *CalibrationMeasurement::OnePort::getStatisticsItem()
auto ret = Base::getStatisticsItem(); auto ret = Base::getStatisticsItem();
if(numPoints() > 0) { if(numPoints() > 0) {
if(!standard) { if(!standard) {
ret->setBackgroundColor(Qt::red); ret->setBackground(Qt::red);
ret->setToolTip("No calibration standard assigned, unable to use this measurement"); ret->setToolTip("No calibration standard assigned, unable to use this measurement");
} else if(standard->minFrequency() > points.front().frequency || standard->maxFrequency() < points.back().frequency) { } else if(standard->minFrequency() > points.front().frequency || standard->maxFrequency() < points.back().frequency) {
ret->setBackgroundColor(Qt::yellow); ret->setBackground(Qt::yellow);
ret->setToolTip("Usable frequency range constrained by calibration standard to "+Unit::ToString(minUsableFreq(), "Hz", " kMG", 4)+" - "+Unit::ToString(maxUsableFreq(), "Hz", " kMG", 4)); ret->setToolTip("Usable frequency range constrained by calibration standard to "+Unit::ToString(minUsableFreq(), "Hz", " kMG", 4)+" - "+Unit::ToString(maxUsableFreq(), "Hz", " kMG", 4));
} }
} }
@ -391,10 +391,10 @@ QTableWidgetItem *CalibrationMeasurement::TwoPort::getStatisticsItem()
auto ret = Base::getStatisticsItem(); auto ret = Base::getStatisticsItem();
if(numPoints() > 0) { if(numPoints() > 0) {
if(!standard) { if(!standard) {
ret->setBackgroundColor(Qt::red); ret->setBackground(Qt::red);
ret->setToolTip("No calibration standard assigned, unable to use this measurement"); ret->setToolTip("No calibration standard assigned, unable to use this measurement");
} else if(standard->minFrequency() > points.front().frequency || standard->maxFrequency() < points.back().frequency) { } else if(standard->minFrequency() > points.front().frequency || standard->maxFrequency() < points.back().frequency) {
ret->setBackgroundColor(Qt::yellow); ret->setBackground(Qt::yellow);
ret->setToolTip("Usable frequency range constrained by calibration standard to "+Unit::ToString(minUsableFreq(), "Hz", " kMG", 4)+" - "+Unit::ToString(maxUsableFreq(), "Hz", " kMG", 4)); ret->setToolTip("Usable frequency range constrained by calibration standard to "+Unit::ToString(minUsableFreq(), "Hz", " kMG", 4)+" - "+Unit::ToString(maxUsableFreq(), "Hz", " kMG", 4));
} }
} }

View File

@ -70,7 +70,7 @@ bool SIUnitEdit::eventFilter(QObject *, QEvent *event)
key = tolower(key); key = tolower(key);
} }
if(key <= 255) { if(key <= 255) {
if (prefixes.indexOf(key) >= 0) { if (prefixes.indexOf(static_cast<QChar>(key)) >= 0) {
// a valid prefix key was pressed // a valid prefix key was pressed
parseNewValue(Unit::SIPrefixToFactor(key)); parseNewValue(Unit::SIPrefixToFactor(key));
continueEditing(); continueEditing();

View File

@ -29,10 +29,10 @@ TouchstoneImport::TouchstoneImport(QWidget *parent, int ports) :
ui->port2Group->setId(ui->port2_3, 2); ui->port2Group->setId(ui->port2_3, 2);
ui->port2Group->setId(ui->port2_4, 3); ui->port2Group->setId(ui->port2_4, 3);
// prevent selection of same port for port1 and 2 // prevent selection of same port for port1 and 2
connect(ui->port1Group, qOverload<int>(&QButtonGroup::buttonClicked), [=](int id) { connect(ui->port1Group, qOverload<int>(&QButtonGroup::idClicked), [=](int id) {
preventCollisionWithGroup(ui->port2Group, id); preventCollisionWithGroup(ui->port2Group, id);
}); });
connect(ui->port2Group, qOverload<int>(&QButtonGroup::buttonClicked), [=](int id) { connect(ui->port2Group, qOverload<int>(&QButtonGroup::idClicked), [=](int id) {
preventCollisionWithGroup(ui->port1Group, id); preventCollisionWithGroup(ui->port1Group, id);
}); });
connect(ui->file, &QLineEdit::textChanged, this, &TouchstoneImport::setFile); connect(ui->file, &QLineEdit::textChanged, this, &TouchstoneImport::setFile);

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

@ -437,11 +437,13 @@ QStringList CompoundDriver::availableExtRefInSettings()
if(!connected) { if(!connected) {
return QStringList(); return QStringList();
} }
auto set = devices[0]->availableExtRefInSettings().toSet(); auto list = devices[0]->availableExtRefInSettings();
QSet<QString> set(list.begin(), list.end());
for(unsigned int i=1;i<devices.size();i++) { for(unsigned int i=1;i<devices.size();i++) {
set = set.intersect(devices[i]->availableExtRefInSettings().toSet()); list = devices[i]->availableExtRefInSettings();
set = set.intersect({list.begin(), list.end()});
} }
return QStringList(set.toList()); return QStringList(set.begin(), set.end());
} }
QStringList CompoundDriver::availableExtRefOutSettings() QStringList CompoundDriver::availableExtRefOutSettings()
@ -449,11 +451,13 @@ QStringList CompoundDriver::availableExtRefOutSettings()
if(!connected) { if(!connected) {
return QStringList(); return QStringList();
} }
auto set = devices[0]->availableExtRefOutSettings().toSet(); auto list = devices[0]->availableExtRefOutSettings();
QSet<QString> set(list.begin(), list.end());
for(unsigned int i=1;i<devices.size();i++) { for(unsigned int i=1;i<devices.size();i++) {
set = set.intersect(devices[i]->availableExtRefOutSettings().toSet()); list = devices[i]->availableExtRefOutSettings();
set = set.intersect({list.begin(), list.end()});
} }
return QStringList(set.toList()); return QStringList(set.begin(), set.end());
} }
bool CompoundDriver::setExtRef(QString option_in, QString option_out) bool CompoundDriver::setExtRef(QString option_in, QString option_out)

View File

@ -66,7 +66,7 @@ std::set<QString> LibreVNATCPDriver::GetAvailableDevices()
"MAN: \"ssdp:discover\"\r\n" "MAN: \"ssdp:discover\"\r\n"
"MX: 1\r\n" "MX: 1\r\n"
"ST: "); "ST: ");
data.append(service_name); data.append(service_name.toUtf8());
data.append("\r\n" data.append("\r\n"
"\r\n"); "\r\n");
@ -125,10 +125,10 @@ bool LibreVNATCPDriver::connectTo(QString serial)
// sockets are connected now // sockets are connected now
dataBuffer.clear(); dataBuffer.clear();
logBuffer.clear(); logBuffer.clear();
connect(&dataSocket, qOverload<QAbstractSocket::SocketError>(&QTcpSocket::error), this, &LibreVNATCPDriver::ConnectionLost, Qt::QueuedConnection); connect(&dataSocket, qOverload<QAbstractSocket::SocketError>(&QTcpSocket::errorOccurred), this, &LibreVNATCPDriver::ConnectionLost, Qt::QueuedConnection);
connect(&logSocket, qOverload<QAbstractSocket::SocketError>(&QTcpSocket::error), this, &LibreVNATCPDriver::ConnectionLost, Qt::QueuedConnection); connect(&logSocket, qOverload<QAbstractSocket::SocketError>(&QTcpSocket::errorOccurred), this, &LibreVNATCPDriver::ConnectionLost, Qt::QueuedConnection);
qInfo() << "TCP connection established" << flush; qInfo() << "TCP connection established" << Qt::flush;
this->serial = serial; this->serial = serial;
connected = true; connected = true;

View File

@ -211,7 +211,7 @@ bool LibreVNAUSBDriver::connectTo(QString serial)
libusb_exit(m_context); libusb_exit(m_context);
throw std::runtime_error(message.toStdString()); throw std::runtime_error(message.toStdString());
} }
qInfo() << "USB connection established" << flush; qInfo() << "USB connection established" << Qt::flush;
connected = true; connected = true;
m_receiveThread = new std::thread(&LibreVNAUSBDriver::USBHandleThread, this); m_receiveThread = new std::thread(&LibreVNAUSBDriver::USBHandleThread, this);
dataBuffer = new USBInBuffer(m_handle, EP_Data_In_Addr, 65536); dataBuffer = new USBInBuffer(m_handle, EP_Data_In_Addr, 65536);

View File

@ -87,7 +87,7 @@ ManualControlDialogV1::ManualControlDialogV1(LibreVNADriver &dev, QWidget *paren
connect(ui->LO2Frequency, &SIUnitEdit::valueChanged, [=](double) { connect(ui->LO2Frequency, &SIUnitEdit::valueChanged, [=](double) {
UpdateLO2(); UpdateLO2();
}); });
connect(ui->SourceSwitchGroup, qOverload<int, bool>(&QButtonGroup::buttonToggled), [=](int, bool) { connect(ui->SourceSwitchGroup, qOverload<int, bool>(&QButtonGroup::idToggled), [=](int, bool) {
UpdateLO1(); UpdateLO1();
UpdateLO2(); UpdateLO2();
}); });
@ -179,8 +179,8 @@ ManualControlDialogV1::ManualControlDialogV1(LibreVNADriver &dev, QWidget *paren
connect(ui->LO2Frequency, &SIUnitEdit::valueChanged, [=](double) { UpdateDevice(); }); connect(ui->LO2Frequency, &SIUnitEdit::valueChanged, [=](double) { UpdateDevice(); });
connect(ui->IF2, &SIUnitEdit::valueChanged, [=](double) { UpdateDevice(); }); connect(ui->IF2, &SIUnitEdit::valueChanged, [=](double) { UpdateDevice(); });
connect(ui->PortSwitchGroup, qOverload<int, bool>(&QButtonGroup::buttonToggled), [=](int, bool) { UpdateDevice(); }); connect(ui->PortSwitchGroup, qOverload<int, bool>(&QButtonGroup::idToggled), [=](int, bool) { UpdateDevice(); });
connect(ui->SourceSwitchGroup, qOverload<int, bool>(&QButtonGroup::buttonToggled), [=](int, bool) { UpdateDevice(); }); connect(ui->SourceSwitchGroup, qOverload<int, bool>(&QButtonGroup::idToggled), [=](int, bool) { UpdateDevice(); });
connect(ui->Attenuator, qOverload<double>(&QDoubleSpinBox::valueChanged), [=](double) { UpdateDevice(); }); connect(ui->Attenuator, qOverload<double>(&QDoubleSpinBox::valueChanged), [=](double) { UpdateDevice(); });
connect(ui->Samples, qOverload<int>(&QSpinBox::valueChanged), [=](double) { UpdateDevice(); }); connect(ui->Samples, qOverload<int>(&QSpinBox::valueChanged), [=](double) { UpdateDevice(); });

View File

@ -90,7 +90,7 @@ bool SSA3000XDriver::connectTo(QString serial)
return false; return false;
} }
connect(&dataSocket, qOverload<QAbstractSocket::SocketError>(&QTcpSocket::error), this, &SSA3000XDriver::ConnectionLost, Qt::QueuedConnection); connect(&dataSocket, qOverload<QAbstractSocket::SocketError>(&QTcpSocket::errorOccurred), this, &SSA3000XDriver::ConnectionLost, Qt::QueuedConnection);
// grab model information // grab model information
dataSocket.write("*IDN?\r\n"); dataSocket.write("*IDN?\r\n");
@ -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

@ -16,7 +16,6 @@
#include "Generator/signalgenwidget.h" #include "Generator/signalgenwidget.h"
#include <QDockWidget> #include <QDockWidget>
#include <QDesktopWidget>
#include <QApplication> #include <QApplication>
#include <QActionGroup> #include <QActionGroup>
#include "CustomWidgets/informationbox.h" #include "CustomWidgets/informationbox.h"
@ -113,7 +112,7 @@ SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window, QString name)
auto eStart = new SIUnitEdit("Hz", " kMG", 6); auto eStart = new SIUnitEdit("Hz", " kMG", 6);
// calculate width required with expected string length // calculate width required with expected string length
auto width = QFontMetrics(eStart->font()).width("3.00000GHz") + 15; auto width = QFontMetrics(eStart->font()).horizontalAdvance("3.00000GHz") + 15;
eStart->setFixedWidth(width); eStart->setFixedWidth(width);
eStart->setToolTip("Start frequency"); eStart->setToolTip("Start frequency");
connect(eStart, &SIUnitEdit::valueChanged, this, &SpectrumAnalyzer::SetStartFreq); connect(eStart, &SIUnitEdit::valueChanged, this, &SpectrumAnalyzer::SetStartFreq);

View File

@ -33,11 +33,11 @@ ImpedanceMatchDialog::ImpedanceMatchDialog(MarkerModel &model, Marker *marker, Q
connect(ui->zFreq, &SIUnitEdit::valueChanged, this, &ImpedanceMatchDialog::calculateMatch); connect(ui->zFreq, &SIUnitEdit::valueChanged, this, &ImpedanceMatchDialog::calculateMatch);
connect(ui->zImag, &SIUnitEdit::valueChanged, this, &ImpedanceMatchDialog::calculateMatch); connect(ui->zImag, &SIUnitEdit::valueChanged, this, &ImpedanceMatchDialog::calculateMatch);
connect(ui->zReal, &SIUnitEdit::valueChanged, this, &ImpedanceMatchDialog::calculateMatch); connect(ui->zReal, &SIUnitEdit::valueChanged, this, &ImpedanceMatchDialog::calculateMatch);
connect(ui->zGroup, qOverload<int>(&QButtonGroup::buttonClicked), this, &ImpedanceMatchDialog::calculateMatch); connect(ui->zGroup, qOverload<int>(&QButtonGroup::idClicked), this, &ImpedanceMatchDialog::calculateMatch);
connect(ui->cMatchType, qOverload<int>(&QComboBox::currentIndexChanged), this, &ImpedanceMatchDialog::calculateMatch); connect(ui->cMatchType, qOverload<int>(&QComboBox::currentIndexChanged), this, &ImpedanceMatchDialog::calculateMatch);
connect(ui->lGroup, qOverload<int>(&QButtonGroup::buttonClicked), this, &ImpedanceMatchDialog::calculateMatch); connect(ui->lGroup, qOverload<int>(&QButtonGroup::idClicked), this, &ImpedanceMatchDialog::calculateMatch);
connect(ui->cGroup, qOverload<int>(&QButtonGroup::buttonClicked), this, &ImpedanceMatchDialog::calculateMatch); connect(ui->cGroup, qOverload<int>(&QButtonGroup::idClicked), this, &ImpedanceMatchDialog::calculateMatch);
connect(ui->zGroup, qOverload<int>(&QButtonGroup::buttonClicked), this, &ImpedanceMatchDialog::calculateMatch); connect(ui->zGroup, qOverload<int>(&QButtonGroup::idClicked), this, &ImpedanceMatchDialog::calculateMatch);
// populate marker options // populate marker options
auto markers = model.getMarkers(); auto markers = model.getMarkers();

View File

@ -1473,7 +1473,6 @@ QWidget *Marker::getTypeEditor(QAbstractItemDelegate *delegate)
layout->addWidget(c); layout->addWidget(c);
c->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); c->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layout->setContentsMargins(0,0,0,0); layout->setContentsMargins(0,0,0,0);
layout->setMargin(0);
layout->setSpacing(0); layout->setSpacing(0);
layout->addWidget(new QLabel("to")); layout->addWidget(new QLabel("to"));
auto deltaChooser = new QComboBox; auto deltaChooser = new QComboBox;

View File

@ -413,11 +413,12 @@ void TracePlot::leaveEvent(QEvent *event)
void TracePlot::wheelEvent(QWheelEvent *event) void TracePlot::wheelEvent(QWheelEvent *event)
{ {
auto &pref = Preferences::getInstance(); auto &pref = Preferences::getInstance();
if(pref.Graphs.enablePanAndZoom && positionWithinGraphArea(event->pos())) { QPoint position(event->position().x(), event->position().y());
if(pref.Graphs.enablePanAndZoom && positionWithinGraphArea(position)) {
bool horizontally = !(QApplication::keyboardModifiers() & Qt::ShiftModifier); bool horizontally = !(QApplication::keyboardModifiers() & Qt::ShiftModifier);
bool vertically = !(QApplication::keyboardModifiers() & Qt::ControlModifier); bool vertically = !(QApplication::keyboardModifiers() & Qt::ControlModifier);
double factor = pow(pref.Graphs.zoomFactor, (double) event->angleDelta().y() / 120.0); double factor = pow(pref.Graphs.zoomFactor, (double) event->angleDelta().y() / 120.0);
zoom(event->pos(), factor, horizontally, vertically); zoom(position, factor, horizontally, vertically);
event->accept(); event->accept();
} }
} }
@ -522,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

@ -13,6 +13,7 @@
#include <math.h> #include <math.h>
#include <QDebug> #include <QDebug>
#include <QColorDialog> #include <QColorDialog>
#include <QActionGroup>
using namespace std; using namespace std;
@ -755,7 +756,7 @@ QVariant SmithChartContantLineModel::data(const QModelIndex &index, int role) co
auto line = chart.constantLines[index.row()]; auto line = chart.constantLines[index.row()];
switch(index.column()) { switch(index.column()) {
case ColIndexColor: case ColIndexColor:
if (role == Qt::BackgroundColorRole) { if (role == Qt::BackgroundRole) {
return line.getColor(); return line.getColor();
} }
break; break;

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");
} }
@ -19,7 +19,7 @@ public:
mt.construct(ptr, variant.constData()); mt.construct(ptr, variant.constData());
} }
QVariant value() { QVariant value() {
return QVariant(variant.type(), ptr); return QVariant(variant.metaType(), ptr);
} }
void* getPtr(){return ptr;} void* getPtr(){return ptr;}
private: private:

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

@ -44,7 +44,6 @@
#include <QDateTime> #include <QDateTime>
#include <QDockWidget> #include <QDockWidget>
#include <queue> #include <queue>
#include <QDesktopWidget>
#include <QApplication> #include <QApplication>
#include <QActionGroup> #include <QActionGroup>
#include <QErrorMessage> #include <QErrorMessage>
@ -276,7 +275,7 @@ VNA::VNA(AppWindow *window, QString name)
auto eStart = new SIUnitEdit("Hz", " kMG", 6); auto eStart = new SIUnitEdit("Hz", " kMG", 6);
// calculate width required with expected string length // calculate width required with expected string length
auto width = QFontMetrics(eStart->font()).width("3.00000GHz") + 15; auto width = QFontMetrics(eStart->font()).horizontalAdvance("3.00000GHz") + 15;
eStart->setFixedWidth(width); eStart->setFixedWidth(width);
eStart->setToolTip("Start frequency"); eStart->setToolTip("Start frequency");
connect(eStart, &SIUnitEdit::valueChanged, this, &VNA::SetStartFreq); connect(eStart, &SIUnitEdit::valueChanged, this, &VNA::SetStartFreq);
@ -338,7 +337,7 @@ VNA::VNA(AppWindow *window, QString name)
// power sweep widgets // power sweep widgets
auto sbPowerLow = new QDoubleSpinBox(); auto sbPowerLow = new QDoubleSpinBox();
width = QFontMetrics(sbPowerLow->font()).width("-30.00dBm") + 20; width = QFontMetrics(sbPowerLow->font()).horizontalAdvance("-30.00dBm") + 20;
sbPowerLow->setFixedWidth(width); sbPowerLow->setFixedWidth(width);
sbPowerLow->setRange(-100.0, 100.0); sbPowerLow->setRange(-100.0, 100.0);
sbPowerLow->setSingleStep(0.25); sbPowerLow->setSingleStep(0.25);
@ -351,7 +350,7 @@ VNA::VNA(AppWindow *window, QString name)
powerSweepActions.push_back(tb_sweep->addWidget(sbPowerLow)); powerSweepActions.push_back(tb_sweep->addWidget(sbPowerLow));
auto sbPowerHigh = new QDoubleSpinBox(); auto sbPowerHigh = new QDoubleSpinBox();
width = QFontMetrics(sbPowerHigh->font()).width("-30.00dBm") + 20; width = QFontMetrics(sbPowerHigh->font()).horizontalAdvance("-30.00dBm") + 20;
sbPowerHigh->setFixedWidth(width); sbPowerHigh->setFixedWidth(width);
sbPowerHigh->setRange(-100.0, 100.0); sbPowerHigh->setRange(-100.0, 100.0);
sbPowerHigh->setSingleStep(0.25); sbPowerHigh->setSingleStep(0.25);
@ -364,7 +363,7 @@ VNA::VNA(AppWindow *window, QString name)
powerSweepActions.push_back(tb_sweep->addWidget(sbPowerHigh)); powerSweepActions.push_back(tb_sweep->addWidget(sbPowerHigh));
auto ePowerFreq = new SIUnitEdit("Hz", " kMG", 6); auto ePowerFreq = new SIUnitEdit("Hz", " kMG", 6);
width = QFontMetrics(ePowerFreq->font()).width("3.00000GHz") + 15; width = QFontMetrics(ePowerFreq->font()).horizontalAdvance("3.00000GHz") + 15;
ePowerFreq->setFixedWidth(width); ePowerFreq->setFixedWidth(width);
ePowerFreq->setToolTip("Start frequency"); ePowerFreq->setToolTip("Start frequency");
connect(ePowerFreq, &SIUnitEdit::valueChanged, this, &VNA::SetPowerSweepFrequency); connect(ePowerFreq, &SIUnitEdit::valueChanged, this, &VNA::SetPowerSweepFrequency);
@ -378,7 +377,7 @@ VNA::VNA(AppWindow *window, QString name)
// Acquisition toolbar // Acquisition toolbar
auto tb_acq = new QToolBar("Acquisition"); auto tb_acq = new QToolBar("Acquisition");
auto dbm = new QDoubleSpinBox(); auto dbm = new QDoubleSpinBox();
width = QFontMetrics(dbm->font()).width("-30.00dBm") + 20; width = QFontMetrics(dbm->font()).horizontalAdvance("-30.00dBm") + 20;
dbm->setFixedWidth(width); dbm->setFixedWidth(width);
dbm->setRange(-100.0, 100.0); dbm->setRange(-100.0, 100.0);
dbm->setSingleStep(0.25); dbm->setSingleStep(0.25);

View File

@ -27,7 +27,6 @@
#include "Device/LibreVNA/librevnatcpdriver.h" #include "Device/LibreVNA/librevnatcpdriver.h"
#include <QDockWidget> #include <QDockWidget>
#include <QDesktopWidget>
#include <QApplication> #include <QApplication>
#include <QActionGroup> #include <QActionGroup>
#include <QDebug> #include <QDebug>

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

@ -38,7 +38,6 @@ void ModeWindow::SetupUi()
auto cornerWidget = new QWidget(); auto cornerWidget = new QWidget();
cornerWidget->setLayout(new QHBoxLayout); cornerWidget->setLayout(new QHBoxLayout);
cornerWidget->layout()->setSpacing(0); cornerWidget->layout()->setSpacing(0);
cornerWidget->layout()->setMargin(0);
cornerWidget->layout()->setContentsMargins(0,0,0,0); cornerWidget->layout()->setContentsMargins(0,0,0,0);
cornerWidget->setMaximumHeight(aw->menuBar()->height()); cornerWidget->setMaximumHeight(aw->menuBar()->height());

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,10 +1,10 @@
@echo off @echo off
SetLocal EnableDelayedExpansion SetLocal EnableDelayedExpansion
(set PATH=C:\Qt\5.15.2\mingw81_64\bin;!PATH!) (set PATH=C:\Qt\6.2.4\mingw_64\bin;!PATH!)
if defined QT_PLUGIN_PATH ( if defined QT_PLUGIN_PATH (
set QT_PLUGIN_PATH=C:\Qt\5.15.2\mingw81_64\plugins;!QT_PLUGIN_PATH! set QT_PLUGIN_PATH=C:\Qt\6.2.4\mingw_64\plugins;!QT_PLUGIN_PATH!
) else ( ) else (
set QT_PLUGIN_PATH=C:\Qt\5.15.2\mingw81_64\plugins set QT_PLUGIN_PATH=C:\Qt\6.2.4\mingw_64\plugins
) )
%* %*
EndLocal EndLocal

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 "$@"