Fixed multimeter LCD display rendering issue

This commit is contained in:
Chris Esposito 2019-02-17 18:52:42 +11:00
parent 9eeb3f1e91
commit 17277fece6
2 changed files with 138 additions and 116 deletions

View File

@ -197,14 +197,18 @@ MainWindow::MainWindow(QWidget *parent) :
ui->realTimeButton->setVisible(false);
if ((QApplication::desktop()->availableGeometry().width() < 1440) || (QApplication::desktop()->availableGeometry().height() < 900))
if ((QApplication::desktop()->availableGeometry().width() >= 1920) || (QApplication::desktop()->availableGeometry().height() >= 1080))
{
this->setGeometry(64, 64, 1920, 1080);
}
else if ((QApplication::desktop()->availableGeometry().width() < 1440) || (QApplication::desktop()->availableGeometry().height() < 900))
{
qDebug() << "Low resolution detected:" << QApplication::desktop()->availableGeometry().width() << "x" << QApplication::desktop()->availableGeometry().height();
this->setGeometry(64, 64, 800, 600);
}
else
{
this->setGeometry(64, 64, 1440, 900);
this->setGeometry(64, 64, 1440, 880);
}
}
@ -302,7 +306,8 @@ void MainWindow::resizeEvent(QResizeEvent *event){
//ui->scopeAxes->resize(ui->scopeAxes->height(), ui->scopeAxes->height());
//qDebug() << ui->scopeAxes->yAxis->autoTickCount() << ui->scopeAxes->xAxis->autoTickCount();
if(forceSquare){
if(forceSquare)
{
int tempHeight = ui->scopeAxes->height();
int tempWidth = ui->scopeAxes->width();
int newDims = (tempHeight > tempWidth) ? tempWidth : tempHeight;
@ -313,6 +318,13 @@ void MainWindow::resizeEvent(QResizeEvent *event){
ui->scopeAxes->move(ui->scopeAxes->x(), ui->scopeAxes->y() + (tempHeight - tempWidth) / 2);
}
}
// This prevents the multimeter LCD labels from being differently-sized
QRect mmGeometry = ui->gridLayout->geometry();
int spacing = ui->gridLayout->spacing();
int mmHeight = mmGeometry.height();
mmGeometry.setHeight(mmHeight - ((mmHeight - (3 * spacing)) % 4));
ui->gridLayout->setGeometry(mmGeometry);
}
void MainWindow::menuSetup(){

View File

@ -224,6 +224,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hideCH1Box">
<property name="text">
<string>Hide</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -425,6 +432,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hideCH2Box">
<property name="text">
<string>Hide</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -708,20 +722,6 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="hideCH1Box">
<property name="text">
<string>Hide CH1</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hideCH2Box">
<property name="text">
<string>Hide CH2</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
@ -740,6 +740,12 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Multimeter++</string>
</property>
@ -834,106 +840,98 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<layout class="QVBoxLayout" name="verticalLayout_29">
<item>
<widget class="QLabel" name="multimeterMaxLabel">
<property name="text">
<string> Max</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="multimeterMinLabel">
<property name="text">
<string> Min</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="multimeterMeanLabel">
<property name="text">
<string> Mean</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="multimeterRmsLabel">
<property name="text">
<string> RMS</string>
</property>
</widget>
</item>
</layout>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="multimeterMinLabel">
<property name="text">
<string> Min</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_30">
<item>
<widget class="QLCDNumber" name="multimeterMaxDisplay">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>4</number>
</property>
</widget>
</item>
<item>
<widget class="QLCDNumber" name="multimeterMinDisplay">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>4</number>
</property>
</widget>
</item>
<item>
<widget class="QLCDNumber" name="multimeterMeanDisplay">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>4</number>
</property>
</widget>
</item>
<item>
<widget class="QLCDNumber" name="multimeterRmsDisplay">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>4</number>
</property>
</widget>
</item>
</layout>
<item row="0" column="1">
<widget class="QLCDNumber" name="multimeterMaxDisplay">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>4</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="multimeterMaxLabel">
<property name="text">
<string> Max</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="multimeterMeanLabel">
<property name="text">
<string> Mean</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="multimeterRmsLabel">
<property name="text">
<string> RMS</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLCDNumber" name="multimeterMinDisplay">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>4</number>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLCDNumber" name="multimeterMeanDisplay">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>4</number>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLCDNumber" name="multimeterRmsDisplay">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>4</number>
</property>
</widget>
</item>
</layout>
</item>
@ -960,6 +958,12 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Signal Gen CH1</string>
</property>
@ -1057,6 +1061,12 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Signal Gen CH2</string>
</property>