Merge #6471: fix: don't shrink window when setting minimum width

e08068687c fix: don't shrink window when setting minimum width (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * Closes https://github.com/dashpay/dash/issues/5886
  * We've been setting restrictions on the width of the window since [dash#3734](https://github.com/dashpay/dash/pull/3734) (see d351fca6a6 and c0447b0bc6), meaning, the behavior as described in [dash#5886](https://github.com/dashpay/dash/issues/5886) has been present since v0.16 (v0.15 and earlier used the old UI design).
    * We do not set any restrictions on height and in that respect, Dash Qt will behave similar to Bitcoin Qt in that it can be resized to be arbitrarily small.

  ## How Has This Been Tested?

  Crossed compiled for `x86_64-w64-mingw32` and tested resulting `dash-qt.exe` on Windows 11 22H2 (Build 22621.431). Followed reproduction steps as mentioned in [dash#5886](https://github.com/dashpay/dash/issues/5886), found width to persist even after closing Options modal using buttons and the close button on the top right.

  ## Breaking Changes

  None expected.

  ## Checklist:

  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas
  - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)**
  - [x] I have made corresponding changes to the documentation **(note: N/A)**
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  PastaPastaPasta:
    generally utACK e08068687c
  UdjinM6:
    utACK e08068687c

Tree-SHA512: ed3874c830c0ddf1a9e1166b75e3088969b7dfae8bca25af47045727e14a270ca2bb740e2c30b657b26a4b8e542dff8d898e5d5d2c9482d67da15578e0054632
This commit is contained in:
pasta 2024-12-10 07:55:56 -06:00
commit 8ec789fe27
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38
2 changed files with 6 additions and 2 deletions

View File

@ -1419,7 +1419,9 @@ void BitcoinGUI::updateWidth()
// Use nButtonsVisible + 1 <- for the dash logo
int nWidth = std::max<int>(980, (nWidthWidestButton + 30) * (nButtonsVisible + 1));
setMinimumWidth(nWidth);
resize(nWidth, height());
// Resize to new minimum width but don't shrink window
resize(std::max(width(), nWidth), height());
}
void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool header, SynchronizationState sync_state)

View File

@ -544,7 +544,9 @@ void OptionsDialog::updateWidth()
// Add 10 per button as padding and use minimum 585 which is what we used in css before
int nWidth = std::max<int>(585, (nWidthWidestButton + 10) * nButtonsVisible);
setMinimumWidth(nWidth);
resize(nWidth, height());
// Resize to new minimum width but don't shrink window
resize(std::max(width(), nWidth), height());
}
void OptionsDialog::showEvent(QShowEvent* event)