QElectroTech  0.8-dev
elementquerywidget.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 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 ELEMENTQUERYWIDGET_H
19 #define ELEMENTQUERYWIDGET_H
20 
21 #include <QWidget>
22 #include <QButtonGroup>
23 
24 class QListWidgetItem;
25 
26 namespace Ui {
27 class ElementQueryWidget;
28 }
29 
35 class ElementQueryWidget : public QWidget
36 {
37  Q_OBJECT
38 
39  public:
40  explicit ElementQueryWidget(QWidget *parent = nullptr);
42 
43  void setQuery(const QString &query);
44  QString queryStr() const;
45  void setGroupBy(QString text, bool set = true);
46  void setCount(QString text, bool set = true);
47 
48  static QString modelIdentifier() {return "nomenclature";}
49 
50  private slots:
51  void on_m_up_pb_clicked();
52  void on_m_add_pb_clicked();
54  void on_m_down_pb_clicked();
56  void on_m_filter_le_textEdited(const QString &arg1);
57  void on_m_filter_type_cb_activated(int index);
58  void on_m_load_pb_clicked();
60  void on_m_save_name_le_textChanged(const QString &arg1);
61  void on_m_choosen_list_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
62  void on_m_var_list_itemDoubleClicked(QListWidgetItem *item);
63  void on_m_choosen_list_itemDoubleClicked(QListWidgetItem *item);
64 
65  void updateQueryLine();
66  QStringList selectedKeys() const;
67  void setUpItems();
68  QPair<int, QString> FilterFor(const QString &key) const;
69  void fillSavedQuery();
70 
71 
72  void reset();
73 
74  private:
75  Ui::ElementQueryWidget *ui;
76  QHash <QString, QString> m_export_info;
77  QButtonGroup m_button_group;
78  QList <QListWidgetItem *> m_items_list;
79  QString m_custom_query,
82  QHash <QString, QPair<int, QString>> m_filter;
83 };
84 
85 #endif // ELEMENTQUERYWIDGET_H
ElementQueryWidget::fillSavedQuery
void fillSavedQuery()
ElementQueryWidget::fillSavedQuery Fill the combobox of saved queries.
Definition: elementquerywidget.cpp:475
ElementQueryWidget::on_m_remove_pb_clicked
void on_m_remove_pb_clicked()
ElementQueryWidget::on_m_remove_pb_clicked.
Definition: elementquerywidget.cpp:521
ElementQueryWidget::m_button_group
QButtonGroup m_button_group
Definition: elementquerywidget.h:77
ElementQueryWidget::m_filter
QHash< QString, QPair< int, QString > > m_filter
Definition: elementquerywidget.h:82
QETApp::elementInfoKeys
static QStringList elementInfoKeys()
QETApp::elementInfoKeys.
Definition: qetapp.cpp:366
ElementQueryWidget::reset
void reset()
ElementQueryWidget::reset Clear this widget aka set to initial state.
Definition: elementquerywidget.cpp:695
ElementQueryWidget::on_m_filter_type_cb_activated
void on_m_filter_type_cb_activated(int index)
ElementQueryWidget::on_m_filter_type_cb_activated.
Definition: elementquerywidget.cpp:588
ElementQueryWidget::FilterFor
QPair< int, QString > FilterFor(const QString &key) const
ElementQueryWidget::FilterFor.
Definition: elementquerywidget.cpp:467
ElementQueryWidget
The ElementQueryWidget class A widget use to edit a sql query for get element information This widget...
Definition: elementquerywidget.h:36
ElementQueryWidget::on_m_filter_le_textEdited
void on_m_filter_le_textEdited(const QString &arg1)
ElementQueryWidget::on_m_filter_le_textEdited.
Definition: elementquerywidget.cpp:571
ElementQueryWidget::on_m_save_current_conf_pb_clicked
void on_m_save_current_conf_pb_clicked()
ElementQueryWidget::on_m_save_current_conf_pb_clicked Save the actual query to nomenclature....
Definition: elementquerywidget.cpp:636
elementquerywidget.h
ElementQueryWidget::m_custom_query
QString m_custom_query
Definition: elementquerywidget.h:79
qetapp.h
QETApp::elementTranslatedInfoKey
static QString elementTranslatedInfoKey(const QString &)
ElementsProperties::translatedInfo Return the translated information key given by info If info don't ...
Definition: qetapp.cpp:400
ElementQueryWidget::on_m_add_pb_clicked
void on_m_add_pb_clicked()
ElementQueryWidget::on_m_add_pb_clicked.
Definition: elementquerywidget.cpp:509
ElementQueryWidget::selectedKeys
QStringList selectedKeys() const
ElementQueryWidget::selectedKeys.
Definition: elementquerywidget.cpp:424
ElementQueryWidget::m_group_by
QString m_group_by
Definition: elementquerywidget.h:80
ElementQueryWidget::queryStr
QString queryStr() const
ElementQueryWidget::queryStr.
Definition: elementquerywidget.cpp:277
ElementQueryWidget::m_export_info
QHash< QString, QString > m_export_info
Definition: elementquerywidget.h:76
ElementQueryWidget::on_m_load_pb_clicked
void on_m_load_pb_clicked()
ElementQueryWidget::on_m_load_pb_clicked Load a query from nomenclature.json file.
Definition: elementquerywidget.cpp:606
ElementQueryWidget::on_m_save_name_le_textChanged
void on_m_save_name_le_textChanged(const QString &arg1)
Definition: elementquerywidget.cpp:663
ElementQueryWidget::ElementQueryWidget
ElementQueryWidget(QWidget *parent=nullptr)
ElementQueryWidget::ElementQueryWidget.
Definition: elementquerywidget.cpp:28
QET::Icons::it
QIcon it
Definition: qeticons.cpp:196
Ui
Definition: autonumberingdockwidget.h:25
ElementQueryWidget::~ElementQueryWidget
~ElementQueryWidget()
ElementQueryWidget::~ElementQueryWidget.
Definition: elementquerywidget.cpp:101
ElementQueryWidget::on_m_choosen_list_itemDoubleClicked
void on_m_choosen_list_itemDoubleClicked(QListWidgetItem *item)
Definition: elementquerywidget.cpp:686
ElementQueryWidget::on_m_up_pb_clicked
void on_m_up_pb_clicked()
ElementQueryWidget::on_m_up_pb_clicked.
Definition: elementquerywidget.cpp:492
ElementQueryWidget::ui
Ui::ElementQueryWidget * ui
Definition: elementquerywidget.h:75
ElementQueryWidget::on_m_var_list_itemDoubleClicked
void on_m_var_list_itemDoubleClicked(QListWidgetItem *item)
Definition: elementquerywidget.cpp:681
ElementQueryWidget::setQuery
void setQuery(const QString &query)
ElementQueryWidget::setQuery.
Definition: elementquerywidget.cpp:111
ElementQueryWidget::m_items_list
QList< QListWidgetItem * > m_items_list
Definition: elementquerywidget.h:78
ElementQueryWidget::setUpItems
void setUpItems()
ElementQueryWidget::setUpItems.
Definition: elementquerywidget.cpp:441
ElementQueryWidget::on_m_choosen_list_currentItemChanged
void on_m_choosen_list_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
Definition: elementquerywidget.cpp:667
ElementQueryWidget::m_count
QString m_count
Definition: elementquerywidget.h:81
ElementQueryWidget::on_m_down_pb_clicked
void on_m_down_pb_clicked()
ElementQueryWidget::on_m_down_pb_clicked.
Definition: elementquerywidget.cpp:533
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
ElementQueryWidget::updateQueryLine
void updateQueryLine()
ElementQueryWidget::updateQueryLine.
Definition: elementquerywidget.cpp:416
QETApp::configDir
static QString configDir()
QETApp::configDir Return the QET configuration folder, i.e. the path to the folder in which QET will ...
Definition: qetapp.cpp:805
ElementQueryWidget::setGroupBy
void setGroupBy(QString text, bool set=true)
ElementQueryWidget::setGroupBy Add the query instruction GROUP BY.
Definition: elementquerywidget.cpp:382
ElementQueryWidget::setCount
void setCount(QString text, bool set=true)
ElementQueryWidget::setCount Add the query instruction COUNT. Unlike setGroupBy, you have to write th...
Definition: elementquerywidget.cpp:403
ElementQueryWidget::on_m_edit_sql_query_cb_clicked
void on_m_edit_sql_query_cb_clicked()
ElementQueryWidget::on_m_edit_sql_query_cb_clicked.
Definition: elementquerywidget.cpp:550
ElementQueryWidget::modelIdentifier
static QString modelIdentifier()
Definition: elementquerywidget.h:48