Warning, file /office/skrooge/skgbasegui/skgfilteredtableview.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /***************************************************************************
0002  * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr
0003  * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  ***************************************************************************/
0006 #ifndef SKGFILTEREDTABLEVIEW_H
0007 #define SKGFILTEREDTABLEVIEW_H
0008 /** @file
0009  * A filetered SKGTableView.
0010  *
0011  * @author Stephane MANKOWSKI / Guillaume DE BURE
0012  */
0013 #include <qtimer.h>
0014 #include <qwidget.h>
0015 
0016 #include "skgbasegui_export.h"
0017 #include "ui_skgfilteredtableview.h"
0018 
0019 class SKGShow;
0020 class SKGObjectModelBase;
0021 
0022 /**
0023  * This file is a filetered SKGTableView
0024  */
0025 class SKGBASEGUI_EXPORT SKGFilteredTableView : public QWidget
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     /**
0031      * Default Constructor
0032      * @param iParent the parent
0033      */
0034     explicit SKGFilteredTableView(QWidget* iParent);
0035 
0036     /**
0037      * Default Destructor
0038      */
0039     ~SKGFilteredTableView() override;
0040 
0041     /**
0042      * Get the current state
0043      * @return a string containing all activated item identifiers (separated by ;)
0044      */
0045     virtual QString getState();
0046 
0047     /**
0048      * Set the current state
0049      * @param iState a string containing all activated item identifiers (separated by ;)
0050      */
0051     virtual void setState(const QString& iState);
0052 
0053     /**
0054      * @brief Get show widget
0055      *
0056      * @return SKGShow
0057      **/
0058     virtual SKGShow* getShowWidget() const;
0059 
0060     /**
0061      * @brief Get table or tree view
0062      *
0063      * @return SKGTreeView
0064      **/
0065     virtual SKGTreeView* getView() const;
0066 
0067     /**
0068      * @brief Get the search field
0069      *
0070      * @return QLineEdit
0071      **/
0072     virtual QLineEdit* getSearchField() const;
0073 
0074     /**
0075      * @brief Set model
0076      *
0077      * @param iModel the model
0078      * @return void
0079      **/
0080     virtual void setModel(SKGObjectModelBase* iModel);
0081 
0082 public Q_SLOTS:
0083     /**
0084      * @brief Set the filter. This filter disable the "show" menu
0085      *
0086      * @param iIcon the icon
0087      * @param iText the text to display
0088      * @param iWhereClause the where clause
0089      * @return void
0090      **/
0091     virtual void setFilter(const QIcon& iIcon, const QString& iText, const QString& iWhereClause);
0092 
0093     /**
0094      * @brief Reset the filter
0095      * @return void
0096      **/
0097     virtual void resetFilter();
0098 
0099 private Q_SLOTS:
0100     void pageChanged();
0101     void onFilterChanged();
0102     void onTextFilterChanged();
0103     void dataModified(const QString& iTableName, int iIdTransaction);
0104 
0105 private:
0106     Q_DISABLE_COPY(SKGFilteredTableView)
0107 
0108     Ui::skgfilteredtableview_base ui{};
0109     SKGObjectModelBase* m_objectModel;
0110     bool m_refreshNeeded;
0111     QTimer m_timer;
0112 };
0113 
0114 #endif  // SKGFILTEREDTABLEVIEW_H