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); 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(); qDebug() << "Low resolution detected:" << QApplication::desktop()->availableGeometry().width() << "x" << QApplication::desktop()->availableGeometry().height();
this->setGeometry(64, 64, 800, 600); this->setGeometry(64, 64, 800, 600);
} }
else 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()); //ui->scopeAxes->resize(ui->scopeAxes->height(), ui->scopeAxes->height());
//qDebug() << ui->scopeAxes->yAxis->autoTickCount() << ui->scopeAxes->xAxis->autoTickCount(); //qDebug() << ui->scopeAxes->yAxis->autoTickCount() << ui->scopeAxes->xAxis->autoTickCount();
if(forceSquare){ if(forceSquare)
{
int tempHeight = ui->scopeAxes->height(); int tempHeight = ui->scopeAxes->height();
int tempWidth = ui->scopeAxes->width(); int tempWidth = ui->scopeAxes->width();
int newDims = (tempHeight > tempWidth) ? tempWidth : tempHeight; 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); 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(){ void MainWindow::menuSetup(){

View File

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