/* PIQt Utils - Qt utilites for PIP Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef pivaluetree_edit_H #define pivaluetree_edit_H #include #include #include "pivaluetree.h" #include "qad_piqt_utils_export.h" class QGridLayout; class PIVariantEdit; namespace Ui { class PIValueTreeEditArray; } class QAD_PIQT_UTILS_EXPORT PIValueTreeEdit: public QWidget { public: PIValueTreeEdit(QWidget * parent = nullptr); ~PIValueTreeEdit(); enum TreeStyle { Label }; void setValue(const PIValueTree & v); PIValueTree value() const; void setGroupingEnabled(bool yes); void rollback(); void clear(); private: void removeAll(); void build(); void applyValues() const; class GridWidgets: public QWidget { public: int rowCount() const {return row_count;} void removeRow(int index); void add(QString label, QWidget * w, const QString & comment); void add(QWidget * w); void clear(); private: void simplify(); int row_count = 0; QGridLayout * lay = nullptr; QWidgetList widgets; }; QWidget * ui_array = nullptr; PIVector array_edits; PIMap value_edits; PIMap tree_edits; Ui::PIValueTreeEditArray * ui; GridWidgets * grid = nullptr; mutable PIValueTree source; bool is_grouping = true; }; #endif