File indexing completed on 2024-05-05 17:18:51
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 SKGUNITCOMBOBOX_H 0007 #define SKGUNITCOMBOBOX_H 0008 /** @file 0009 * This file defines classes SKGUnitComboBox. 0010 * 0011 * @author Stephane MANKOWSKI / Guillaume DE BURE 0012 */ 0013 #include "skgbankgui_export.h" 0014 #include "skgcombobox.h" 0015 #include "skgunitobject.h" 0016 0017 class SKGDocumentBank; 0018 0019 /** 0020 * This class is a unit 0021 */ 0022 class SKGBANKGUI_EXPORT SKGUnitComboBox : public SKGComboBox 0023 { 0024 Q_OBJECT 0025 /** 0026 * the current unit 0027 */ 0028 Q_PROPERTY(SKGUnitObject unit READ getUnit WRITE setUnit NOTIFY unitChanged) 0029 0030 public: 0031 /** 0032 * Default Constructor 0033 * @param iParent the parent 0034 */ 0035 explicit SKGUnitComboBox(QWidget* iParent); 0036 0037 /** 0038 * Default Destructor 0039 */ 0040 ~SKGUnitComboBox() override; 0041 0042 /** 0043 * Set the current document 0044 * @param iDocument the current document 0045 */ 0046 virtual void setDocument(SKGDocumentBank* iDocument); 0047 0048 /** 0049 * Set the condition to selection the list of units to display 0050 * @param iCondition the condition (Default= "t_type!='I'") 0051 */ 0052 virtual void setWhereClauseCondition(const QString& iCondition); 0053 0054 /** 0055 * Get the current unit 0056 * The unit will be created if not existing 0057 * @return the current unit 0058 */ 0059 virtual SKGUnitObject getUnit(); 0060 0061 /** 0062 * Set the current unit 0063 * @param iUnit the current unit 0064 */ 0065 virtual void setUnit(const SKGUnitObject& iUnit); 0066 0067 public Q_SLOTS: 0068 /** 0069 * To refresh the list of the combo 0070 */ 0071 virtual void refershList(); 0072 0073 Q_SIGNALS: 0074 /** 0075 * Emitted when the unit is changed 0076 */ 0077 void unitChanged(); 0078 0079 private Q_SLOTS: 0080 void dataModified(const QString& iTableName, int iIdTransaction); 0081 0082 private: 0083 SKGDocumentBank* m_document; 0084 QString m_fillWhereClause; 0085 }; 0086 0087 #endif // SKGUNITCOMBOBOX_H