[qet] [1345] Fixed a bug causing new diagrams to be placed after title blocks parent directory in the elements panel . |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 1345
Author: xavier
Date: 2011-10-01 19:11:54 +0200 (Sat, 01 Oct 2011)
Log Message:
-----------
Fixed a bug causing new diagrams to be placed after title blocks parent directory in the elements panel.
Modified Paths:
--------------
branches/0.3/sources/elementspanel.cpp
Modified: branches/0.3/sources/elementspanel.cpp
===================================================================
--- branches/0.3/sources/elementspanel.cpp 2011-10-01 10:15:53 UTC (rev 1344)
+++ branches/0.3/sources/elementspanel.cpp 2011-10-01 17:11:54 UTC (rev 1345)
@@ -608,23 +608,19 @@
// repere le dernier element correspondant a un schema, s'il existe
QTreeWidgetItem *last_diagram = 0;
- bool collection_item_exists = false;
if (QETProject *project = diagram -> project()) {
- if (ElementsCollection *project_collection = project -> embeddedCollection()) {
- if (QTreeWidgetItem *collection_item = locations_.key(project_collection -> location())) {
- collection_item_exists = true;
- // repere le dernier schema
- int common_collection_item_idx = qtwi_parent -> indexOfChild(collection_item);
- if (common_collection_item_idx != -1) {
- last_diagram = qtwi_parent -> child(common_collection_item_idx - 1);
- }
+ if (QTreeWidgetItem *embedded_title_blocks = title_blocks_directories_.key(project)) {
+ // gets the last diagram, supposed to be right before the title blocks directory item
+ int title_blocks_item_idx = qtwi_parent -> indexOfChild(embedded_title_blocks);
+ if (title_blocks_item_idx != -1) {
+ last_diagram = qtwi_parent -> child(title_blocks_item_idx - 1);
}
}
}
// creation du QTreeWidgetItem representant le schema
QTreeWidgetItem *qtwi_diagram;
- if (collection_item_exists) {
+ if (last_diagram) {
qtwi_diagram = new QTreeWidgetItem(qtwi_parent, last_diagram);
} else {
qtwi_diagram = new QTreeWidgetItem(qtwi_parent);