Make menus and placeholders display appropriate custom key combos. (#4045)
* Add initial support for finding hotkey display key sequences * Make neededArguments work * Implement displaying key combos in SplitHeader main menu * Make Settings search text dynamic * Make tab hide notice use a custom hotkeys key sequence * Make Notebook menus use custom hotkeys key combo lookup for hiding tabs * shut up changelog ci * Make NotebookTab menus show custom hotkeys. SCUFFED: this does not update dynamically! * Scuffed: Make the show prefs button setting show the key bind * Scuffed: Make the R9K description refer to hotkeys * @pajlada, is something like this ok? Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -54,6 +54,7 @@ SettingsDialog::SettingsDialog(QWidget *parent)
|
||||
|
||||
void SettingsDialog::addShortcuts()
|
||||
{
|
||||
this->setSearchPlaceholderText();
|
||||
HotkeyController::HotkeyMap actions{
|
||||
{"search",
|
||||
[this](std::vector<QString>) -> QString {
|
||||
@@ -71,6 +72,19 @@ void SettingsDialog::addShortcuts()
|
||||
this->shortcuts_ = getApp()->hotkeys->shortcutsForCategory(
|
||||
HotkeyCategory::PopupWindow, actions, this);
|
||||
}
|
||||
void SettingsDialog::setSearchPlaceholderText()
|
||||
{
|
||||
QString searchHotkey;
|
||||
auto searchSeq = getApp()->hotkeys->getDisplaySequence(
|
||||
HotkeyCategory::PopupWindow, "search");
|
||||
if (!searchSeq.isEmpty())
|
||||
{
|
||||
searchHotkey =
|
||||
"(" + searchSeq.toString(QKeySequence::SequenceFormat::NativeText) +
|
||||
")";
|
||||
}
|
||||
this->ui_.search->setPlaceholderText("Find in settings... " + searchHotkey);
|
||||
}
|
||||
|
||||
void SettingsDialog::initUi()
|
||||
{
|
||||
@@ -85,7 +99,7 @@ void SettingsDialog::initUi()
|
||||
.withoutMargin()
|
||||
.emplace<QLineEdit>()
|
||||
.assign(&this->ui_.search);
|
||||
edit->setPlaceholderText("Find in settings... (Ctrl+F by default)");
|
||||
this->setSearchPlaceholderText();
|
||||
edit->setClearButtonEnabled(true);
|
||||
edit->findChild<QAbstractButton *>()->setIcon(
|
||||
QPixmap(":/buttons/clearSearch.png"));
|
||||
|
||||
Reference in New Issue
Block a user