Skip to content

Commit

Permalink
qt: Add WalletFrame::sizeHint
Browse files Browse the repository at this point in the history
Summary:
This change makes the layout of a WalletFrame widget correct even without loaded wallets.
Previously, the window was very small, and as a result the progress dialog overlay was invisible.

This is a backport of [[bitcoin-core/gui#116 | core-gui#116]]

Test Plan: `src/qt/bitcoin-qt -regtest -resetguisettings -nowallet`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10680
  • Loading branch information
hebasto authored and PiRK committed Dec 15, 2021
1 parent 81fa8f1 commit d6d1e97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/qt/walletframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <qt/createwalletdialog.h>
#include <qt/walletcontroller.h>
#include <qt/walletframe.h>

#include <qt/bitcoingui.h>
#include <qt/createwalletdialog.h>
#include <qt/overviewpage.h>
#include <qt/walletcontroller.h>
#include <qt/walletmodel.h>
#include <qt/walletview.h>

Expand All @@ -19,7 +20,8 @@
#include <cassert>

WalletFrame::WalletFrame(const PlatformStyle *_platformStyle, BitcoinGUI *_gui)
: QFrame(_gui), gui(_gui), platformStyle(_platformStyle) {
: QFrame(_gui), gui(_gui), platformStyle(_platformStyle),
m_size_hint(OverviewPage{platformStyle, nullptr}.sizeHint()) {
// Leave HBox hook for adding a list view later
QHBoxLayout *walletFrameLayout = new QHBoxLayout(this);
setContentsMargins(0, 0, 0, 0);
Expand Down
4 changes: 4 additions & 0 deletions src/qt/walletframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class WalletFrame : public QFrame {

void showOutOfSyncWarning(bool fShow);

QSize sizeHint() const override { return m_size_hint; }

Q_SIGNALS:
/** Notify that the user has requested more information about the
* out-of-sync warning */
Expand All @@ -60,6 +62,8 @@ class WalletFrame : public QFrame {

const PlatformStyle *platformStyle;

const QSize m_size_hint;

public:
WalletView *currentWalletView() const;
WalletModel *currentWalletModel() const;
Expand Down

0 comments on commit d6d1e97

Please sign in to comment.