Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/plugins/ProjectManager/ProjectManagerPlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,11 @@ void ProjectManagerPlugin::on_client_merged(qmdiHost *host) {
auto projectSearch = new QAction(tr("Search in project"));
projectSearch->setShortcut(QKeySequence(Qt::ControlModifier | Qt::ShiftModifier | Qt::Key_F));
connect(projectSearch, &QAction::triggered, this, [searchPanel, this]() {
auto currentEditor = dynamic_cast<qmdiEditor *>(getManager()->currentClient());
if (currentEditor) {
auto text = currentEditor->getSelectedText();
searchPanelUI->setSearchPattern(text);
}
searchPanel->raise();
searchPanel->show();
searchPanel->setFocus();
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/ProjectManager/ProjectSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ void ProjectSearch::setSearchPath(const QString &s) { ui->pathEdit->setText(s);

const QString ProjectSearch::getSearchPattern() { return ui->searchFor->text(); }

void ProjectSearch::setSearchPattern(const QString &s) { ui->searchFor->setText(s); }
void ProjectSearch::setSearchPattern(const QString &s) {
ui->searchFor->setText(s);
ui->searchFor->selectAll();
}

const QString ProjectSearch::getSearchInclude() { return ui->includeFiles->text(); }

Expand Down
6 changes: 6 additions & 0 deletions src/widgets/qmdieditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,12 @@ void qmdiEditor::goTo(int x, int y) {
}
}

QString qmdiEditor::getSelectedText() const
{
auto cursor = textEditor->textCursor();
return cursor.selectedText();
}

void qmdiEditor::focusInEvent(QFocusEvent *event) {

QWidget::focusInEvent(event);
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/qmdieditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class qmdiEditor : public QWidget, public qmdiClient {
isJSONDocument();
}

QString getSelectedText() const;

public slots:
void on_fileChanged(const QString &filename);
void displayBannerMessage(QString message, int time);
Expand Down