ui: Added on-screen search feature (issue #79)
* Use menu action "Edit -> Find in View" or Ctrl + D * UI displayed as search bar at bottom of main window * Hide search bar with ECS or close button * Entering a query searches in name of graph nodes and code contents of code view * Use Enter to iterate through matches, well move match into view in graph and code view * Checkboxes allow for adding/removing results for certain views * Create Bookmark shortcut is now CTRL + S bug id = 79
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
#ifndef QT_SCREEN_SEARCH_BOX_H
|
||||
#define QT_SCREEN_SEARCH_BOX_H
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
class ControllerProxy;
|
||||
class QCheckBox;
|
||||
class QHBoxLayout;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QTimer;
|
||||
|
||||
|
||||
class QtFocusInFilter
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtFocusInFilter();
|
||||
|
||||
signals:
|
||||
void focusIn();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
};
|
||||
|
||||
|
||||
class QtScreenSearchBox
|
||||
: public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtScreenSearchBox(ControllerProxy* controllerProxy, QWidget* parent = nullptr);
|
||||
virtual ~QtScreenSearchBox();
|
||||
|
||||
void refreshStyle();
|
||||
|
||||
void setMatchCount(size_t matchCount);
|
||||
void setMatchIndex(size_t matchIndex);
|
||||
|
||||
void addResponder(const std::string& name);
|
||||
|
||||
signals:
|
||||
void closePressed();
|
||||
|
||||
public slots:
|
||||
void setFocus();
|
||||
|
||||
private slots:
|
||||
void searchQueryChanged();
|
||||
void findMatches();
|
||||
void returnPressed();
|
||||
|
||||
void previousPressed();
|
||||
void nextPressed();
|
||||
|
||||
private:
|
||||
void activateMatch(bool next);
|
||||
|
||||
void updateMatchLabel();
|
||||
|
||||
ControllerProxy* m_controllerProxy;
|
||||
|
||||
QLineEdit* m_searchBox;
|
||||
QPushButton* m_matchLabel;
|
||||
|
||||
QPushButton* m_searchButton;
|
||||
QPushButton* m_prevButton;
|
||||
QPushButton* m_nextButton;
|
||||
QPushButton* m_closeButton;
|
||||
|
||||
QHBoxLayout* m_checkboxLayout;
|
||||
std::vector<QCheckBox*> m_checkBoxes;
|
||||
|
||||
size_t m_matchCount = 0;
|
||||
size_t m_matchIndex = 0;
|
||||
|
||||
QTimer* m_timer;
|
||||
};
|
||||
|
||||
#endif // QT_SCREEN_SEARCH_BOX_H
|
||||
Reference in New Issue
Block a user