File indexing completed on 2024-05-05 17:18:50
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 SKGPREDICATCREATOR_H 0007 #define SKGPREDICATCREATOR_H 0008 /** @file 0009 * A query creator for skrooge. 0010 * 0011 * @author Stephane MANKOWSKI / Guillaume DE BURE 0012 */ 0013 #include <qwidget.h> 0014 0015 #include "skgbankgui_export.h" 0016 0017 class SKGDocument; 0018 class SKGComboBox; 0019 0020 /** 0021 * This file is a query creator for skrooge 0022 */ 0023 class SKGBANKGUI_EXPORT SKGPredicatCreator : public QWidget 0024 { 0025 Q_OBJECT 0026 /** 0027 * Text of the predicat 0028 */ 0029 Q_PROPERTY(QString text READ text USER true NOTIFY xmlDescriptionChanged) 0030 0031 /** 0032 * XML description of the predicat 0033 */ 0034 Q_PROPERTY(QString xmlDescription READ xmlDescription WRITE setXmlDescription NOTIFY xmlDescriptionChanged) 0035 0036 public: 0037 /** 0038 * Default Constructor 0039 * @param iParent the parent 0040 * @param document the document 0041 * @param attribute name of the attribute 0042 * @param iModeUpdate to enable mode update 0043 * @param iListAtt list of attribute 0044 */ 0045 explicit SKGPredicatCreator(QWidget* iParent, SKGDocument* document, const QString& attribute = QString(), 0046 bool iModeUpdate = false, const QStringList& iListAtt = QStringList()); 0047 0048 /** 0049 * Default Destructor 0050 */ 0051 ~SKGPredicatCreator() override; 0052 0053 /** 0054 * Get text 0055 * @return text 0056 */ 0057 virtual QString text(); 0058 0059 /** 0060 * Get Text from XML description 0061 * @param iXML the description 0062 */ 0063 static QString getTextFromXml(const QString& iXML); 0064 0065 /** 0066 * Get XML description 0067 * @return description 0068 */ 0069 virtual QString xmlDescription(); 0070 0071 /** 0072 * Set XML description 0073 * @param iXML the description 0074 */ 0075 virtual void setXmlDescription(const QString& iXML); 0076 0077 Q_SIGNALS: 0078 /** 0079 * Sent when edition is finished 0080 */ 0081 void editingFinished(); 0082 0083 /** 0084 * Sent when edition changed 0085 */ 0086 void xmlDescriptionChanged(); 0087 0088 protected : 0089 /** 0090 * Event filtering 0091 * @param iObject object 0092 * @param iEvent event 0093 * @return In your reimplementation of this function, if you want to filter the event out, i.e. stop it being handled further, return true; otherwise return false. 0094 */ 0095 bool eventFilter(QObject* iObject, QEvent* iEvent) override; 0096 0097 private Q_SLOTS: 0098 void onOperatorChanged(); 0099 0100 private: 0101 Q_DISABLE_COPY(SKGPredicatCreator) 0102 bool m_updateMode; 0103 0104 SKGComboBox* m_kOperator; 0105 QWidget* m_kValue1; 0106 QWidget* m_kValue2; 0107 SKGComboBox* m_kAttributes; 0108 }; 0109 0110 #endif // SKGPREDICATCREATOR_H