mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
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) git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4399 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -234,6 +234,15 @@ QVariant ElementCollectionItem::data(int column, int role)
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::clearData
|
||||
* Reset the curent name
|
||||
*/
|
||||
void ElementCollectionItem::clearData()
|
||||
{
|
||||
m_name = QString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ElementCollectionItem::mimeData
|
||||
* @return The mime data of this item
|
||||
|
||||
@@ -52,6 +52,7 @@ class ElementCollectionItem : public QObject
|
||||
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);
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "elementscategory.h"
|
||||
#include "xmlprojectelementcollectionitem.h"
|
||||
#include "qetproject.h"
|
||||
#include "qetelementeditor.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QTreeView>
|
||||
@@ -244,7 +245,15 @@ void ElementsCollectionWidget::editElement()
|
||||
(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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -182,6 +182,16 @@ QVariant FileElementCollectionItem::data(int column, int role)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
||||
@@ -47,6 +47,7 @@ class FileElementCollectionItem : public ElementCollectionItem
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user