aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-01-05 22:33:28 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-01-21 18:58:49 +0100
commitbdc64c9030488e7a6b88f369fb876c0b21c04a25 (patch)
tree19c5059bb2703a496de492440a61fd414432a03d /src
parent7bc4498234e16bc75975555cbe7855384489782f (diff)
downloadbitcoin-bdc64c9030488e7a6b88f369fb876c0b21c04a25.tar.xz
qt: Stop the effect of hidden widgets on the size of QStackedWidget
Layouts of the hidden widgets, those are children of QStackedWidget, could prevent to adjust the size of the parent widget in the WalletFrame widget. Github-Pull: bitcoin-core/gui#176 Rebased-From: af58f5b12cea91467692dd4ae71d8cc916a608ed
Diffstat (limited to 'src')
-rw-r--r--src/qt/walletframe.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp
index 4a9b4a5c84..eaa18b03a3 100644
--- a/src/qt/walletframe.cpp
+++ b/src/qt/walletframe.cpp
@@ -106,9 +106,24 @@ void WalletFrame::setCurrentWallet(WalletModel* wallet_model)
{
if (mapWalletViews.count(wallet_model) == 0) return;
+ // Stop the effect of hidden widgets on the size hint of the shown one in QStackedWidget.
+ WalletView* view_about_to_hide = currentWalletView();
+ if (view_about_to_hide) {
+ QSizePolicy sp = view_about_to_hide->sizePolicy();
+ sp.setHorizontalPolicy(QSizePolicy::Ignored);
+ view_about_to_hide->setSizePolicy(sp);
+ }
+
WalletView *walletView = mapWalletViews.value(wallet_model);
- walletStack->setCurrentWidget(walletView);
assert(walletView);
+
+ // Set or restore the default QSizePolicy which could be set to QSizePolicy::Ignored previously.
+ QSizePolicy sp = walletView->sizePolicy();
+ sp.setHorizontalPolicy(QSizePolicy::Preferred);
+ walletView->setSizePolicy(sp);
+ walletView->updateGeometry();
+
+ walletStack->setCurrentWidget(walletView);
walletView->updateEncryptionStatus();
}