minor adjustments to Qt layout

This commit is contained in:
Jan Käberich 2021-04-06 18:29:41 +02:00
parent 8865de81b7
commit ba62925b67
3 changed files with 114 additions and 125 deletions

View File

@ -223,6 +223,8 @@ SOURCES += \
unit.cpp
LIBS += -lusb-1.0
unix:LIBS += -L/usr/lib/
win32:LIBS += -L"$$_PRO_FILE_PWD_" # Github actions placed libusb here
QT += widgets

View File

@ -13,6 +13,7 @@ SignalgeneratorWidget::SignalgeneratorWidget(QWidget *parent) :
ui->span->setUnit("Hz");
ui->span->setPrefixes(" kMG");
ui->span->setPrecision(6); // show enough digits
ui->span->setValue(0);
ui->current->setUnit("Hz");
ui->current->setPrefixes(" kMG");
@ -21,10 +22,10 @@ SignalgeneratorWidget::SignalgeneratorWidget(QWidget *parent) :
ui->dwell->setUnit("s");
ui->dwell->setPrefixes(" m");
ui->dwell->setPrecision(6); // show enough digits
ui->dwell->setValueQuiet(1);
ui->dwell->setValue(1);
m_timerId = startTimer(1000);
ui->steps->setValueQuiet(100);
ui->steps->setValue(100);
ui->steps->setPrefixes(" k");
ui->steps->setPrecision(0);
@ -57,8 +58,9 @@ SignalgeneratorWidget::SignalgeneratorWidget(QWidget *parent) :
ui->frequency->setValueQuiet(ui->span->value()/2);
}
newF = ui->frequency->value() + ui->span->value()/2;
if (newF > Device::Info().limits_maxFreq)
if (newF > Device::Info().limits_maxFreq) {
ui->frequency->setValueQuiet(Device::Info().limits_maxFreq - ui->span->value()/2);
}
newval = ui->frequency->value() - ui->span->value()/2;
@ -76,8 +78,8 @@ SignalgeneratorWidget::SignalgeneratorWidget(QWidget *parent) :
});
connect(ui->dwell, &SIUnitEdit::valueChanged, [=](double newval) {
if(newval < 0 ) {
newval = 0;
if(newval < 0.01 ) {
newval = 0.01;
} else if (newval > 60) {
newval = 60;
}
@ -102,8 +104,9 @@ SignalgeneratorWidget::SignalgeneratorWidget(QWidget *parent) :
}
emit SettingsChanged();
});
connect(ui->EnabledSweep, &QCheckBox::clicked, [=](){
if(ui->EnabledSweep->isChecked()) {
connect(ui->EnabledSweep, &QCheckBox::toggled, [=](bool enabled){
ui->current->setEnabled(enabled);
if(enabled) {
double newF = ui->frequency->value() - ui->span->value()/2;
if (newF < 0) {
ui->frequency->setValueQuiet(ui->frequency->value() - newF);

View File

@ -38,6 +38,19 @@
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="font">
@ -59,7 +72,7 @@
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Frequency:</string>
<string>Frequency</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
@ -148,125 +161,96 @@
<property name="title">
<string>Sweep</string>
</property>
<widget class="SIUnitEdit" name="span">
<property name="geometry">
<rect>
<x>60</x>
<y>40</y>
<width>133</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>0MHz</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Span:</string>
</property>
</widget>
<widget class="SIUnitEdit" name="steps">
<property name="geometry">
<rect>
<x>60</x>
<y>70</y>
<width>133</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>100</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Steps:</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Dwell:</string>
</property>
</widget>
<widget class="SIUnitEdit" name="dwell">
<property name="geometry">
<rect>
<x>60</x>
<y>100</y>
<width>133</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>100ms</string>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="EnabledSweep">
<property name="geometry">
<rect>
<x>60</x>
<y>10</y>
<width>101</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Enabled</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>10</x>
<y>130</y>
<width>47</width>
<height>13</height>
</rect>
</property>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Current:</string>
<string>Span:</string>
</property>
</widget>
<widget class="SIUnitEdit" name="current">
<property name="geometry">
<rect>
<x>60</x>
<y>130</y>
<width>133</width>
<height>20</height>
</rect>
</property>
</item>
<item row="0" column="1">
<widget class="SIUnitEdit" name="span">
<property name="text">
<string>0MHz</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Steps:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="SIUnitEdit" name="steps">
<property name="text">
<string>100</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Dwell time:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="SIUnitEdit" name="dwell">
<property name="text">
<string>100ms</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Current frequency:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="SIUnitEdit" name="current">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>0MHz</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>