diff --git a/qt5_src/Bootloader/MainWindow.cpp b/qt5_src/Bootloader/MainWindow.cpp index 4070155..6b312ff 100644 --- a/qt5_src/Bootloader/MainWindow.cpp +++ b/qt5_src/Bootloader/MainWindow.cpp @@ -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); + }); } } diff --git a/qt5_src/Bootloader/MainWindow.h b/qt5_src/Bootloader/MainWindow.h index fc4b04d..bdf36fe 100644 --- a/qt5_src/Bootloader/MainWindow.h +++ b/qt5_src/Bootloader/MainWindow.h @@ -111,6 +111,7 @@ private: bool wasBootloaderMode; + private slots: void on_actionBlank_Check_triggered(); void on_actionReset_Device_triggered(); diff --git a/qt5_src/Bootloader/MainWindow.ui b/qt5_src/Bootloader/MainWindow.ui index 8ebca88..182a248 100644 --- a/qt5_src/Bootloader/MainWindow.ui +++ b/qt5_src/Bootloader/MainWindow.ui @@ -2,29 +2,15 @@ MainWindowClass - - - 0 - 0 - 300 - 504 - - - - - 0 - 0 - - - 300 + 481 0 - IBM Plex Sans + Segoe UI @@ -35,184 +21,26 @@ :/MainWindow/img/Microchip_logo.Ico:/MainWindow/img/Microchip_logo.Ico - - - 0 - 0 - - - - - 300 - 0 - - - + - - - - 0 - 0 - - - - - IBM Plex Sans Medium - 14 - - - - QGroupBox { - border: 1px solid gray; - border-radius: 9px; - margin-top: 1em; - padding-top: 0.5em; -} - -QGroupBox::title { - subcontrol-origin: margin; - left: 10px; - padding: 0 3px 0 3px; -} - - - Step 1: Select App FW File - - - - 4 - + + - - - - IBM Plex Sans - 10 - - - - - - - true - - - - - - - Browse - - - - - - - - - - - 0 - 0 - - - - - IBM Plex Sans Medium - 14 - - - - QGroupBox { - border: 1px solid gray; - border-radius: 9px; - margin-top: 1em; - padding-top: 0.5em; -} - -QGroupBox::title { - subcontrol-origin: margin; - left: 10px; - padding: 0 3px 0 3px; -} - - - Step 2: Flash FW to Device - - - - - - false - + 0 0 - - - 0 - 60 - - - MS Shell Dlg 2 + Segoe UI 14 - 75 - true - - FLASH FIRMWARE NOW - - - - - - - - IBM Plex Sans - 9 - - - - Flashing Progress - - - - - - - 0 - - - false - - - - - - - - - - - 0 - 0 - - - - - IBM Plex Sans Medium - 14 - - - - QGroupBox { + + QGroupBox { border: 1px solid gray; border-radius: 9px; margin-top: 1em; @@ -224,104 +52,311 @@ QGroupBox::title { left: 10px; padding: 0 3px 0 3px; } - - - Device Information - - - - 4 - - - - - 0 - - - - - IBM Plex Sans Medium - 12 - - - - Status - - - - - - - - IBM Plex Sans Medium - 10 - - - - background-color: rgb(255, 0, 0); - - - Not Connected - - - 3 - - - 15 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 1 - 1 - - - - - - + + Step 1: Select App FW File + + + + 4 + + + QLayout::SetMinimumSize + + + + + + Segoe UI + 10 + + + + + + + true + + + + + + + + Segoe UI + 10 + + + + Browse + + + + + + + + + + + 0 + 0 + + + + + Segoe UI + 14 + + + + QGroupBox { + border: 1px solid gray; + border-radius: 9px; + margin-top: 1em; + padding-top: 0.5em; +} + +QGroupBox::title { + subcontrol-origin: margin; + left: 10px; + padding: 0 3px 0 3px; +} + + + Step 2: Flash FW to Device + + + + + + false + + + + 0 + 0 + + + + + 0 + 60 + + + + + Segoe UI + 14 + 75 + true + + + + FLASH FIRMWARE NOW + + + + + + + + Segoe UI + 9 + + + + Flashing Progress + + + + + + + + Segoe UI + + + + 0 + + + false + + + + + + + + + + + 0 + 0 + + + + + Segoe UI + 14 + + + + QGroupBox { + border: 1px solid gray; + border-radius: 9px; + margin-top: 1em; + padding-top: 0.5em; +} + +QGroupBox::title { + subcontrol-origin: margin; + left: 10px; + padding: 0 3px 0 3px; +} + + + Device Information + + + + 4 + + + + + 0 + + + + + + Segoe UI + 12 + + + + Status + + + + + + + + Segoe UI + 10 + + + + background-color: rgb(255, 0, 0); + + + Not Connected + + + 3 + + + 15 + + + + + + + + + + 0 + 0 + + + + + Segoe UI + 10 + + + + Device not detected. Please connect the dancepad interface's USB cable to this computer. + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 0 + 1 + + + + + + + + + + + 0 0 - - - 0 - 25 - - - - - 16777215 - 25 - - - IBM Plex Sans Light + Segoe UI + + + + Qt::Horizontal + + + + + + + + Segoe UI 10 - Device not detected. Please connect the dancepad interface's USB cable to this computer. + Show Advanced - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + 0 + 0 + - - true + + + Segoe UI + + + + Qt::Horizontal @@ -330,48 +365,6 @@ QGroupBox::title { - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - - 10 - - - - Show Advanced - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - @@ -380,6 +373,11 @@ QGroupBox::title { 0 + + + Segoe UI + + advmode @@ -404,10 +402,15 @@ QGroupBox::title { 0 - 6 + 0 + + + Segoe UI + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -431,7 +434,7 @@ QGroupBox::title { - IBM Plex Sans Medium + Segoe UI 10 @@ -444,7 +447,7 @@ QGroupBox::title { - IBM Plex Sans + Segoe UI 10 @@ -457,7 +460,7 @@ QGroupBox::title { - IBM Plex Sans Medium + Segoe UI 10 @@ -470,7 +473,7 @@ QGroupBox::title { - IBM Plex Sans + Segoe UI 10 @@ -483,62 +486,59 @@ QGroupBox::title { - - - - - false - - - - 0 - 0 - - - - - 0 - 20 - - - - - IBM Plex Sans - - - - Reset Device - - - - - - - false - - - - 0 - 0 - - - - - 0 - 20 - - - - - IBM Plex Sans - - - - Reset Device into FW Update Mode - - - - + + + + Segoe UI + + + + + + + false + + + + 0 + 0 + + + + + Segoe UI + 10 + + + + Reset Device + + + + + + + false + + + + 0 + 0 + + + + + Segoe UI + 10 + + + + Reset Device into FW Update Mode + + + + + @@ -550,7 +550,7 @@ QGroupBox::title { - IBM Plex Sans + Segoe UI 9 @@ -567,6 +567,11 @@ QGroupBox::title { 0 + + + Segoe UI + + QAbstractScrollArea::AdjustIgnored @@ -585,8 +590,8 @@ QGroupBox::title { 0 0 - 300 - 17 + 481 + 26