1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#ifndef SEARCHRESULTWIDGET_H
#define SEARCHRESULTWIDGET_H
#include "mostQtHeaders.h"
#include "searchquery.h"
#include "qdocumentsearch.h"
#include "qdocument.h"
class SearchResultWidget : public QWidget
{
Q_OBJECT
public:
explicit SearchResultWidget(QWidget *parent = 0);
void setQuery(SearchQuery *sq);
SearchQuery::Scope searchScope() const;
void updateSearchExpr(QString searchText);
signals:
void jumpToSearchResult(QDocument *doc, int lineNumber, const SearchQuery *query);
void runSearch(SearchQuery *query);
public slots:
void clearSearch();
private slots:
void clickedSearchResult(const QModelIndex &index);
void updateSearch();
void searchCompleted();
private:
QLabel *searchTypeLabel;
QLabel *searchTextLabel;
QPushButton *searchAgainButton;
QLineEdit *replaceTextEdit;
QPushButton *replaceButton;
QComboBox *searchScopeBox;
QTreeView *searchTree;
SearchQuery *query;
void retranslateUi();
void updateSearchScopeBox(SearchQuery::Scope sc);
};
class SearchTreeDelegate: public QItemDelegate
{
Q_OBJECT
public:
SearchTreeDelegate(QObject *parent = 0);
protected:
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
#endif // SEARCHRESULTWIDGET_H
|