ui advanced settings show and hide is acceptable. qt size hint and
scaling ((((features)))) are dumb
This commit is contained in:
@@ -998,29 +998,20 @@ void MainWindow::on_actionErase_Device_triggered()
|
||||
|
||||
void MainWindow::on_checkBoxAdvancedMode_stateChanged(int state)
|
||||
{
|
||||
int heightShrinkSize = ui->groupBoxAdvanced->height() + ui->groupBoxAdvanced->parentWidget()->layout()->spacing();
|
||||
QSize cWidgetFinalSize(ui->centralWidget->width(), ui->centralWidget->height() - heightShrinkSize);
|
||||
QSize windowFinalSize(width(), height() - heightShrinkSize);
|
||||
|
||||
ui->groupBoxAdvanced->setVisible(state != 0);
|
||||
ui->centralWidget->updateGeometry();
|
||||
|
||||
// handle adjustment of window height when advanced controls are hidden
|
||||
if (state == 0)
|
||||
{
|
||||
/*
|
||||
* Qt's adjustSize() method on widget objects will scale the widget to only fit its' children.
|
||||
* This is useful for "collapsing" the window when the advanced controls are hidden, but will
|
||||
* scale both the height and the width. We want to retain the current width but change the
|
||||
* height, so first we will back up the min and max width values then set the current width as
|
||||
* the fixed width to prevent it from being scaled.
|
||||
*/
|
||||
int minWidthBackup = minimumWidth();
|
||||
int maxWidthBackup = maximumWidth();
|
||||
setFixedWidth(width());
|
||||
|
||||
// perform the size adjustments
|
||||
ui->centralWidget->adjustSize();
|
||||
adjustSize();
|
||||
|
||||
// restore the min/max width values so the width is no longer fixed
|
||||
setMinimumWidth(minWidthBackup);
|
||||
setMaximumWidth(maxWidthBackup);
|
||||
QTimer::singleShot(0, ui->centralWidget, [this,cWidgetFinalSize,windowFinalSize]() {
|
||||
ui->centralWidget->resize(cWidgetFinalSize);
|
||||
resize(windowFinalSize);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ private:
|
||||
|
||||
bool wasBootloaderMode;
|
||||
|
||||
|
||||
private slots:
|
||||
void on_actionBlank_Check_triggered();
|
||||
void on_actionReset_Device_triggered();
|
||||
|
||||
@@ -2,29 +2,15 @@
|
||||
<ui version="4.0">
|
||||
<class>MainWindowClass</class>
|
||||
<widget class="QMainWindow" name="MainWindowClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>504</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<width>481</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans</family>
|
||||
<family>Segoe UI</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -35,30 +21,21 @@
|
||||
<normaloff>:/MainWindow/img/Microchip_logo.Ico</normaloff>:/MainWindow/img/Microchip_logo.Ico</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="_2">
|
||||
<item>
|
||||
<widget class="QWidget" name="groupBasic" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupFirmwareFile">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans Medium</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -83,11 +60,14 @@ QGroupBox::title {
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txtFirmwareFile">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -101,6 +81,12 @@ QGroupBox::title {
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnFwBrowse">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
@@ -119,7 +105,7 @@ QGroupBox::title {
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans Medium</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -160,7 +146,7 @@ QGroupBox::title {
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>MS Shell Dlg 2</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
@@ -175,7 +161,7 @@ QGroupBox::title {
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -186,6 +172,11 @@ QGroupBox::title {
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Segoe UI</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@@ -207,7 +198,7 @@ QGroupBox::title {
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans Medium</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -241,7 +232,7 @@ QGroupBox::title {
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans Medium</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -254,7 +245,7 @@ QGroupBox::title {
|
||||
<widget class="QLabel" name="lblDeviceConnected">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans Medium</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -272,45 +263,19 @@ QGroupBox::title {
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblDeviceStatusMsg">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans Light</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -325,7 +290,21 @@ QGroupBox::title {
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -340,6 +319,11 @@ QGroupBox::title {
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Segoe UI</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@@ -349,6 +333,7 @@ QGroupBox::title {
|
||||
<widget class="QCheckBox" name="checkBoxAdvancedMode">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -365,6 +350,11 @@ QGroupBox::title {
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Segoe UI</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@@ -372,6 +362,9 @@ QGroupBox::title {
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxAdvanced">
|
||||
<property name="sizePolicy">
|
||||
@@ -380,6 +373,11 @@ QGroupBox::title {
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Segoe UI</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="accessibleDescription">
|
||||
<string>advmode</string>
|
||||
</property>
|
||||
@@ -404,10 +402,15 @@ QGroupBox::title {
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Segoe UI</family>
|
||||
</font>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@@ -431,7 +434,7 @@ QGroupBox::title {
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans Medium</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -444,7 +447,7 @@ QGroupBox::title {
|
||||
<widget class="QLabel" name="lblDeviceBootloaderVer">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -457,7 +460,7 @@ QGroupBox::title {
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans Medium</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -470,7 +473,7 @@ QGroupBox::title {
|
||||
<widget class="QLabel" name="lblDeviceAppFWVer">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -483,6 +486,12 @@ QGroupBox::title {
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Segoe UI</family>
|
||||
</font>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnResetDevice">
|
||||
@@ -495,15 +504,10 @@ QGroupBox::title {
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -522,15 +526,10 @@ QGroupBox::title {
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -539,6 +538,7 @@ QGroupBox::title {
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
@@ -550,7 +550,7 @@ QGroupBox::title {
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>IBM Plex Sans</family>
|
||||
<family>Segoe UI</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -567,6 +567,11 @@ QGroupBox::title {
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Segoe UI</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustIgnored</enum>
|
||||
</property>
|
||||
@@ -585,8 +590,8 @@ QGroupBox::title {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>17</height>
|
||||
<width>481</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuProgrammer">
|
||||
|
||||
Reference in New Issue
Block a user