QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
jumptoelementdialog.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2026 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef JUMPTOELEMENTDIALOG_H
19#define JUMPTOELEMENTDIALOG_H
20
21#include <QDialog>
22#include <QPointer>
23
24class Diagram;
25class Element;
26class QLineEdit;
27class QListWidget;
28
37class JumpToElementDialog : public QDialog
38{
39 Q_OBJECT
40
41 public:
42 explicit JumpToElementDialog(Diagram *diagram, QWidget *parent = nullptr);
43 ~JumpToElementDialog() override;
44
45 protected:
46 bool eventFilter(QObject *watched, QEvent *event) override;
47
48 private slots:
49 void updateFilteredList(const QString &filter_text);
51
52 private:
53 void buildCandidates();
54
55 struct Candidate {
56 QPointer<Element> element;
57 QString display_text;
58 QString search_text;
59 };
60
61 QPointer<Diagram> m_diagram;
62 QList<Candidate> m_candidates;
63 QLineEdit *m_filter_edit;
64 QListWidget *m_result_list;
65};
66
67#endif // JUMPTOELEMENTDIALOG_H
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition diagram.h:54
Definition element.h:44
QList< Candidate > m_candidates
Definition jumptoelementdialog.h:62
JumpToElementDialog(Diagram *diagram, QWidget *parent=nullptr)
JumpToElementDialog::JumpToElementDialog.
Definition jumptoelementdialog.cpp:34
QListWidget * m_result_list
Definition jumptoelementdialog.h:64
QPointer< Diagram > m_diagram
Definition jumptoelementdialog.h:61
void activateCurrentItem()
JumpToElementDialog::activateCurrentItem Select the element corresponding to the currently highlighte...
Definition jumptoelementdialog.cpp:136
bool eventFilter(QObject *watched, QEvent *event) override
JumpToElementDialog::eventFilter Redirect Up/Down/Enter/Escape typed in the filter field to the resul...
Definition jumptoelementdialog.cpp:168
void buildCandidates()
JumpToElementDialog::buildCandidates Collect every element on m_diagram into m_candidates,...
Definition jumptoelementdialog.cpp:71
~JumpToElementDialog() override
Definition jumptoelementdialog.cpp:61
QLineEdit * m_filter_edit
Definition jumptoelementdialog.h:63
void updateFilteredList(const QString &filter_text)
JumpToElementDialog::updateFilteredList Refill m_result_list with every candidate whose search text c...
Definition jumptoelementdialog.cpp:109
Definition jumptoelementdialog.h:55
QString display_text
Definition jumptoelementdialog.h:57
QString search_text
Definition jumptoelementdialog.h:58
QPointer< Element > element
Definition jumptoelementdialog.h:56