[qet] [4399] After editing an element ( opened from the new element panel by double clic, or context menu), |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4399
Author: blacksun
Date: 2016-03-24 11:35:00 +0100 (Thu, 24 Mar 2016)
Log Message:
-----------
After editing an element (opened from the new element panel by double clic, or context menu),
new element panel update the content of the item who represent the edited element (pixmap and name)
Modified Paths:
--------------
trunk/sources/ElementsCollection/elementcollectionitem.cpp
trunk/sources/ElementsCollection/elementcollectionitem.h
trunk/sources/ElementsCollection/elementscollectionwidget.cpp
trunk/sources/ElementsCollection/fileelementcollectionitem.cpp
trunk/sources/ElementsCollection/fileelementcollectionitem.h
Modified: trunk/sources/ElementsCollection/elementcollectionitem.cpp
===================================================================
--- trunk/sources/ElementsCollection/elementcollectionitem.cpp 2016-03-23 11:38:10 UTC (rev 4398)
+++ trunk/sources/ElementsCollection/elementcollectionitem.cpp 2016-03-24 10:35:00 UTC (rev 4399)
@@ -235,6 +235,15 @@
}
/**
+ * @brief ElementCollectionItem::clearData
+ * Reset the curent name
+ */
+void ElementCollectionItem::clearData()
+{
+ m_name = QString();
+}
+
+/**
* @brief ElementCollectionItem::mimeData
* @return The mime data of this item
*/
Modified: trunk/sources/ElementsCollection/elementcollectionitem.h
===================================================================
--- trunk/sources/ElementsCollection/elementcollectionitem.h 2016-03-23 11:38:10 UTC (rev 4398)
+++ trunk/sources/ElementsCollection/elementcollectionitem.h 2016-03-24 10:35:00 UTC (rev 4399)
@@ -52,6 +52,7 @@
int childCount() const;
int columnCount() const;
virtual QVariant data(int column, int role);
+ virtual void clearData();
virtual QMimeData *mimeData();
virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column) const;
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column);
Modified: trunk/sources/ElementsCollection/elementscollectionwidget.cpp
===================================================================
--- trunk/sources/ElementsCollection/elementscollectionwidget.cpp 2016-03-23 11:38:10 UTC (rev 4398)
+++ trunk/sources/ElementsCollection/elementscollectionwidget.cpp 2016-03-24 10:35:00 UTC (rev 4399)
@@ -28,6 +28,7 @@
#include "elementscategory.h"
#include "xmlprojectelementcollectionitem.h"
#include "qetproject.h"
+#include "qetelementeditor.h"
#include <QVBoxLayout>
#include <QTreeView>
@@ -244,7 +245,15 @@
(eci->type() != FileElementCollectionItem::Type)) return;
ElementsLocation location(static_cast<FileElementCollectionItem*>(eci)->collectionPath());
- QETApp::instance()->openElementLocations(QList<ElementsLocation>() << location);
+
+ QETApp *app = QETApp::instance();
+ app->openElementLocations(QList<ElementsLocation>() << location);
+
+ foreach (QETElementEditor *element_editor, app->elementEditors())
+ {
+ if (element_editor->isEditing(location))
+ connect(element_editor, &QETElementEditor::destroyed, eci, &ElementCollectionItem::clearData);
+ }
}
/**
Modified: trunk/sources/ElementsCollection/fileelementcollectionitem.cpp
===================================================================
--- trunk/sources/ElementsCollection/fileelementcollectionitem.cpp 2016-03-23 11:38:10 UTC (rev 4398)
+++ trunk/sources/ElementsCollection/fileelementcollectionitem.cpp 2016-03-24 10:35:00 UTC (rev 4399)
@@ -183,6 +183,16 @@
}
/**
+ * @brief FileElementCollectionItem::clearData
+ * Reset the current icon
+ */
+void FileElementCollectionItem::clearData()
+{
+ m_icon = QIcon();
+ ElementCollectionItem::clearData();
+}
+
+/**
* @brief FileElementCollectionItem::mimeData
* @return the mime data of this item
*/
Modified: trunk/sources/ElementsCollection/fileelementcollectionitem.h
===================================================================
--- trunk/sources/ElementsCollection/fileelementcollectionitem.h 2016-03-23 11:38:10 UTC (rev 4398)
+++ trunk/sources/ElementsCollection/fileelementcollectionitem.h 2016-03-24 10:35:00 UTC (rev 4399)
@@ -47,6 +47,7 @@
QString collectionName() const;
virtual QVariant data(int column, int role);
+ virtual void clearData();
virtual QMimeData *mimeData();
virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column) const;
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column);