diff --git a/src/vedittab.h b/src/vedittab.h index 25e6b261..4c0fc319 100644 --- a/src/vedittab.h +++ b/src/vedittab.h @@ -71,7 +71,7 @@ protected: void wheelEvent(QWheelEvent *p_event) Q_DECL_OVERRIDE; // Called when VEditTab get focus. Should focus the proper child widget. - virtual void focusChild() {} + virtual void focusChild() = 0; // Called to zoom in/out content. virtual void zoom(bool p_zoomIn, qreal p_step = 0.25) = 0; diff --git a/src/vhtmltab.cpp b/src/vhtmltab.cpp index 8576684b..04a53bf5 100644 --- a/src/vhtmltab.cpp +++ b/src/vhtmltab.cpp @@ -244,3 +244,7 @@ void VHtmlTab::zoom(bool /* p_zoomIn */, qreal /* p_step */) { } +void VHtmlTab::focusChild() +{ + m_editor->setFocus(); +} diff --git a/src/vhtmltab.h b/src/vhtmltab.h index 60387234..3e08b53c 100644 --- a/src/vhtmltab.h +++ b/src/vhtmltab.h @@ -76,6 +76,9 @@ private: // Called to zoom in/out content. void zoom(bool p_zoomIn, qreal p_step = 0.25) Q_DECL_OVERRIDE; + // Focus the proper child widget. + void focusChild() Q_DECL_OVERRIDE; + VEdit *m_editor; }; #endif // VHTMLTAB_H diff --git a/src/vmdtab.cpp b/src/vmdtab.cpp index 93f10230..a8f28471 100644 --- a/src/vmdtab.cpp +++ b/src/vmdtab.cpp @@ -704,3 +704,8 @@ MarkdownConverterType VMdTab::getMarkdownConverterType() const { return m_mdConType; } + +void VMdTab::focusChild() +{ + m_stacks->currentWidget()->setFocus(); +} diff --git a/src/vmdtab.h b/src/vmdtab.h index b3050232..a77d0166 100644 --- a/src/vmdtab.h +++ b/src/vmdtab.h @@ -120,6 +120,9 @@ private: // Zoom Web View. void zoomWebPage(bool p_zoomIn, qreal p_step = 0.25); + // Focus the proper child widget. + void focusChild() Q_DECL_OVERRIDE; + VEdit *m_editor; VWebView *m_webViewer; VDocument *m_document;