[qet] qet/qet: [5548] Search and replace widget : folio are now displayed in the search field

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


Revision: 5548
Author:   blacksun
Date:     2018-10-05 09:49:07 +0200 (Fri, 05 Oct 2018)
Log Message:
-----------
Search and replace widget : folio are now displayed in the search field

Modified Paths:
--------------
    trunk/sources/SearchAndReplace/ui/searchandreplacewidget.cpp
    trunk/sources/SearchAndReplace/ui/searchandreplacewidget.h

Modified: trunk/sources/SearchAndReplace/ui/searchandreplacewidget.cpp
===================================================================
--- trunk/sources/SearchAndReplace/ui/searchandreplacewidget.cpp	2018-10-04 14:34:43 UTC (rev 5547)
+++ trunk/sources/SearchAndReplace/ui/searchandreplacewidget.cpp	2018-10-05 07:49:07 UTC (rev 5548)
@@ -25,6 +25,8 @@
 #include "independenttextitem.h"
 #include "conductor.h"
 
+#include <QSettings>
+
 /**
  * @brief SearchAndReplaceWidget::SearchAndReplaceWidget
  * Constructor
@@ -87,6 +89,9 @@
 {
 	disconnect(ui->m_tree_widget, &QTreeWidget::itemChanged, this, &SearchAndReplaceWidget::itemChanged);
 	
+	qDeleteAll(m_diagram_hash.keys());
+	m_diagram_hash.clear();
+	
 	qDeleteAll(m_element_hash.keys());
 	m_element_hash.clear();
 	
@@ -224,7 +229,23 @@
 
 	
 	DiagramContent dc;
-	for (Diagram *diagram : project_->diagrams()) {
+	for (Diagram *diagram : project_->diagrams())
+	{
+		QString str;
+		
+		QSettings settings;
+		if (settings.value("genericpanel/folio", true).toBool()) {
+			str = diagram->border_and_titleblock.finalfolio();
+		} else {
+			str = QString::number(diagram->folioIndex());
+		}
+		
+		str.append(" " + diagram->title());
+		
+		QTreeWidgetItem *qtwi = new QTreeWidgetItem(m_folio_qtwi);
+		qtwi->setText(0, str);
+		qtwi->setCheckState(0, Qt::Checked);
+		m_diagram_hash.insert(qtwi, QPointer<Diagram>(diagram));
 		dc += DiagramContent(diagram, false);
 	}
 	
@@ -565,8 +586,15 @@
 {
     Q_UNUSED(column);
 	
-	if (m_element_hash.keys().contains(item))
+	if (m_diagram_hash.keys().contains(item))
 	{
+		QPointer<Diagram> diagram = m_diagram_hash.value(item);
+		if(diagram) {
+			diagram.data()->showMe();
+		}
+	}
+	else if (m_element_hash.keys().contains(item))
+	{
 		QPointer<Element> elmt = m_element_hash.value(item);
 		if (elmt) {
 			elmt.data()->diagram()->showMe();

Modified: trunk/sources/SearchAndReplace/ui/searchandreplacewidget.h
===================================================================
--- trunk/sources/SearchAndReplace/ui/searchandreplacewidget.h	2018-10-04 14:34:43 UTC (rev 5547)
+++ trunk/sources/SearchAndReplace/ui/searchandreplacewidget.h	2018-10-05 07:49:07 UTC (rev 5548)
@@ -87,6 +87,7 @@
 		QHash<QTreeWidgetItem *, QPointer <Conductor>> m_conductor_hash;
 		QPointer<Element> m_highlighted_element;
 		QPointer<QGraphicsObject> m_last_selected;
+		QHash<QTreeWidgetItem *, QPointer <Diagram>> m_diagram_hash;
 };
 
 #endif // SEARCHANDREPLACEWIDGET_H


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