mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-28 13:02:38 +02:00
Merge bitcoin-core/gui#329: Make console buttons look clickable
8b419b5163
qt: make console buttons look clickable (Jarol Rodriguez) Pull request description: On master, for macOS, the console buttons' hitboxes are quite small. This makes clicking on the button with your mouse a little more tedious than it should be. The Issue is related to recent versions of Qt (>5.9.8) not playing so nice on macOS when there are "incorrect" `width` and `height` values set for a `QPushButton` (here is another example: https://github.com/bitcoin-core/gui/pull/319#pullrequestreview-652907740). This fixes this small hitbox issue by converting the buttons from `QPushButton` to `QToolButton`, which in turn makes the buttons look explicitly clickable. This approach was chosen as it helps us avoid having to play around with `width` and `height` values until we find values that play nice with macOS and look good on Linux & Windows. Also, `QToolButton` is an appropriate class for these buttons. Per [Qt Docs](https://doc.qt.io/qt-5/qtoolbutton.html#details): > A tool button is a special button that provides quick-access to specific commands or options. As opposed to a normal command button, a tool button usually doesn't show a text label, but shows an icon instead. Since we are changing the type of the buttons, we need to change the respective actions connection logic in `rpcconsole`. Instead of plugging in `QToolButton`, we abstract it to the base class: `QAbstractButton`. per [Qt Dev Notes](https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Developer-Notes-for-Qt-Code#inherited-signals-and-slot) > Use base class functions as this makes the code more general, e.g., use QAbstractButton::clicked instead of QPushButton::clicked. While here, we also update the size of the icons to `22x22` to be consistent with other tool buttons. **macOS: Master vs PR:** | Master | PR | | ----------- | ----------- | |  |  | **Linux: Master vs PR:** | Master | PR | | ----------- | ----------- | |  |  | ACKs for top commit: hebasto: ACK8b419b5163
, tested on Linux Mint 20.1 (Qt 5.12.8). promag: Tested ACK8b419b5163
on macOS Big Sur M1, this drops only relevant usages to `flat` buttons. Tree-SHA512: 3f3cdcbe83398136a1d1ee8fc2835be8681f2ed39e79db1e939cab6a00a779f528343d54992807a845cc84d9ef13591affb7a6dbca9e5753a2b8665b0af4d611
This commit is contained in:
commit
916f45eba5
@ -470,13 +470,7 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="fontSmallerButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QToolButton" name="fontSmallerButton">
|
||||
<property name="toolTip">
|
||||
<string>Decrease font size</string>
|
||||
</property>
|
||||
@ -489,26 +483,14 @@
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16</height>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="fontBiggerButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QToolButton" name="fontBiggerButton">
|
||||
<property name="toolTip">
|
||||
<string>Increase font size</string>
|
||||
</property>
|
||||
@ -521,26 +503,14 @@
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16</height>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QToolButton" name="clearButton">
|
||||
<property name="toolTip">
|
||||
<string>Clear console</string>
|
||||
</property>
|
||||
@ -554,15 +524,15 @@
|
||||
<iconset resource="../bitcoin.qrc">
|
||||
<normaloff>:/icons/remove</normaloff>:/icons/remove</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+L</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <wallet/wallet.h>
|
||||
#endif
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QDateTime>
|
||||
#include <QFont>
|
||||
#include <QKeyEvent>
|
||||
@ -530,9 +531,9 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
|
||||
ui->lineEdit->setMaxLength(16 * 1024 * 1024);
|
||||
ui->messagesWidget->installEventFilter(this);
|
||||
|
||||
connect(ui->clearButton, &QPushButton::clicked, [this] { clear(); });
|
||||
connect(ui->fontBiggerButton, &QPushButton::clicked, this, &RPCConsole::fontBigger);
|
||||
connect(ui->fontSmallerButton, &QPushButton::clicked, this, &RPCConsole::fontSmaller);
|
||||
connect(ui->clearButton, &QAbstractButton::clicked, [this] { clear(); });
|
||||
connect(ui->fontBiggerButton, &QAbstractButton::clicked, this, &RPCConsole::fontBigger);
|
||||
connect(ui->fontSmallerButton, &QAbstractButton::clicked, this, &RPCConsole::fontSmaller);
|
||||
connect(ui->btnClearTrafficGraph, &QPushButton::clicked, ui->trafficGraph, &TrafficGraphWidget::clear);
|
||||
|
||||
// disable the wallet selector by default
|
||||
|
Loading…
Reference in New Issue
Block a user