Elements panel: also highlight integrated element when they are erased.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1794 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2012-05-10 17:48:38 +00:00
parent efbfb462c8
commit 719e1c008e
2 changed files with 27 additions and 1 deletions

View File

@@ -787,6 +787,27 @@ QTreeWidgetItem *GenericPanel::refreshElementsCategory(const ElementsLocation &l
return(result); return(result);
} }
/**
Refresh element at \a location.
@return the refreshed tree item
*/
QTreeWidgetItem *GenericPanel::refreshElement(const ElementsLocation &location) {
QTreeWidgetItem *item = itemForElementsLocation(location);
if (!item) return(0);
if (item -> type() != QET::Element) return(0);
QTreeWidgetItem *parent = item -> parent();
if (!parent) return(0);
QTreeWidgetItem *result = updateElementItem(
item,
QETApp::collectionItem(location) -> toElement(),
PanelOptions(QFlag(parent -> data(0, GenericPanel::PanelFlags).toInt())),
false
);
return(result);
}
/** /**
*/ */
@@ -983,10 +1004,14 @@ QList<ElementsLocation> GenericPanel::elementIntegrated(QETProject *project, con
} }
if (added_locations.count()) { if (added_locations.count()) {
refreshElementsCategory(loc); refreshElementsCategory(loc);
} else {
if (refreshElement(location)) {
added_locations << location;
}
} }
// Since we have refreshed the panel before the element is actually used by // Since we have refreshed the panel before the element is actually used by
// the diagram, it will appear as unused; we force it as unused. // the diagram, it will appear as unused; we force it as used.
// FIXME a better solution would be to get warned when an element gets used // FIXME a better solution would be to get warned when an element gets used
// or unused. // or unused.
if (QTreeWidgetItem *integrated_element_qtwi = itemForElementsLocation(location)) { if (QTreeWidgetItem *integrated_element_qtwi = itemForElementsLocation(location)) {

View File

@@ -145,6 +145,7 @@ class GenericPanel : public QTreeWidget {
virtual QTreeWidgetItem *updateElementsCategoryItem(QTreeWidgetItem *, ElementsCategory *, PanelOptions = AddAllChild, bool = false); virtual QTreeWidgetItem *updateElementsCategoryItem(QTreeWidgetItem *, ElementsCategory *, PanelOptions = AddAllChild, bool = false);
virtual QTreeWidgetItem *fillElementsCategoryItem (QTreeWidgetItem *, ElementsCategory *, PanelOptions = AddAllChild, bool = false); virtual QTreeWidgetItem *fillElementsCategoryItem (QTreeWidgetItem *, ElementsCategory *, PanelOptions = AddAllChild, bool = false);
virtual QTreeWidgetItem *refreshElementsCategory(const ElementsLocation &); virtual QTreeWidgetItem *refreshElementsCategory(const ElementsLocation &);
virtual QTreeWidgetItem *refreshElement(const ElementsLocation &);
// elements methods // elements methods
public: public: