diff --git a/src/gui/findadapter.cpp b/src/gui/findadapter.cpp index 6e9c651f..0e97ee5a 100644 --- a/src/gui/findadapter.cpp +++ b/src/gui/findadapter.cpp @@ -8,7 +8,7 @@ Contact KDAB at for commercial licensing options. */ -#include "FindAdapter.h" +#include "findadapter.h" #include "core/textdocument.h" #include "highlightdelegate.h" diff --git a/src/gui/rcui/rcfileview.cpp b/src/gui/rcui/rcfileview.cpp index 4fc61212..be3f9851 100644 --- a/src/gui/rcui/rcfileview.cpp +++ b/src/gui/rcui/rcfileview.cpp @@ -13,6 +13,7 @@ #include "assetmodel.h" #include "datamodel.h" #include "dialogmodel.h" +#include "gui/findadapter.h" #include "includemodel.h" #include "menumodel.h" #include "rccore/rcfile.h" @@ -47,12 +48,15 @@ class DataProxy : public QSortFilterProxyModel RcFileView::RcFileView(QWidget *parent) : QWidget(parent) + , FindInterface(FindInterface::CanSearch) , ui(new Ui::RcFileView) , m_dataProxyModel(new DataProxy(this)) , m_contentProxyModel(new QSortFilterProxyModel(this)) { ui->setupUi(this); + m_findAdapter = new Gui::FindAdapter(ui->dataView); + ui->dataView->setSortingEnabled(true); ui->dataView->setContextMenuPolicy(Qt::CustomContextMenu); ui->dataView->setModel(m_dataProxyModel); @@ -127,6 +131,11 @@ QPlainTextEdit *RcFileView::textEdit() const return ui->textEdit; } +void RcFileView::find(const QString &text, int options) +{ + m_findAdapter->find(text, options); +} + void RcFileView::changeDataItem(const QModelIndex ¤t) { int type = NoData; diff --git a/src/gui/rcui/rcfileview.h b/src/gui/rcui/rcfileview.h index 9f722ce4..169c903f 100644 --- a/src/gui/rcui/rcfileview.h +++ b/src/gui/rcui/rcfileview.h @@ -10,6 +10,8 @@ #pragma once +#include "../findinterface.h" + #include #include @@ -23,13 +25,17 @@ struct Data; struct RcFile; } +namespace Gui { +class FindAdapter; +} + namespace RcUi { namespace Ui { class RcFileView; } -class RcFileView : public QWidget +class RcFileView : public QWidget, public Gui::FindInterface { Q_OBJECT @@ -41,6 +47,8 @@ class RcFileView : public QWidget QPlainTextEdit *textEdit() const; + void find(const QString &text, int options) override; + signals: void languageChanged(const QString &language); @@ -65,6 +73,7 @@ class RcFileView : public QWidget QSortFilterProxyModel *const m_dataProxyModel; QSortFilterProxyModel *const m_contentProxyModel; QAbstractItemModel *m_contentModel = nullptr; + Gui::FindAdapter *m_findAdapter = nullptr; }; } // namespace RcUi