bugfix: implement focusChild() of VMdTab and VHtmlTab to fix focus issue

This commit is contained in:
Le Tan 2017-06-11 17:46:34 +08:00
parent a8c76d6742
commit a44259e66c
5 changed files with 16 additions and 1 deletions

View File

@ -71,7 +71,7 @@ protected:
void wheelEvent(QWheelEvent *p_event) Q_DECL_OVERRIDE; void wheelEvent(QWheelEvent *p_event) Q_DECL_OVERRIDE;
// Called when VEditTab get focus. Should focus the proper child widget. // Called when VEditTab get focus. Should focus the proper child widget.
virtual void focusChild() {} virtual void focusChild() = 0;
// Called to zoom in/out content. // Called to zoom in/out content.
virtual void zoom(bool p_zoomIn, qreal p_step = 0.25) = 0; virtual void zoom(bool p_zoomIn, qreal p_step = 0.25) = 0;

View File

@ -244,3 +244,7 @@ void VHtmlTab::zoom(bool /* p_zoomIn */, qreal /* p_step */)
{ {
} }
void VHtmlTab::focusChild()
{
m_editor->setFocus();
}

View File

@ -76,6 +76,9 @@ private:
// Called to zoom in/out content. // Called to zoom in/out content.
void zoom(bool p_zoomIn, qreal p_step = 0.25) Q_DECL_OVERRIDE; 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; VEdit *m_editor;
}; };
#endif // VHTMLTAB_H #endif // VHTMLTAB_H

View File

@ -704,3 +704,8 @@ MarkdownConverterType VMdTab::getMarkdownConverterType() const
{ {
return m_mdConType; return m_mdConType;
} }
void VMdTab::focusChild()
{
m_stacks->currentWidget()->setFocus();
}

View File

@ -120,6 +120,9 @@ private:
// Zoom Web View. // Zoom Web View.
void zoomWebPage(bool p_zoomIn, qreal p_step = 0.25); void zoomWebPage(bool p_zoomIn, qreal p_step = 0.25);
// Focus the proper child widget.
void focusChild() Q_DECL_OVERRIDE;
VEdit *m_editor; VEdit *m_editor;
VWebView *m_webViewer; VWebView *m_webViewer;
VDocument *m_document; VDocument *m_document;