set shortcuts for console's resize buttons#281
Conversation
|
Concept ACK. |
0caccb5 to
3282d36
Compare
Are they and |
|
@hebasto See: https://doc.qt.io/qt-5/qkeysequence.html#standard-shortcuts. I don't think it includes Ctrl+= or Ctrl+_ |
3282d36 to
ab95506
Compare
Keyboard Layout Issues describe exactly this PR :) |
|
Do you mind looking into https://github.com/hebasto/gui/commits/pr281-alt? |
promag
left a comment
There was a problem hiding this comment.
Any reason to not use https://doc.qt.io/qt-5/qabstractbutton.html#shortcut-prop? And why we want multiple shortcuts for the same button?
https://doc.qt.io/qt-5/qkeysequence.html#keyboard-layout-issues Ctrl+Plus is, actually, Ctrl+Equal_Sign on some keyboard layouts, no? |
|
@promag you can only assign one shortcut directly to a button. The reason to have multiple shortcuts is to allow for the following shortcuts on the resize buttons:
@hebasto's approach seems to be a more focused approach as we're unlikely to need 3 shortcuts for a button. Still looking. |
It will work for any number of shortcuts. But one of them could be considered as "main" one. |
https://github.com/hebasto/gui/commits/pr281-alt is using it for a "main" shortcut. |
cfea5c7 to
2d2632a
Compare
|
Updated from ab95506 -> 2d2632a Main Change: adopt @hebasto's approach as it is more focused Changes from @hebasto's branch:
Will add test coverage in a follow-up PR as some refactors to the current |
| ui->fontBiggerButton->setIcon(platformStyle->SingleColorIcon(":/icons/fontbigger")); | ||
| //: Main shortcut to increase the RPC console font size. | ||
| ui->fontBiggerButton->setShortcut(tr("Ctrl++")); | ||
| //: Secondary shortcut to increase the RPC console font size. |
There was a problem hiding this comment.
Maybe add a note that a secondary shortcut differs from a main one only by presence/absence of the <Shift> key in the key sequence?
There was a problem hiding this comment.
I think this is ok as is. If we include that i'd be worried if someone translates into Ctrl+Shift+_.
Co-authored-by: Jarol Rodriguez <[email protected]>
Co-authored-by: Jarol Rodriguez <[email protected]>
2d2632a to
2a45134
Compare
|
updated from 2d2632a -> 2a45134
|
| .arg("<b>" + ui->clearButton->shortcut().toString(QKeySequence::NativeText) + "</b>") + | ||
| "<br>" + | ||
| tr("Use %1 and %2 to increase or decrease the font size.") | ||
| .arg("<b>" + ui->fontBiggerButton->shortcut().toString(QKeySequence::NativeText) + "</b>") |
There was a problem hiding this comment.
nit: .arg(foo, bar) overload could be used instead of .arg(foo).arg(bar)
There was a problem hiding this comment.
But isn't the current code more readable?
There was a problem hiding this comment.
Yes, maybe, though it could be something like
.arg(
"<b>" + ui->fontBiggerButton->shortcut().toString(QKeySequence::NativeText) + "</b>",
"<b>" + ui->fontSmallerButton->shortcut().toString(QKeySequence::NativeText) + "</b>"
) +
Not that bad.
There was a problem hiding this comment.
I think that should be debated here: #331
3a171f7 logging: fix logging empty threadname (klementtan) Pull request description: Currently, `leveldb` background thread does not have a thread name and as a result, an empty thread name is logged. This PR fixes this by logging thread name as `"unknown"` if the thread name is empty On master: ```txt 2022-06-02T14:30:38Z [] [leveldb:debug] Generated table #281@0: 1862 keys, 138303 bytes ``` On this PR: ```txt 2022-06-02T14:30:38Z [unknown] [leveldb:debug] Generated table #281@0: 1862 keys, 138303 bytes ``` ACKs for top commit: laanwj: Code review ACK 3a171f7 hebasto: ACK 3a171f7 Tree-SHA512: 0af0fa5c4ddd3640c6dab9595fe9d97f74d0e0f4b41287a6630cf8ac5a21240250e0659ec4ac5a561e888d522f5304bf627104de2aba0fd0a86c1222de0897c2

On
masterthe only way to resize the console font is to manually move your mouse and click the resize buttons. This PR introduces convenient keyboard shortcuts to resize the console font.The common resize shortcuts for applications are
Ctrl+=/Ctrl++andCtrl+-/Ctrl+_. This means that the resize QPushButtons need two shortcuts each, but you cannot assign multiple shortcuts to a QPushButton. See: https://doc.qt.io/qt-5/qabstractbutton.html#shortcut-propTo get around this, we introduce a new function in
guiutil, which connects a suppliedQKeySequenceshortcut to aQAbstractButton. This function can be reused in other situations where more than one shortcut is needed for a button.