[qet] qet/qet: [5057] Element editor : element informations (manufacturer, reference etc...) can be created directly from the element editor.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 5057
Author:   blacksun
Date:     2017-10-01 17:25:34 +0200 (Sun, 01 Oct 2017)
Log Message:
-----------
Element editor : element informations (manufacturer, reference etc...) can be created directly from the element editor. For that go to the widget "Element Property"

Modified Paths:
--------------
    trunk/sources/editor/editorcommands.cpp
    trunk/sources/editor/editorcommands.h
    trunk/sources/editor/elementscene.cpp
    trunk/sources/editor/elementscene.h
    trunk/sources/editor/ui/elementpropertieseditorwidget.cpp
    trunk/sources/editor/ui/elementpropertieseditorwidget.h
    trunk/sources/editor/ui/elementpropertieseditorwidget.ui
    trunk/sources/qetgraphicsitem/customelement.cpp
    trunk/sources/qetgraphicsitem/element.h

Modified: trunk/sources/editor/editorcommands.cpp
===================================================================
--- trunk/sources/editor/editorcommands.cpp	2017-10-01 08:00:34 UTC (rev 5056)
+++ trunk/sources/editor/editorcommands.cpp	2017-10-01 15:25:34 UTC (rev 5057)
@@ -23,8 +23,8 @@
 */
 ElementEditionCommand::ElementEditionCommand(ElementScene *scene, ElementView *view, QUndoCommand *parent):
 	QUndoCommand(parent),
-	editor_scene_(scene),
-	editor_view_(view)
+	m_scene(scene),
+	m_view(view)
 {
 }
 
@@ -35,8 +35,8 @@
 */
 ElementEditionCommand::ElementEditionCommand(const QString &text, ElementScene *scene, ElementView *view, QUndoCommand *parent):
 	QUndoCommand(text, parent),
-	editor_scene_(scene),
-	editor_view_(view)
+	m_scene(scene),
+	m_view(view)
 {
 }
 
@@ -50,7 +50,7 @@
 	@return the element editor/scene the command should take place on
 */
 ElementScene *ElementEditionCommand::elementScene() const {
-	return(editor_scene_);
+	return(m_scene);
 }
 
 /**
@@ -57,7 +57,7 @@
 	Define \a scene as the element editor/scene the command should take place
 */
 void ElementEditionCommand::setElementScene(ElementScene *scene) {
-	editor_scene_ = scene;
+	m_scene = scene;
 }
 
 /**
@@ -64,7 +64,7 @@
 	@return the view the effect of the command should be rendered on
 */
 ElementView *ElementEditionCommand::elementView() const {
-	return(editor_view_);
+	return(m_view);
 }
 
 /**
@@ -71,7 +71,7 @@
 	Define \a view as the view the effect of the command should be rendered on
 */
 void ElementEditionCommand::setElementView(ElementView *view) {
-	editor_view_ = view;
+	m_view = view;
 }
 
 /*** DeletePartsCommand ***/
@@ -90,7 +90,7 @@
 	deleted_parts(parts)
 {
 	foreach(QGraphicsItem *qgi, deleted_parts) {
-		editor_scene_ -> qgiManager().manage(qgi);
+		m_scene -> qgiManager().manage(qgi);
 	}
 }
 
@@ -97,26 +97,26 @@
 /// Destructeur : detruit egalement les parties supprimees
 DeletePartsCommand::~DeletePartsCommand() {
 	foreach(QGraphicsItem *qgi, deleted_parts) {
-		editor_scene_ -> qgiManager().release(qgi);
+		m_scene -> qgiManager().release(qgi);
 	}
 }
 
 /// Restaure les parties supprimees
 void DeletePartsCommand::undo() {
-	editor_scene_ -> blockSignals(true);
+	m_scene -> blockSignals(true);
 	foreach(QGraphicsItem *qgi, deleted_parts) {
-		editor_scene_ -> addItem(qgi);
+		m_scene -> addItem(qgi);
 	}
-	editor_scene_ -> blockSignals(false);
+	m_scene -> blockSignals(false);
 }
 
 /// Supprime les parties
 void DeletePartsCommand::redo() {
-	editor_scene_ -> blockSignals(true);
+	m_scene -> blockSignals(true);
 	foreach(QGraphicsItem *qgi, deleted_parts) {
-		editor_scene_ -> removeItem(qgi);
+		m_scene -> removeItem(qgi);
 	}
-	editor_scene_ -> blockSignals(false);
+	m_scene -> blockSignals(false);
 }
 
 /*** CutPartsCommand ***/
@@ -137,27 +137,27 @@
 	first_redo(true)
 {
 	setText(QObject::tr("coller"));
-	editor_scene_ -> qgiManager().manage(content_);
+	m_scene -> qgiManager().manage(content_);
 }
 
 /// Destructeur
 PastePartsCommand::~PastePartsCommand() {
-	editor_scene_ -> qgiManager().release(content_);
+	m_scene -> qgiManager().release(content_);
 }
 
 /// annule le coller
 void PastePartsCommand::undo() {
 	// enleve les parties
-	editor_scene_ -> blockSignals(true);
+	m_scene -> blockSignals(true);
 	foreach(QGraphicsItem *part, content_) {
-		editor_scene_ -> removeItem(part);
+		m_scene -> removeItem(part);
 	}
-	editor_scene_ -> blockSignals(false);
+	m_scene -> blockSignals(false);
 	if (uses_offset) {
-		editor_view_ -> offset_paste_count_    = old_offset_paste_count_;
-		editor_view_ -> start_top_left_corner_ = old_start_top_left_corner_;
+		m_view -> offset_paste_count_    = old_offset_paste_count_;
+		m_view -> start_top_left_corner_ = old_start_top_left_corner_;
 	}
-	editor_view_ -> adjustSceneRect();
+	m_view -> adjustSceneRect();
 }
 
 /// refait le coller
@@ -165,18 +165,18 @@
 	if (first_redo) first_redo = false;
 	else {
 		// pose les parties
-		editor_scene_ -> blockSignals(true);
+		m_scene -> blockSignals(true);
 		foreach(QGraphicsItem *part, content_) {
-			editor_scene_ -> addItem(part);
+			m_scene -> addItem(part);
 		}
-		editor_scene_ -> blockSignals(false);
+		m_scene -> blockSignals(false);
 		if (uses_offset) {
-			editor_view_ -> offset_paste_count_    = new_offset_paste_count_;
-			editor_view_ -> start_top_left_corner_ = new_start_top_left_corner_;
+			m_view -> offset_paste_count_    = new_offset_paste_count_;
+			m_view -> start_top_left_corner_ = new_start_top_left_corner_;
 		}
 	}
-	editor_scene_ -> slot_select(content_);
-	editor_view_ -> adjustSceneRect();
+	m_scene -> slot_select(content_);
+	m_view -> adjustSceneRect();
 }
 
 /**
@@ -271,17 +271,17 @@
 	part(p),
 	first_redo(true)
 {
-	editor_scene_ -> qgiManager().manage(part);
+	m_scene -> qgiManager().manage(part);
 }
 
 /// Destructeur
 AddPartCommand::~AddPartCommand() {
-	editor_scene_ -> qgiManager().release(part);
+	m_scene -> qgiManager().release(part);
 }
 
 /// Annule l'ajout
 void AddPartCommand::undo() {
-	editor_scene_ -> removeItem(part);
+	m_scene -> removeItem(part);
 }
 
 /// Refait l'ajout
@@ -291,15 +291,15 @@
 		if (!part -> zValue()) {
 			// the added part has no specific zValue already defined, we put it
 			// above existing items (but still under terminals)
-			QList<QGraphicsItem *> existing_items = editor_scene_ -> zItems(ElementScene::SortByZValue | ElementScene::SelectedOrNot);
+			QList<QGraphicsItem *> existing_items = m_scene -> zItems(ElementScene::SortByZValue | ElementScene::SelectedOrNot);
 			qreal z = existing_items.count() ? existing_items.last() -> zValue() + 1 : 1;
 			part -> setZValue(z);
 		}
-		editor_scene_ -> clearSelection();
+		m_scene -> clearSelection();
 		first_redo = false;
 		return;
 	}
-	editor_scene_ -> addItem(part);
+	m_scene -> addItem(part);
 }
 
 /**
@@ -327,12 +327,12 @@
 
 /// Annule le changement
 void ChangeNamesCommand::undo() {
-	editor_scene_ -> setNames(names_before);
+	m_scene -> setNames(names_before);
 }
 
 /// Refait le changement
 void ChangeNamesCommand::redo() {
-	editor_scene_ -> setNames(names_after);
+	m_scene -> setNames(names_after);
 }
 
 /**
@@ -350,7 +350,7 @@
 	option(o)
 {
 	// retrieve all primitives but terminals
-	QList<QGraphicsItem *> items_list = editor_scene_ -> zItems(ElementScene::SortByZValue | ElementScene::SelectedOrNot);
+	QList<QGraphicsItem *> items_list = m_scene -> zItems(ElementScene::SortByZValue | ElementScene::SelectedOrNot);
 	
 	// prend un snapshot des zValues
 	foreach(QGraphicsItem *qgi, items_list) undo_hash.insert(qgi, qgi -> zValue());
@@ -478,12 +478,12 @@
 
 /// Annule le changement d'autorisation pour les connexions internes
 void ChangeInformationsCommand::undo() {
-	editor_scene_ -> setInformations(old_informations_);
+	m_scene -> setInformations(old_informations_);
 }
 
 /// Refait le changement d'autorisation pour les connexions internes
 void ChangeInformationsCommand::redo() {
-	editor_scene_ -> setInformations(new_informations_);
+	m_scene -> setInformations(new_informations_);
 }
 
 /**
@@ -524,7 +524,7 @@
 	@return the element editor/scene the command should take place on
 */
 ElementScene *ScalePartsCommand::elementScene() const {
-	return(editor_scene_);
+	return(m_scene);
 }
 
 /**
@@ -593,11 +593,12 @@
  * @param context: new info about type.
  * @param parent: parent undo
  */
-ChangePropertiesCommand::ChangePropertiesCommand(ElementScene *scene, QString type, DiagramContext info, QUndoCommand *parent) :
+ChangePropertiesCommand::ChangePropertiesCommand(ElementScene *scene, QString type, DiagramContext info, DiagramContext elmt_info, QUndoCommand *parent) :
 	ElementEditionCommand(scene, nullptr, parent)
 {
 	m_type << scene->m_elmt_type << type;
-	m_info << scene->m_elmt_kindInfo << info;
+	m_kind_info << scene->m_elmt_kindInfo << info;
+	m_elmt_info << scene->m_elmt_information << elmt_info;
 	setText(QObject::tr("Modifier les propriétés"));
 }
 
@@ -604,13 +605,15 @@
 ChangePropertiesCommand::~ChangePropertiesCommand() {}
 
 void ChangePropertiesCommand::undo() {
-	editor_scene_-> m_elmt_type = m_type.first();
-	editor_scene_-> m_elmt_kindInfo = m_info.first();
+	m_scene->m_elmt_type = m_type.first();
+	m_scene->m_elmt_kindInfo = m_kind_info.first();
+	m_scene->m_elmt_information = m_elmt_info.first();
 }
 
 void ChangePropertiesCommand::redo() {
-	editor_scene_-> m_elmt_type = m_type.last();
-	editor_scene_-> m_elmt_kindInfo = m_info.last();
+	m_scene->m_elmt_type = m_type.last();
+	m_scene->m_elmt_kindInfo = m_kind_info.last();
+	m_scene->m_elmt_information = m_elmt_info.last();
 }
 
 

Modified: trunk/sources/editor/editorcommands.h
===================================================================
--- trunk/sources/editor/editorcommands.h	2017-10-01 08:00:34 UTC (rev 5056)
+++ trunk/sources/editor/editorcommands.h	2017-10-01 15:25:34 UTC (rev 5057)
@@ -49,8 +49,8 @@
 		// attributes
 	protected:
 		/// Element editor/view/scene the command should take place on
-		ElementScene *editor_scene_;
-		ElementView *editor_view_;
+		ElementScene *m_scene;
+		ElementView *m_view;
 };
 
 /**
@@ -296,7 +296,7 @@
 
 class ChangePropertiesCommand : public ElementEditionCommand {
 	public:
-	ChangePropertiesCommand (ElementScene *scene, QString type, DiagramContext info, QUndoCommand *parent=nullptr);
+	ChangePropertiesCommand (ElementScene *scene, QString type, DiagramContext info, DiagramContext elmt_info, QUndoCommand *parent=nullptr);
 	~ChangePropertiesCommand () override;
 
 	void undo() override;
@@ -304,7 +304,8 @@
 
 	private:
 	QList <QString> m_type;
-	QList <DiagramContext> m_info;
+	QList <DiagramContext> m_kind_info;
+	QList < DiagramContext> m_elmt_info;
 };
 
 #endif

Modified: trunk/sources/editor/elementscene.cpp
===================================================================
--- trunk/sources/editor/elementscene.cpp	2017-10-01 08:00:34 UTC (rev 5056)
+++ trunk/sources/editor/elementscene.cpp	2017-10-01 15:25:34 UTC (rev 5057)
@@ -341,6 +341,13 @@
 		root.appendChild(kindInfo);
 	}
 	
+	if(m_elmt_type == "simple" || m_elmt_type == "master" || m_elmt_type == "terminal")
+	{
+		QDomElement element_info = xml_document.createElement("elementInformations");
+		m_elmt_information.toXml(element_info, "elementInformation");
+		root.appendChild(element_info);
+	}
+	
 		//complementary information about the element
 	QDomElement informations_element = xml_document.createElement("informations");
 	root.appendChild(informations_element);
@@ -638,13 +645,19 @@
  * @brief ElementScene::slot_editProperties
  * Open dialog to edit the element properties
  */
-void  ElementScene::slot_editProperties() {
+void  ElementScene::slot_editProperties()
+{
 	QString type = m_elmt_type;
-	DiagramContext info = m_elmt_kindInfo;
-	ElementPropertiesEditorWidget epew(type, info);
+	DiagramContext kind_info = m_elmt_kindInfo;
+	DiagramContext elmt_info = m_elmt_information;
+	
+	ElementPropertiesEditorWidget epew(type, kind_info, elmt_info);
 	epew.exec();
-	if (type != m_elmt_type || info != m_elmt_kindInfo)
-		undoStack().push(new ChangePropertiesCommand(this, type, info));
+	
+	if (type != m_elmt_type ||
+		kind_info != m_elmt_kindInfo ||
+		elmt_info != m_elmt_information)
+		undoStack().push(new ChangePropertiesCommand(this, type, kind_info, elmt_info));
 }
 
 /**
@@ -874,9 +887,11 @@
 	if (root.tagName() != "definition" || root.attribute("type") != "element")
 		return(false);
 
-	//Extract info about element type
+		//Extract info about element type
 	m_elmt_type = root.attribute("link_type", "simple");
 	m_elmt_kindInfo.fromXml(root.firstChildElement("kindInformations"), "kindInformation");
+		//Extract info of element
+	m_elmt_information.fromXml(root.firstChildElement("elementInformations"), "elementInformation");
 
 	//Extract names of xml definition
 	m_names_list.fromXml(root);

Modified: trunk/sources/editor/elementscene.h
===================================================================
--- trunk/sources/editor/elementscene.h	2017-10-01 08:00:34 UTC (rev 5056)
+++ trunk/sources/editor/elementscene.h	2017-10-01 15:25:34 UTC (rev 5057)
@@ -61,19 +61,20 @@
 	private:
 		ElementScene(const ElementScene &);
 	
-	// attributes
+		// attributes
 	private:
-		/// List of localized names
+			/// List of localized names
 		NamesList m_names_list;
-		/// Extra informations
+			/// Extra informations
 		QString m_informations;
-		/// element type
+			/// element type
 		QString m_elmt_type;
-		/// element kind info
-		DiagramContext m_elmt_kindInfo;
-		/// QGraphicsItem manager
+			/// element kind info
+		DiagramContext m_elmt_kindInfo,
+					   m_elmt_information;
+			/// QGraphicsItem manager
 		QGIManager m_qgi_manager;
-		/// Undo stack
+			/// Undo stack
 		QUndoStack m_undo_stack;
 	
 			/// Variables related to drawing

Modified: trunk/sources/editor/ui/elementpropertieseditorwidget.cpp
===================================================================
--- trunk/sources/editor/ui/elementpropertieseditorwidget.cpp	2017-10-01 08:00:34 UTC (rev 5056)
+++ trunk/sources/editor/ui/elementpropertieseditorwidget.cpp	2017-10-01 15:25:34 UTC (rev 5057)
@@ -17,23 +17,51 @@
 */
 #include "elementpropertieseditorwidget.h"
 #include "ui_elementpropertieseditorwidget.h"
+#include "qetapp.h"
 
+#include <QItemDelegate>
+
 /**
+ * @brief The EditorDelegate class
+ * This delegate is only use for disable the edition of the first
+ * column of the information tree widget
+ */
+class EditorDelegate : public QItemDelegate
+{
+	public:
+		EditorDelegate(QObject *parent) :
+			QItemDelegate(parent)
+		{}
+
+	QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
+	{
+		if(index.column() == 1)
+		{
+			return QItemDelegate::createEditor(parent, option, index);
+		}
+		return nullptr;
+	}
+};
+
+/**
  * @brief ElementPropertiesEditorWidget::ElementPropertiesEditorWidget
  * Default constructor
  * @param basic_type : QString of the drawed element
- * @param dc : DiagramContext to store kindInfo of drawed element
+ * @param kind_info : DiagramContext to store kindInfo of drawed element
+ * @param elmt_info : the information of element (label, manufacturer etc...]
  * @param parent : parent widget
  */
-ElementPropertiesEditorWidget::ElementPropertiesEditorWidget(QString &basic_type, DiagramContext &dc, QWidget *parent) :
+ElementPropertiesEditorWidget::ElementPropertiesEditorWidget(QString &basic_type, DiagramContext &kind_info, DiagramContext &elmt_info, QWidget *parent) :
 	QDialog(parent),
 	ui(new Ui::ElementPropertiesEditorWidget),
 	m_basic_type(basic_type),
-	m_dc (dc)
+	m_kind_info (kind_info),
+	m_elmt_info (elmt_info)
 {
 	ui->setupUi(this);
 	setUpInterface();
 	upDateInterface();
+	qDebug() << "const";
 }
 
 /**
@@ -49,17 +77,18 @@
  * @brief ElementPropertiesEditorWidget::upDateInterface
  * Update the interface with the curent value
  */
-void ElementPropertiesEditorWidget::upDateInterface() {
-	ui -> m_base_type_cb -> setCurrentIndex (ui -> m_base_type_cb -> findData (QVariant(m_basic_type)));
-
-	if (m_basic_type == "slave") {
-		ui -> m_state_cb	 -> setCurrentIndex (ui -> m_state_cb	  -> findData (m_dc["state"].toString()));
-		ui -> m_type_cb		 -> setCurrentIndex (ui -> m_type_cb	  -> findData (m_dc["type"].toString()));
-		ui -> m_number_ctc	 -> setValue		(m_dc["number"].toInt());
+void ElementPropertiesEditorWidget::upDateInterface()
+{
+	ui->m_base_type_cb->setCurrentIndex(ui->m_base_type_cb->findData(QVariant(m_basic_type)));
+	
+	if (m_basic_type == "slave")
+	{
+		ui->m_state_cb->setCurrentIndex(ui->m_state_cb->findData(m_kind_info["state"].toString()));
+		ui->m_type_cb->setCurrentIndex (ui->m_type_cb->findData(m_kind_info["type"].toString()));
+		ui->m_number_ctc->setValue(m_kind_info["number"].toInt());
 	}
-
 	else if (m_basic_type == "master") {
-		ui -> m_master_type_cb -> setCurrentIndex (ui -> m_master_type_cb -> findData (m_dc["type"]));
+		ui->m_master_type_cb->setCurrentIndex(ui->m_master_type_cb->findData (m_kind_info["type"]));
 	}
 
 	on_m_base_type_cb_currentIndexChanged(ui->m_base_type_cb->currentIndex());
@@ -68,31 +97,74 @@
 /**
  * @brief ElementPropertiesEditorWidget::setUpInterface
  */
-void ElementPropertiesEditorWidget::setUpInterface() {
-	// Type combo box
-	ui -> m_base_type_cb -> addItem (tr("Simple"),							QVariant("simple"));
-	ui -> m_base_type_cb -> addItem (tr("Maître"),						QVariant("master"));
-	ui -> m_base_type_cb -> addItem (tr("Esclave"),							QVariant("slave"));
-	ui -> m_base_type_cb -> addItem (tr("Renvoi de folio suivant"),			QVariant("next_report"));
-	ui -> m_base_type_cb -> addItem (tr("Renvoi de folio précédent"), QVariant("previous_report"));
-	ui -> m_base_type_cb -> addItem (tr("Bornier"),                         QVariant("terminal"));
+void ElementPropertiesEditorWidget::setUpInterface()
+{
+		// Type combo box
+	ui->m_base_type_cb->addItem (tr("Simple"),					  QVariant("simple"));
+	ui->m_base_type_cb->addItem (tr("Maître"),					  QVariant("master"));
+	ui->m_base_type_cb->addItem (tr("Esclave"),					  QVariant("slave"));
+	ui->m_base_type_cb->addItem (tr("Renvoi de folio suivant"),	  QVariant("next_report"));
+	ui->m_base_type_cb->addItem (tr("Renvoi de folio précédent"), QVariant("previous_report"));
+	ui->m_base_type_cb->addItem (tr("Bornier"),                   QVariant("terminal"));
 
-	// Slave option
-	ui -> m_state_cb -> addItem(tr("Normalement ouvert"),   QVariant("NO"));
-	ui -> m_state_cb -> addItem(tr("Normalement fermé"), QVariant("NC"));
-	ui -> m_state_cb -> addItem(tr("Inverseur"),			QVariant("SW"));
-	ui -> m_type_cb  -> addItem(tr("Simple"),				QVariant("simple"));
-	ui -> m_type_cb  -> addItem(tr("Puissance"),			QVariant("power"));
-	ui -> m_type_cb  -> addItem(tr("Temporisé travail"), QVariant("delayOn"));
-	ui -> m_type_cb  -> addItem(tr("Temporisé repos"),	QVariant("delayOff"));
+		// Slave option
+	ui->m_state_cb->addItem(tr("Normalement ouvert"),QVariant("NO"));
+	ui->m_state_cb->addItem(tr("Normalement fermé"), QVariant("NC"));
+	ui->m_state_cb->addItem(tr("Inverseur"),		 QVariant("SW"));
+	ui->m_type_cb->addItem(tr("Simple"),			 QVariant("simple"));
+	ui->m_type_cb->addItem(tr("Puissance"),			QVariant("power"));
+	ui->m_type_cb->addItem(tr("Temporisé travail"), QVariant("delayOn"));
+	ui->m_type_cb->addItem(tr("Temporisé repos"),	QVariant("delayOff"));
 
-	//Master option
-	ui -> m_master_type_cb -> addItem(tr("Bobine"),				  QVariant("coil"));
-	ui -> m_master_type_cb -> addItem(tr("Organe de protection"), QVariant("protection"));
-	ui -> m_master_type_cb -> addItem(tr("Commutateur / bouton"), QVariant("commutator"));
+		//Master option
+	ui->m_master_type_cb->addItem(tr("Bobine"),				  QVariant("coil"));
+	ui->m_master_type_cb->addItem(tr("Organe de protection"), QVariant("protection"));
+	ui->m_master_type_cb->addItem(tr("Commutateur / bouton"), QVariant("commutator"));
+	
+		//Disable the edition of the first column of the information tree
+		//by this little workaround
+	ui->m_tree->setItemDelegate(new EditorDelegate(this));
+	ui->m_tree->header()->resizeSection(0, 150);
+	populateTree();
 }
 
+void ElementPropertiesEditorWidget::updateTree()
+{
+	QString type = ui->m_base_type_cb->itemData(ui->m_base_type_cb->currentIndex()).toString();
+	
+	if (type == "master")
+		ui->m_tree->setEnabled(true);
+	else if (type == "slave")
+		ui->m_tree->setDisabled(true);
+	else if (type == "simple")
+		ui->m_tree->setEnabled(true);
+	else if (type == "next_report")
+		ui->m_tree->setDisabled(true);
+	else if (type == "previous_report")
+		ui->m_tree->setDisabled(true);
+	else if (type == "terminal")
+		ui->m_tree->setEnabled(true);
+}
+
 /**
+ * @brief ElementPropertiesEditorWidget::populateTree
+ * Create QTreeWidgetItem of the tree widget and populate it
+ */
+void ElementPropertiesEditorWidget::populateTree()
+{
+	QStringList keys{"label", "comment", "designation", "manufacturer", "manufacturer-reference", "machine-manufacturer-reference"};
+	
+	for(QString key : keys)
+	{
+		QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_tree);
+		qtwi->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable);
+		qtwi->setData(0, Qt::DisplayRole, QETApp::elementTranslatedInfoKey(key));
+		qtwi->setData(0, Qt::UserRole, key);
+		qtwi->setText(1, m_elmt_info.value(key).toString());
+	}
+}
+
+/**
  * @brief ElementPropertiesEditorWidget::on_m_buttonBox_accepted
  * Action on button accepted : the new information is set
  */
@@ -100,13 +172,18 @@
 {
 	m_basic_type = ui -> m_base_type_cb -> itemData(ui -> m_base_type_cb -> currentIndex()).toString();
 	if (m_basic_type == "slave") {
-		m_dc.addValue("state",  ui -> m_state_cb -> itemData(ui -> m_state_cb -> currentIndex()));
-		m_dc.addValue("type",	ui -> m_type_cb  -> itemData(ui -> m_type_cb  -> currentIndex()));
-		m_dc.addValue("number", QVariant(ui -> m_number_ctc -> value()));
+		m_kind_info.addValue("state",  ui -> m_state_cb -> itemData(ui -> m_state_cb -> currentIndex()));
+		m_kind_info.addValue("type",	ui -> m_type_cb  -> itemData(ui -> m_type_cb  -> currentIndex()));
+		m_kind_info.addValue("number", QVariant(ui -> m_number_ctc -> value()));
 	}
 	else if(m_basic_type == "master") {
-		m_dc.addValue("type", ui -> m_master_type_cb -> itemData(ui -> m_master_type_cb -> currentIndex()));
+		m_kind_info.addValue("type", ui -> m_master_type_cb -> itemData(ui -> m_master_type_cb -> currentIndex()));
 	}
+	
+	for (QTreeWidgetItem *qtwi : ui->m_tree->invisibleRootItem()->takeChildren())
+		if(!qtwi->text(1).isEmpty())
+			m_elmt_info.addValue(qtwi->data(0, Qt::UserRole).toString(), qtwi->text(1));
+	
 	this->close();
 }
 
@@ -118,9 +195,11 @@
 {
 	bool slave = false , master = false;
 
-	if		(ui -> m_base_type_cb -> itemData(index).toString() == "slave")  slave  = true;
-	else if (ui -> m_base_type_cb -> itemData(index).toString() == "master") master = true;
+	if		(ui->m_base_type_cb->itemData(index).toString() == "slave")  slave  = true;
+	else if (ui->m_base_type_cb->itemData(index).toString() == "master") master = true;
 
-	ui -> m_slave_gb  -> setVisible(slave);
-	ui -> m_master_gb -> setVisible(master);
+	ui->m_slave_gb->setVisible(slave);
+	ui->m_master_gb->setVisible(master);
+	
+	updateTree();
 }

Modified: trunk/sources/editor/ui/elementpropertieseditorwidget.h
===================================================================
--- trunk/sources/editor/ui/elementpropertieseditorwidget.h	2017-10-01 08:00:34 UTC (rev 5056)
+++ trunk/sources/editor/ui/elementpropertieseditorwidget.h	2017-10-01 15:25:34 UTC (rev 5057)
@@ -37,24 +37,27 @@
 
 	//METHODS
 	public:
-	explicit ElementPropertiesEditorWidget(QString &basic_type, DiagramContext &dc, QWidget *parent = nullptr);
-	~ElementPropertiesEditorWidget() override;
+		explicit ElementPropertiesEditorWidget(QString &basic_type, DiagramContext &kind_info, DiagramContext &elmt_info, QWidget *parent = nullptr);
+		~ElementPropertiesEditorWidget() override;
 
-	void upDateInterface();
+		void upDateInterface();
 
 	private:
-	void setUpInterface();
+		void setUpInterface();
+		void updateTree();
+		void populateTree();
 
-	//SLOTS
+		//SLOTS
 	private slots:
-	void on_m_buttonBox_accepted();
-	void on_m_base_type_cb_currentIndexChanged(int index);
+		void on_m_buttonBox_accepted();
+		void on_m_base_type_cb_currentIndexChanged(int index);
 
-	//ATTRIBUTES
+		//ATTRIBUTES
 	private:
-	Ui::ElementPropertiesEditorWidget *ui;
-	QString &m_basic_type;
-	DiagramContext &m_dc;
+		Ui::ElementPropertiesEditorWidget *ui;
+		QString &m_basic_type;
+		DiagramContext &m_kind_info,
+					   &m_elmt_info;
 };
 
 #endif // ELEMENTPROPERTIESEDITORWIDGET_H

Modified: trunk/sources/editor/ui/elementpropertieseditorwidget.ui
===================================================================
--- trunk/sources/editor/ui/elementpropertieseditorwidget.ui	2017-10-01 08:00:34 UTC (rev 5056)
+++ trunk/sources/editor/ui/elementpropertieseditorwidget.ui	2017-10-01 15:25:34 UTC (rev 5057)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>300</height>
+    <width>450</width>
+    <height>321</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -18,99 +18,137 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <widget class="QLabel" name="label">
-       <property name="text">
-        <string>Type de base :</string>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QComboBox" name="m_base_type_cb"/>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <widget class="QGroupBox" name="m_slave_gb">
-     <property name="title">
-      <string>Élément esclave</string>
+    <widget class="QTabWidget" name="tabWidget">
+     <property name="currentIndex">
+      <number>0</number>
      </property>
-     <layout class="QVBoxLayout" name="verticalLayout_2">
-      <item>
-       <layout class="QGridLayout" name="gridLayout">
-        <item row="3" column="1">
-         <widget class="QSpinBox" name="m_number_ctc">
-          <property name="minimum">
-           <number>1</number>
-          </property>
-         </widget>
-        </item>
-        <item row="3" column="0">
-         <widget class="QLabel" name="label_4">
+     <widget class="QWidget" name="Type">
+      <attribute name="title">
+       <string>Type</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QLabel" name="label">
+           <property name="text">
+            <string>Type de base :</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="m_base_type_cb"/>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="m_slave_gb">
+         <property name="title">
+          <string>Élément esclave</string>
+         </property>
+         <layout class="QVBoxLayout" name="verticalLayout_2">
+          <item>
+           <layout class="QGridLayout" name="gridLayout">
+            <item row="3" column="1">
+             <widget class="QSpinBox" name="m_number_ctc">
+              <property name="minimum">
+               <number>1</number>
+              </property>
+             </widget>
+            </item>
+            <item row="3" column="0">
+             <widget class="QLabel" name="label_4">
+              <property name="text">
+               <string>Nombre de contact représenté</string>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="0">
+             <widget class="QLabel" name="label_3">
+              <property name="text">
+               <string>Type de contact</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="0">
+             <widget class="QLabel" name="label_2">
+              <property name="text">
+               <string>État du contact</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="1">
+             <widget class="QComboBox" name="m_state_cb"/>
+            </item>
+            <item row="2" column="1">
+             <widget class="QComboBox" name="m_type_cb"/>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="m_master_gb">
+         <property name="title">
+          <string>Élément maître</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout_3">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_5">
+            <property name="text">
+             <string>Type concret</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QComboBox" name="m_master_type_cb"/>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <spacer name="verticalSpacer_2">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="Informations">
+      <attribute name="title">
+       <string>Informations</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_4">
+       <item>
+        <widget class="QTreeWidget" name="m_tree">
+         <attribute name="headerDefaultSectionSize">
+          <number>150</number>
+         </attribute>
+         <column>
           <property name="text">
-           <string>Nombre de contact représenté</string>
+           <string>Nom</string>
           </property>
-         </widget>
-        </item>
-        <item row="2" column="0">
-         <widget class="QLabel" name="label_3">
+         </column>
+         <column>
           <property name="text">
-           <string>Type de contact</string>
+           <string>Valeurs</string>
           </property>
-         </widget>
-        </item>
-        <item row="1" column="0">
-         <widget class="QLabel" name="label_2">
-          <property name="text">
-           <string>État du contact</string>
-          </property>
-         </widget>
-        </item>
-        <item row="1" column="1">
-         <widget class="QComboBox" name="m_state_cb"/>
-        </item>
-        <item row="2" column="1">
-         <widget class="QComboBox" name="m_type_cb"/>
-        </item>
-       </layout>
-      </item>
-     </layout>
+         </column>
+        </widget>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
    <item>
-    <widget class="QGroupBox" name="m_master_gb">
-     <property name="title">
-      <string>Élément maître</string>
-     </property>
-     <layout class="QGridLayout" name="gridLayout_3">
-      <item row="0" column="0">
-       <widget class="QLabel" name="label_5">
-        <property name="text">
-         <string>Type concret</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QComboBox" name="m_master_type_cb"/>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item>
     <widget class="QDialogButtonBox" name="m_buttonBox">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>

Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp	2017-10-01 08:00:34 UTC (rev 5056)
+++ trunk/sources/qetgraphicsitem/customelement.cpp	2017-10-01 15:25:34 UTC (rev 5057)
@@ -150,7 +150,9 @@
 	setToolTip(name());
 
 		//load kind informations
-	kind_informations_.fromXml(xml_def_elmt.firstChildElement("kindInformations"), "kindInformation");
+	m_kind_informations.fromXml(xml_def_elmt.firstChildElement("kindInformations"), "kindInformation");
+		//load element information
+	m_element_informations.fromXml(xml_def_elmt.firstChildElement("elementInformations"), "elementInformation");
 
 		//scroll of the Children of the Definition: Parts of the Drawing
 	int parsed_elements_count = 0;

Modified: trunk/sources/qetgraphicsitem/element.h
===================================================================
--- trunk/sources/qetgraphicsitem/element.h	2017-10-01 08:00:34 UTC (rev 5056)
+++ trunk/sources/qetgraphicsitem/element.h	2017-10-01 15:25:34 UTC (rev 5057)
@@ -136,7 +136,7 @@
 		DiagramContext  elementInformations    ()const              {return m_element_informations;}
 		DiagramContext& rElementInformations   ()                   {return m_element_informations;}
 		virtual void    setElementInformations (DiagramContext dc);
-		DiagramContext  kindInformations       () const             {return kind_informations_;}	//@kind_information_ is used to store more information
+		DiagramContext  kindInformations       () const             {return m_kind_informations;}	//@kind_information_ is used to store more information
 																									//about the herited class like contactelement for know
 																									// kind of contact (simple tempo) or number of contact show by the element.
 
@@ -154,7 +154,7 @@
 
 		//ATTRIBUTES
 	protected:
-		DiagramContext m_element_informations, kind_informations_;
+		DiagramContext m_element_informations, m_kind_informations;
 		autonum::sequentialNumbers m_autoNum_seq;
 		bool m_freeze_label = false;
 		QString m_F_str;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/