diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2020-10-27 14:51:21 +0100 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2020-10-27 14:51:30 +0100 |
commit | 55b1ffcd259cc64139dad646a52fab5c597c95c2 (patch) | |
tree | 607e6298fe250d768361111d3dd20d345668a5fe | |
parent | 83363f7b62f97e34c863161447a7647f4f72b131 (diff) | |
parent | 7b2e42ecc4bddb5504665d6932dc5ffdbd3b593e (diff) |
Merge bitcoin-core/gui#116: Fix unreasonable default size of the main window without loaded wallets
7b2e42ecc4bddb5504665d6932dc5ffdbd3b593e qt: Add WalletFrame::sizeHint (Hennadii Stepanov)
Pull request description:
This PR fixes a bug in master (d67883d01e507dd22d1281f4a4860e79d6a46a47) and in 0.20.1 that could be easily reproduced with
```
$ src/qt/bitcoin-qt -regtest -resetguisettings -nowallet
```
![Screenshot from 2020-10-25 21-21-27](https://user-images.githubusercontent.com/32963518/97117179-b1800100-170a-11eb-87c9-3120d39b9455.png)
![Screenshot from 2020-10-25 21-23-32](https://user-images.githubusercontent.com/32963518/97117186-b644b500-170a-11eb-8b5d-234ff7205003.png)
**With this PR:**
![Screenshot from 2020-10-25 21-20-35](https://user-images.githubusercontent.com/32963518/97117226-f441d900-170a-11eb-8d66-98b7718a2bb1.png)
![Screenshot from 2020-10-25 21-23-03](https://user-images.githubusercontent.com/32963518/97117232-f99f2380-170a-11eb-85ed-c7b5ece926b2.png)
---
Fix #104
Fix #113
This PR is an alternative to #107 without [hard-coding a size in pixels](https://github.com/bitcoin-core/gui/pull/107#discussion_r511474021).
ACKs for top commit:
jonasschnelli:
Tested ACK 7b2e42ecc4bddb5504665d6932dc5ffdbd3b593e - I can confirm this fixes #104 (Ubuntu 20.04 - HiDPI 200%).
Tree-SHA512: eb0692dbeb3befdeecca0e41534c9783eab6637c14cc4f170ee42619235884f9354f8d22a10c20c08cc89dc5340a60b7dfa2523c12e64b3386b3fd2c6d5f934e
-rw-r--r-- | src/qt/walletframe.cpp | 16 | ||||
-rw-r--r-- | src/qt/walletframe.h | 4 |
2 files changed, 13 insertions, 7 deletions
diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index f16761d6b2..4a9b4a5c84 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -2,12 +2,13 @@ // 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/walletmodel.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> #include <cassert> @@ -18,10 +19,11 @@ #include <QPushButton> #include <QVBoxLayout> -WalletFrame::WalletFrame(const PlatformStyle *_platformStyle, BitcoinGUI *_gui) : - QFrame(_gui), - gui(_gui), - platformStyle(_platformStyle) +WalletFrame::WalletFrame(const PlatformStyle* _platformStyle, BitcoinGUI* _gui) + : 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); diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h index 2b5f263468..e2fa8055bd 100644 --- a/src/qt/walletframe.h +++ b/src/qt/walletframe.h @@ -45,6 +45,8 @@ public: 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 */ void requestedSyncWarningInfo(); @@ -59,6 +61,8 @@ private: const PlatformStyle *platformStyle; + const QSize m_size_hint; + public: WalletView* currentWalletView() const; WalletModel* currentWalletModel() const; |