mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
CaptainMode: Y to focus to edit area
This commit is contained in:
parent
927bb54502
commit
bc932fa913
@ -200,8 +200,8 @@ Press the leader key `Ctrl+E`, then VNote will enter the Captain Mode, within wh
|
|||||||
|
|
||||||
- `E`
|
- `E`
|
||||||
Toggle expanding the edit area.
|
Toggle expanding the edit area.
|
||||||
- `P`
|
- `Y`
|
||||||
Toggle single panel or two panels mode.
|
Focus to the edit area.
|
||||||
- `T`
|
- `T`
|
||||||
Toggle the Tools panel.
|
Toggle the Tools panel.
|
||||||
- `Shift+#`
|
- `Shift+#`
|
||||||
|
@ -201,8 +201,8 @@ RemoveSplit=R
|
|||||||
|
|
||||||
- `E`
|
- `E`
|
||||||
是否扩展编辑区域。
|
是否扩展编辑区域。
|
||||||
- `P`
|
- `Y`
|
||||||
切换单列/双列面板模式。
|
将焦点设为编辑区域。
|
||||||
- `T`
|
- `T`
|
||||||
打开或关闭工具面板。
|
打开或关闭工具面板。
|
||||||
- `Shift+#`
|
- `Shift+#`
|
||||||
|
@ -423,6 +423,8 @@ ApplySnippet=S
|
|||||||
Export=O
|
Export=O
|
||||||
; Toggle live preview
|
; Toggle live preview
|
||||||
LivePreview=I
|
LivePreview=I
|
||||||
|
; Focus edit area
|
||||||
|
FocusEditArea=Y
|
||||||
|
|
||||||
[external_editors]
|
[external_editors]
|
||||||
; Define external editors which could be called to edit notes
|
; Define external editors which could be called to edit notes
|
||||||
|
@ -70,11 +70,6 @@ public:
|
|||||||
|
|
||||||
QWidget *getPopupWidget() const;
|
QWidget *getPopupWidget() const;
|
||||||
|
|
||||||
// Show the popup widget.
|
|
||||||
void showPopupWidget();
|
|
||||||
|
|
||||||
void hidePopupWidget();
|
|
||||||
|
|
||||||
// Set the bubble to display a number @p_num.
|
// Set the bubble to display a number @p_num.
|
||||||
// @p_num: -1 to hide the bubble.
|
// @p_num: -1 to hide the bubble.
|
||||||
void setBubbleNumber(int p_num);
|
void setBubbleNumber(int p_num);
|
||||||
@ -82,6 +77,12 @@ public:
|
|||||||
// Set the foreground and background of the bubble.
|
// Set the foreground and background of the bubble.
|
||||||
void setBubbleColor(const QColor &p_fg, const QColor &p_bg);
|
void setBubbleColor(const QColor &p_fg, const QColor &p_bg);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
// Show the popup widget.
|
||||||
|
void showPopupWidget();
|
||||||
|
|
||||||
|
void hidePopupWidget();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// Emit when popup widget is about to show.
|
// Emit when popup widget is about to show.
|
||||||
void popupWidgetAboutToShow(QWidget *p_widget);
|
void popupWidgetAboutToShow(QWidget *p_widget);
|
||||||
|
@ -210,6 +210,10 @@ void VMainWindow::registerCaptainAndNavigationTargets()
|
|||||||
g_config->getCaptainShortcutKeySequence("Export"),
|
g_config->getCaptainShortcutKeySequence("Export"),
|
||||||
this,
|
this,
|
||||||
exportByCaptain);
|
exportByCaptain);
|
||||||
|
m_captain->registerCaptainTarget(tr("FocusEditArea"),
|
||||||
|
g_config->getCaptainShortcutKeySequence("FocusEditArea"),
|
||||||
|
this,
|
||||||
|
focusEditAreaByCaptain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VMainWindow::setupUI()
|
void VMainWindow::setupUI()
|
||||||
@ -2818,6 +2822,15 @@ bool VMainWindow::exportByCaptain(void *p_target, void *p_data)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VMainWindow::focusEditAreaByCaptain(void *p_target, void *p_data)
|
||||||
|
{
|
||||||
|
Q_UNUSED(p_data);
|
||||||
|
|
||||||
|
VMainWindow *obj = static_cast<VMainWindow *>(p_target);
|
||||||
|
obj->focusEditArea();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void VMainWindow::promptNewNotebookIfEmpty()
|
void VMainWindow::promptNewNotebookIfEmpty()
|
||||||
{
|
{
|
||||||
if (vnote->getNotebooks().isEmpty()) {
|
if (vnote->getNotebooks().isEmpty()) {
|
||||||
|
@ -328,6 +328,8 @@ private:
|
|||||||
|
|
||||||
static bool exportByCaptain(void *p_target, void *p_data);
|
static bool exportByCaptain(void *p_target, void *p_data);
|
||||||
|
|
||||||
|
static bool focusEditAreaByCaptain(void *p_target, void *p_data);
|
||||||
|
|
||||||
// End Captain mode functions.
|
// End Captain mode functions.
|
||||||
|
|
||||||
VNote *vnote;
|
VNote *vnote;
|
||||||
|
@ -265,7 +265,8 @@ bool VTagPanel::handleKeyNavigation(int p_key, bool &p_succeed)
|
|||||||
// Show all tags panel.
|
// Show all tags panel.
|
||||||
// To avoid focus in VCaptain after hiding the menu.
|
// To avoid focus in VCaptain after hiding the menu.
|
||||||
g_mainWin->focusEditArea();
|
g_mainWin->focusEditArea();
|
||||||
m_btn->showPopupWidget();
|
// Use timer to hide the label first.
|
||||||
|
QTimer::singleShot(50, m_btn, SLOT(showPopupWidget()));
|
||||||
} else {
|
} else {
|
||||||
m_tagEdit->setFocus();
|
m_tagEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user