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:
PC_Application_Ubuntu:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: |
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
id: id_date
@ -35,6 +36,7 @@ jobs:
- name: Build application
run: |
cd Software/PC_Application/LibreVNA-GUI
export QT_SELECT=qt6
qmake LibreVNA-GUI.pro
make -j9
shell: bash
@ -56,14 +58,14 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: '5.15.2'
version: '6.2.0'
arch: 'win64_mingw81'
- name: Download libusb
run: |
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
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
shell: cmd
@ -94,10 +96,10 @@ jobs:
cd Software/PC_Application/LibreVNA-GUI/release
del *.o *.cpp
windeployqt.exe .
copy ..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\libwinpthread-1.dll .
copy ..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\libgcc_s_seh-1.dll .
copy "..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\libstdc++-6.dll" .
copy ..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\Qt5OpenGL.dll .
copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libwinpthread-1.dll .
copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libgcc_s_seh-1.dll .
copy "..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libstdc++-6.dll" .
copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\Qt6OpenGL.dll .
shell: cmd
- name: Upload
@ -115,11 +117,11 @@ jobs:
- name: Install dependencies
run: |
brew install qt@5 libusb pcre
brew install qt@6 libusb pcre
- name: Set Environment
run: |
echo "/usr/local/opt/qt@5/bin" >> $GITHUB_PATH
echo "/usr/local/opt/qt@6/bin" >> $GITHUB_PATH
- name: Get build timestamp
id: id_date

View File

@ -8,7 +8,7 @@ on:
jobs:
PC_Application_Ubuntu:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
outputs:
upload_url: ${{ steps.bump_release.outputs.upload_url }}
steps:
@ -17,7 +17,8 @@ jobs:
- name: Install dependencies
run: |
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
id: id_version
@ -31,6 +32,7 @@ jobs:
- name: Build application
run: |
cd Software/PC_Application/LibreVNA-GUI
export QT_SELECT=qt6
qmake LibreVNA-GUI.pro
make -j9
zip LibreVNA-GUI.zip LibreVNA-GUI
@ -71,14 +73,14 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: '5.15.2'
version: '6.2.0'
arch: 'win64_mingw81'
- name: Download libusb
run: |
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
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
shell: cmd
@ -104,10 +106,10 @@ jobs:
cd Software/PC_Application/LibreVNA-GUI/release
del *.o *.cpp
windeployqt.exe .
copy ..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\libwinpthread-1.dll .
copy ..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\libgcc_s_seh-1.dll .
copy "..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\libstdc++-6.dll" .
copy ..\..\..\..\..\Qt\5.15.2\mingw81_64\bin\Qt5OpenGL.dll .
copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libwinpthread-1.dll .
copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libgcc_s_seh-1.dll .
copy "..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\libstdc++-6.dll" .
copy ..\..\..\..\..\Qt\6.2.0\mingw81_64\bin\Qt6OpenGL.dll .
shell: cmd
- name: Zip app
@ -136,11 +138,11 @@ jobs:
- name: Install dependencies
run: |
brew install qt@5 libusb pcre
brew install qt@6 libusb pcre
- name: Set Environment
run: |
echo "/usr/local/opt/qt@5/bin" >> $GITHUB_PATH
echo "/usr/local/opt/qt@6/bin" >> $GITHUB_PATH
- name: Get app 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:
* 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:
* 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
* Install the required libraries:
```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):
```console

View File

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

View File

@ -124,7 +124,7 @@ QWidget *CalibrationMeasurement::Base::createStandardWidget()
{
auto cbStandard = new QComboBox();
for(auto s : supportedStandards()) {
cbStandard->addItem(s->getDescription(), qVariantFromValue((void*) s));
cbStandard->addItem(s->getDescription(), QVariant::fromValue((void*) s));
if(standard == s) {
cbStandard->setCurrentText(s->getDescription());
}
@ -232,10 +232,10 @@ QTableWidgetItem *CalibrationMeasurement::OnePort::getStatisticsItem()
auto ret = Base::getStatisticsItem();
if(numPoints() > 0) {
if(!standard) {
ret->setBackgroundColor(Qt::red);
ret->setBackground(Qt::red);
ret->setToolTip("No calibration standard assigned, unable to use this measurement");
} 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));
}
}
@ -391,10 +391,10 @@ QTableWidgetItem *CalibrationMeasurement::TwoPort::getStatisticsItem()
auto ret = Base::getStatisticsItem();
if(numPoints() > 0) {
if(!standard) {
ret->setBackgroundColor(Qt::red);
ret->setBackground(Qt::red);
ret->setToolTip("No calibration standard assigned, unable to use this measurement");
} 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));
}
}

View File

@ -70,7 +70,7 @@ bool SIUnitEdit::eventFilter(QObject *, QEvent *event)
key = tolower(key);
}
if(key <= 255) {
if (prefixes.indexOf(key) >= 0) {
if (prefixes.indexOf(static_cast<QChar>(key)) >= 0) {
// a valid prefix key was pressed
parseNewValue(Unit::SIPrefixToFactor(key));
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_4, 3);
// 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);
});
connect(ui->port2Group, qOverload<int>(&QButtonGroup::buttonClicked), [=](int id) {
connect(ui->port2Group, qOverload<int>(&QButtonGroup::idClicked), [=](int id) {
preventCollisionWithGroup(ui->port1Group, id);
});
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->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
insertIndicator->setStyleSheet("background-color:red;");
updateInsertIndicator(dragEvent->pos().x());
updateInsertIndicator(dragEvent->position().toPoint().x());
return true;
}
} else if(event->type() == QEvent::DragMove) {
auto dragEvent = static_cast<QDragMoveEvent*>(event);
updateInsertIndicator(dragEvent->pos().x());
updateInsertIndicator(dragEvent->position().toPoint().x());
return true;
} else if(event->type() == QEvent::Drop) {
auto dragEvent = static_cast<QDropEvent*>(event);
delete insertIndicator;
addFrameAtPosition(dragEvent->pos().x(), dropFrame);
addFrameAtPosition(dragEvent->position().toPoint().x(), dropFrame);
return true;
} else if(event->type() == QEvent::DragLeave) {
dropPending = false;

View File

@ -437,11 +437,13 @@ QStringList CompoundDriver::availableExtRefInSettings()
if(!connected) {
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++) {
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()
@ -449,11 +451,13 @@ QStringList CompoundDriver::availableExtRefOutSettings()
if(!connected) {
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++) {
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)

View File

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

View File

@ -211,7 +211,7 @@ bool LibreVNAUSBDriver::connectTo(QString serial)
libusb_exit(m_context);
throw std::runtime_error(message.toStdString());
}
qInfo() << "USB connection established" << flush;
qInfo() << "USB connection established" << Qt::flush;
connected = true;
m_receiveThread = new std::thread(&LibreVNAUSBDriver::USBHandleThread, this);
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) {
UpdateLO2();
});
connect(ui->SourceSwitchGroup, qOverload<int, bool>(&QButtonGroup::buttonToggled), [=](int, bool) {
connect(ui->SourceSwitchGroup, qOverload<int, bool>(&QButtonGroup::idToggled), [=](int, bool) {
UpdateLO1();
UpdateLO2();
});
@ -179,8 +179,8 @@ ManualControlDialogV1::ManualControlDialogV1(LibreVNADriver &dev, QWidget *paren
connect(ui->LO2Frequency, &SIUnitEdit::valueChanged, [=](double) { UpdateDevice(); });
connect(ui->IF2, &SIUnitEdit::valueChanged, [=](double) { UpdateDevice(); });
connect(ui->PortSwitchGroup, qOverload<int, bool>(&QButtonGroup::buttonToggled), [=](int, bool) { UpdateDevice(); });
connect(ui->SourceSwitchGroup, 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::idToggled), [=](int, bool) { UpdateDevice(); });
connect(ui->Attenuator, qOverload<double>(&QDoubleSpinBox::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;
}
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
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
break;
case SASettings::Window::None:
case SASettings::Window::Last:
windowName = "RECTangular";
break;
}
@ -217,6 +218,7 @@ bool SSA3000XDriver::setSA(const DeviceDriver::SASettings &s, std::function<void
detName = "NEGative";
break;
case SASettings::Detector::PPeak:
case SASettings::Detector::Last:
detName = "POSitive";
break;
case SASettings::Detector::Sample:
@ -287,6 +289,8 @@ QStringList SSA3000XDriver::availableExtRefOutSettings()
bool SSA3000XDriver::setExtRef(QString option_in, QString option_out)
{
Q_UNUSED(option_in)
Q_UNUSED(option_out)
return false;
}

View File

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

View File

@ -16,7 +16,6 @@
#include "Generator/signalgenwidget.h"
#include <QDockWidget>
#include <QDesktopWidget>
#include <QApplication>
#include <QActionGroup>
#include "CustomWidgets/informationbox.h"
@ -113,7 +112,7 @@ SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window, QString name)
auto eStart = new SIUnitEdit("Hz", " kMG", 6);
// 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->setToolTip("Start frequency");
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->zImag, &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->lGroup, qOverload<int>(&QButtonGroup::buttonClicked), this, &ImpedanceMatchDialog::calculateMatch);
connect(ui->cGroup, qOverload<int>(&QButtonGroup::buttonClicked), this, &ImpedanceMatchDialog::calculateMatch);
connect(ui->zGroup, qOverload<int>(&QButtonGroup::buttonClicked), this, &ImpedanceMatchDialog::calculateMatch);
connect(ui->lGroup, qOverload<int>(&QButtonGroup::idClicked), this, &ImpedanceMatchDialog::calculateMatch);
connect(ui->cGroup, qOverload<int>(&QButtonGroup::idClicked), this, &ImpedanceMatchDialog::calculateMatch);
connect(ui->zGroup, qOverload<int>(&QButtonGroup::idClicked), this, &ImpedanceMatchDialog::calculateMatch);
// populate marker options
auto markers = model.getMarkers();

View File

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

View File

@ -413,11 +413,12 @@ void TracePlot::leaveEvent(QEvent *event)
void TracePlot::wheelEvent(QWheelEvent *event)
{
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 vertically = !(QApplication::keyboardModifiers() & Qt::ControlModifier);
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();
}
}
@ -522,7 +523,7 @@ void TracePlot::dragEnterEvent(QDragEnterEvent *event)
void TracePlot::dropEvent(QDropEvent *event)
{
if(dropTrace) {
traceDropped(dropTrace, event->pos() - - QPoint(marginLeft, marginTop));
traceDropped(dropTrace, event->position().toPoint() - - QPoint(marginLeft, marginTop));
}
dropPending = false;
dropTrace = nullptr;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -50,7 +50,7 @@ public:
}
// json library does not now about QVariant, handle used cases
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::Int: e.var.setValue((*json_entry).get<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
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::Int: *json_entry = val.toInt(); break;
case QMetaType::UInt: *json_entry = val.toUInt(); break;

View File

@ -1,10 +1,10 @@
@echo off
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 (
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 (
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

View File

@ -1,6 +1,6 @@
#!/bin/sh
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu${LD_LIBRARY_PATH:+:$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
exec "$@"