commit d62005680565f94ddc9b71befbac4a4f059c1f40
Author: Koji Yokota <[email protected]>
Date: Wed Feb 26 18:49:21 2025 +0900
Add accelerator keys to PrefColors dialog
---
src/frontends/qt/GuiPrefs.cpp | 28 ++++++++++++++++++++++++++--
src/frontends/qt/ui/PrefColorsUi.ui | 2 +-
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index efba1f251d..31c71a13b1 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -71,6 +71,7 @@
#include <QStyleHints>
#endif
#include <QPainter>
+#include <QShortcut>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QValidator>
@@ -1031,6 +1032,19 @@ PrefColors::PrefColors(GuiPreferences * form)
newcolors_.resize(lcolors_.size());
undo_stack_ = new QUndoStack(this);
+ QShortcut* sc_undo = new QShortcut(QKeySequence(QKeySequence::Undo),
this);
+ QShortcut* sc_redo = new QShortcut(QKeySequence(QKeySequence::Redo),
this);
+ QShortcut* sc_search =
+ new QShortcut(QKeySequence(QKeySequence::Find), this);
+ QShortcut* sc_search_forward =
+ new QShortcut(QKeySequence(QKeySequence::FindNext), this);
+ QShortcut* sc_search_backward =
+ new QShortcut(QKeySequence(QKeySequence::FindPrevious), this);
+#if !defined(Q_OS_MAC)
+ // give a shortcut to the combobox
+ QShortcut* sc_load_theme =
+ new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this);
+#endif
initializeLoadThemeCO();
@@ -1064,11 +1078,22 @@ PrefColors::PrefColors(GuiPreferences * form)
this, SLOT(removeTheme()));
connect(saveThemePB, SIGNAL(clicked()),
this, SLOT(saveTheme()));
+#if !defined(Q_OS_MAC)
+ connect(sc_load_theme, SIGNAL(activated()), loadThemeCO,
SLOT(setFocus()));
+#endif
+ connect(sc_search, SIGNAL(activated()),
+ searchStringEdit, SLOT(setFocus()));
+ connect(sc_search_forward, SIGNAL(activated()),
+ this, SLOT(searchNextColorItem()));
+ connect(sc_search_backward, SIGNAL(activated()),
+ this, SLOT(searchPreviousColorItem()));
+ connect(sc_redo, SIGNAL(activated()), undo_stack_, SLOT(redo()));
+ connect(sc_undo, SIGNAL(activated()), undo_stack_, SLOT(undo()));
connect(searchBackwardPB, SIGNAL(clicked()),
this, SLOT(searchPreviousColorItem()));
connect(searchForwardPB, SIGNAL(clicked()),
this, SLOT(searchNextColorItem()));
- connect(searchStringEdit, SIGNAL(editingFinished()),
+ connect(searchStringEdit, SIGNAL(returnPressed()),
this, SLOT(searchNextColorItem()));
connect(syscolorsCB, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
@@ -4136,7 +4161,6 @@ SetColor::SetColor(const int row, bool dark_mode, const
QColor & new_color,
new_color_(new_color), old_color_(old_color), newcolors_(new_color_list),
parent_(color_module)
{
- LYXERR0("constructor");
setText(QString("Color %1 is changed to %2 (light) and %3 (dark)")
.arg(lcolors_[row_]).arg(newcolors_[row_].first)
.arg(newcolors_[row_].second));
diff --git a/src/frontends/qt/ui/PrefColorsUi.ui
b/src/frontends/qt/ui/PrefColorsUi.ui
index e63a0f97c3..cbf1fe6bf2 100644
--- a/src/frontends/qt/ui/PrefColorsUi.ui
+++ b/src/frontends/qt/ui/PrefColorsUi.ui
@@ -199,7 +199,7 @@
<item row="6" column="6">
<widget class="QPushButton" name="removeThemePB">
<property name="text">
- <string>Remove Theme...</string>
+ <string>Re&move Theme...</string>
</property>
</widget>
</item>
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs