[qet] [3566] Bug fix: disable entry edit text field for html editor for elements text in diagram

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


Revision: 3566
Author:   scorpio810
Date:     2014-12-23 02:51:17 +0100 (Tue, 23 Dec 2014)
Log Message:
-----------
Bug fix: disable entry edit text field for html editor for elements text in diagram

Modified Paths:
--------------
    trunk/sources/diagram.cpp
    trunk/sources/diagram.h
    trunk/sources/qetdiagrameditor.cpp

Modified: trunk/sources/diagram.cpp
===================================================================
--- trunk/sources/diagram.cpp	2014-12-21 13:17:35 UTC (rev 3565)
+++ trunk/sources/diagram.cpp	2014-12-23 01:51:17 UTC (rev 3566)
@@ -1182,6 +1182,19 @@
 	return(selected_texts);
 }
 
+
+QSet<ElementTextItem*> Diagram::selectedElementTexts() const {
+	QSet<ElementTextItem *> selected_texts;
+	foreach(QGraphicsItem *item, selectedItems()) {
+		if (ElementTextItem *cti = qgraphicsitem_cast< ElementTextItem*>(item)) {
+			selected_texts << cti;
+		}
+	}
+	return(selected_texts);
+}
+
+
+
 /// @return true si le presse-papier semble contenir un schema
 bool Diagram::clipboardMayContainDiagram() {
 	QString clipboard_text = QApplication::clipboard() -> text().trimmed();

Modified: trunk/sources/diagram.h
===================================================================
--- trunk/sources/diagram.h	2014-12-21 13:17:35 UTC (rev 3565)
+++ trunk/sources/diagram.h	2014-12-23 01:51:17 UTC (rev 3566)
@@ -180,6 +180,7 @@
 	QList<Element *> elements() const;
 	QSet<DiagramTextItem *> selectedTexts() const;
 	QSet<ConductorTextItem *> selectedConductorTexts() const;
+	QSet<ElementTextItem*> selectedElementTexts() const;
 	QSet<Conductor *> selectedConductors() const;
 	DiagramContent content() const;
 	DiagramContent selectedContent();

Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp	2014-12-21 13:17:35 UTC (rev 3565)
+++ trunk/sources/qetdiagrameditor.cpp	2014-12-23 01:51:17 UTC (rev 3566)
@@ -1234,13 +1234,14 @@
 	// actions ayant besoin de textes selectionnes
 	int selected_texts = dv ? (dv -> diagram() -> selectedTexts().count()) : 0;
 	int selected_conductor_texts = dv ? (dv -> diagram() -> selectedConductorTexts().count()) : 0;
+	int selected_element_texts = dv ? (dv -> diagram() -> selectedElementTexts().count()) : 0;
 	rotate_texts -> setEnabled(editable_diagram && selected_texts);
 
 	// actions need only one editable item
 	int selected_image = dv ? dv -> diagram() -> selectedContent().count(DiagramContent::Images) : 0;
 
 	int selected_shape = dv ? dv -> diagram() -> selectedContent().count(DiagramContent::Shapes) : 0;
-	int selected_editable = selected_elements_count + (selected_texts - selected_conductor_texts) + selected_image + selected_shape;
+	int selected_editable = selected_elements_count + (selected_texts - selected_conductor_texts - selected_element_texts) + selected_image + selected_shape;
 
 	if (selected_editable == 1) {
 		edit_selection -> setEnabled(true);


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