mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 05:49:53 +08:00
* Sets the default search to the currently selected text (#1886)
* * Sets the default search to the currently selected text * * Specification code
This commit is contained in:
parent
606dcef16f
commit
e4355eeb48
@ -1115,6 +1115,23 @@ QPoint MarkdownViewWindow::getFloatingWidgetPosition()
|
||||
return TextViewWindowHelper::getFloatingWidgetPosition(this);
|
||||
}
|
||||
|
||||
QString MarkdownViewWindow::selectedText() const
|
||||
{
|
||||
switch (m_mode) {
|
||||
case ViewWindowMode::FullPreview:
|
||||
case ViewWindowMode::Invalid:
|
||||
Q_FALLTHROUGH();
|
||||
case ViewWindowMode::Read:
|
||||
Q_ASSERT(m_viewer);
|
||||
return m_viewer->selectedText();
|
||||
case ViewWindowMode::Edit:
|
||||
case ViewWindowMode::FocusPreview:
|
||||
Q_ASSERT(m_editor);
|
||||
return m_editor->getTextEdit()->selectedText();
|
||||
}
|
||||
return QString("");
|
||||
}
|
||||
|
||||
void MarkdownViewWindow::handleImageHostChanged(const QString &p_hostName)
|
||||
{
|
||||
m_imageHost = ImageHostMgr::getInst().find(p_hostName);
|
||||
|
@ -93,6 +93,8 @@ namespace vnotex
|
||||
|
||||
QPoint getFloatingWidgetPosition() Q_DECL_OVERRIDE;
|
||||
|
||||
QString selectedText() const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
|
||||
|
@ -291,3 +291,9 @@ QPoint TextViewWindow::getFloatingWidgetPosition()
|
||||
{
|
||||
return TextViewWindowHelper::getFloatingWidgetPosition(this);
|
||||
}
|
||||
|
||||
QString TextViewWindow::selectedText() const
|
||||
{
|
||||
Q_ASSERT(m_editor);
|
||||
return m_editor->getTextEdit()->selectedText();
|
||||
}
|
||||
|
@ -66,6 +66,8 @@ namespace vnotex
|
||||
|
||||
QPoint getFloatingWidgetPosition() Q_DECL_OVERRIDE;
|
||||
|
||||
QString selectedText() const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
|
||||
|
@ -655,6 +655,11 @@ void ViewWindow::handleImageHostChanged(const QString &p_hostName)
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
|
||||
QString ViewWindow::selectedText() const
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
ViewWindow::TypeAction ViewWindow::toolBarActionToTypeAction(ViewWindowToolBarHelper::Action p_action)
|
||||
{
|
||||
Q_ASSERT(p_action >= ViewWindowToolBarHelper::Action::TypeBold
|
||||
@ -970,7 +975,7 @@ void ViewWindow::showFindAndReplaceWidget()
|
||||
this, &ViewWindow::handleFindAndReplaceWidgetOpened);
|
||||
}
|
||||
|
||||
m_findAndReplace->open(QString());
|
||||
m_findAndReplace->open(selectedText());
|
||||
}
|
||||
|
||||
void ViewWindow::hideFindAndReplaceWidget()
|
||||
|
@ -218,6 +218,8 @@ namespace vnotex
|
||||
|
||||
virtual void zoom(bool p_zoomIn) = 0;
|
||||
|
||||
virtual QString selectedText() const;
|
||||
|
||||
void showZoomFactor(qreal p_factor);
|
||||
|
||||
void showZoomDelta(int p_delta);
|
||||
|
Loading…
x
Reference in New Issue
Block a user