Skip to content

Commit bdc64c9

Browse files
hebastoMarcoFalke
authored and
MarcoFalke
committed
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: af58f5b
1 parent 7bc4498 commit bdc64c9

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/qt/walletframe.cpp

+16-1
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,24 @@ void WalletFrame::setCurrentWallet(WalletModel* wallet_model)
106106
{
107107
if (mapWalletViews.count(wallet_model) == 0) return;
108108

109+
// Stop the effect of hidden widgets on the size hint of the shown one in QStackedWidget.
110+
WalletView* view_about_to_hide = currentWalletView();
111+
if (view_about_to_hide) {
112+
QSizePolicy sp = view_about_to_hide->sizePolicy();
113+
sp.setHorizontalPolicy(QSizePolicy::Ignored);
114+
view_about_to_hide->setSizePolicy(sp);
115+
}
116+
109117
WalletView *walletView = mapWalletViews.value(wallet_model);
110-
walletStack->setCurrentWidget(walletView);
111118
assert(walletView);
119+
120+
// Set or restore the default QSizePolicy which could be set to QSizePolicy::Ignored previously.
121+
QSizePolicy sp = walletView->sizePolicy();
122+
sp.setHorizontalPolicy(QSizePolicy::Preferred);
123+
walletView->setSizePolicy(sp);
124+
walletView->updateGeometry();
125+
126+
walletStack->setCurrentWidget(walletView);
112127
walletView->updateEncryptionStatus();
113128
}
114129

0 commit comments

Comments
 (0)