diff --git a/src/gui/rcui/rcfileview.cpp b/src/gui/rcui/rcfileview.cpp index 4fc61212..5889946b 100644 --- a/src/gui/rcui/rcfileview.cpp +++ b/src/gui/rcui/rcfileview.cpp @@ -9,6 +9,7 @@ */ #include "rcfileview.h" +#include "../searchableviewinterface.h" #include "acceleratormodel.h" #include "assetmodel.h" #include "datamodel.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_searchableViewInterface = new Gui::SearchableViewInterface(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_searchableViewInterface->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..7bd2a951 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 SearchableViewInterface; +} + 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::SearchableViewInterface *m_searchableViewInterface = nullptr; }; } // namespace RcUi