QElectroTech  0.70
propertieseditordockwidget.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 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 */
19 #include "ui_propertieseditordockwidget.h"
20 #include "propertieseditorwidget.h"
21 
28  QDockWidget(parent),
30 {
31  ui->setupUi(this);
32 }
33 
39 {
40  clear();
41  delete ui;
42 }
43 
50 {
51  foreach (PropertiesEditorWidget *editor, m_editor_list)
52  {
53  m_editor_list.removeOne(editor);
54  ui->m_main_vlayout->removeWidget(editor);
55  delete editor;
56  }
57 
58  m_editor_list.clear();
59 }
60 
66 {
67  foreach(PropertiesEditorWidget *editor, m_editor_list)
68  editor->apply();
69 }
70 
76 {
77  foreach(PropertiesEditorWidget *editor, m_editor_list)
78  editor->reset();
79 }
80 
91 {
92  if (!editor) return false;
93  if (m_editor_list.contains(editor)) return true;
94 
95  ui -> m_main_vlayout -> insertWidget(index, editor);
96  m_editor_list << editor;
97  return true;
98 }
99 
104 QList<PropertiesEditorWidget *> PropertiesEditorDockWidget::editors() const {
105  return m_editor_list;
106 }
107 
116 {
117  bool result = m_editor_list.removeOne(editor);
118  if (result)
119  ui -> m_main_vlayout -> removeWidget(editor);
120 
121  return result;
122 }
~PropertiesEditorDockWidget() override
PropertiesEditorDockWidget::~PropertiesEditorDockWidget Destructor.
PropertiesEditorDockWidget(QWidget *parent=nullptr)
PropertiesEditorDockWidget::PropertiesEditorDockWidget Constructor.
The PropertiesEditorWidget class This class extend QWidget method for have common way to edit propert...
bool removeEditor(PropertiesEditorWidget *editor)
PropertiesEditorDockWidget::removeEditor Remove from this dock. The editor wasn&#39;t delete a the end o...
virtual void reset()
PropertiesEditorDockWidget::reset Call the reset method for each editor present in this widget...
Ui::PropertiesEditorDockWidget * ui
virtual void apply()
PropertiesEditorDockWidget::apply Call the apply method for each editor present in this dock...
bool addEditor(PropertiesEditorWidget *editor, int index=0)
PropertiesEditorDockWidget::addEditor Add an in this dock at in the main vertical layout (note the ...
QList< PropertiesEditorWidget * > m_editor_list
QList< PropertiesEditorWidget * > editors() const
PropertiesEditorDockWidget::editors.
virtual void clear()
PropertiesEditorDockWidget::clear Remove all editor present in this dock and delete it...