[qet] qet/qet: [5647] Search and replace : improve the search for conductor. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 5647
Author: blacksun
Date: 2018-12-13 18:34:41 +0100 (Thu, 13 Dec 2018)
Log Message:
-----------
Search and replace : improve the search for conductor.
Minor gui change of conductor properties widget
Modified Paths:
--------------
trunk/sources/SearchAndReplace/ui/searchandreplacewidget.cpp
trunk/sources/SearchAndReplace/ui/searchandreplacewidget.h
trunk/sources/ui/conductorpropertieswidget.ui
Modified: trunk/sources/SearchAndReplace/ui/searchandreplacewidget.cpp
===================================================================
--- trunk/sources/SearchAndReplace/ui/searchandreplacewidget.cpp 2018-12-10 03:42:30 UTC (rev 5646)
+++ trunk/sources/SearchAndReplace/ui/searchandreplacewidget.cpp 2018-12-13 17:34:41 UTC (rev 5647)
@@ -288,6 +288,7 @@
QTreeWidgetItem *qtwi = new QTreeWidgetItem(m_conductor_qtwi);
qtwi->setText(0, c->properties().text);
qtwi->setCheckState(0, Qt::Checked);
+ qtwi->setData(0, Qt::UserRole, searchTerms(c));
m_conductor_hash.insert(qtwi, QPointer<Conductor>(c));
}
m_conductor_qtwi->sortChildren(0, Qt::AscendingOrder);
@@ -369,23 +370,6 @@
}
bool match = false;
- Qt::MatchFlags flags;
-
- //Search on the text displayed at column 0 of each item
- if (ui->m_mode_cb->currentIndex() == 0) {
- flags = Qt::MatchContains | Qt::MatchRecursive; //Contain string
- } else {
- flags = Qt::MatchFixedString | Qt::MatchRecursive; //entire word
- }
- if (ui->m_case_sensitive_cb->isChecked()) {
- flags = flags | Qt::MatchCaseSensitive;
- }
- for (QTreeWidgetItem *qtwi : ui->m_tree_widget->findItems(str, flags))
- {
- match = true;
- qtwi->setHidden(false);
- setVisibleAllParents(qtwi);
- }
//Extended search,
//on each string stored in column 0 with role : UserRole
@@ -393,6 +377,7 @@
qtwi_list.append(m_diagram_hash.keys());
qtwi_list.append(m_element_hash.keys());
qtwi_list.append(m_text_hash.keys());
+ qtwi_list.append(m_conductor_hash.keys());
for (QTreeWidgetItem *qtwi : qtwi_list)
{
QStringList list = qtwi->data(0, Qt::UserRole).toStringList();
@@ -653,7 +638,7 @@
* @param diagram
* @return All QStrings use as terms for search.
*/
-QStringList SearchAndReplaceWidget::searchTerms(Diagram *diagram) const
+QStringList SearchAndReplaceWidget::searchTerms(Diagram *diagram)
{
QStringList list;
TitleBlockProperties prop = diagram->border_and_titleblock.exportTitleBlock();
@@ -677,7 +662,7 @@
* @param element
* @return All QString use as terms for search
*/
-QStringList SearchAndReplaceWidget::searchTerms(Element *element) const
+QStringList SearchAndReplaceWidget::searchTerms(Element *element)
{
QStringList list;
DiagramContext context = element->elementInformations();
@@ -692,6 +677,23 @@
return list;
}
+/**
+ * @brief SearchAndReplaceWidget::searchTerms
+ * @param conductor
+ * @return all QString use as terms for search.
+ */
+QStringList SearchAndReplaceWidget::searchTerms(Conductor *conductor)
+{
+ QStringList list;
+ ConductorProperties properties = conductor->properties();
+
+ list.append(properties.text);
+ list.append(properties.m_function);
+ list.append(properties.m_tension_protocol);
+
+ return list;
+}
+
void SearchAndReplaceWidget::on_m_quit_button_clicked() {
this->setHidden(true);
}
Modified: trunk/sources/SearchAndReplace/ui/searchandreplacewidget.h
===================================================================
--- trunk/sources/SearchAndReplace/ui/searchandreplacewidget.h 2018-12-10 03:42:30 UTC (rev 5646)
+++ trunk/sources/SearchAndReplace/ui/searchandreplacewidget.h 2018-12-13 17:34:41 UTC (rev 5647)
@@ -60,8 +60,10 @@
void setChildCheckState(QTreeWidgetItem *item, Qt::CheckState check, bool deep = true);
void updateParentCheckState(QTreeWidgetItem *item, bool all_parents = true);
void activateNextChecked();
- QStringList searchTerms(Diagram *diagram) const;
- QStringList searchTerms(Element *element) const;
+ static QStringList searchTerms(Diagram *diagram);
+ static QStringList searchTerms(Element *element);
+ static QStringList searchTerms(Conductor *conductor);
+ static QStringList searchTerms(QString str);
private slots:
void on_m_quit_button_clicked();
Modified: trunk/sources/ui/conductorpropertieswidget.ui
===================================================================
--- trunk/sources/ui/conductorpropertieswidget.ui 2018-12-10 03:42:30 UTC (rev 5646)
+++ trunk/sources/ui/conductorpropertieswidget.ui 2018-12-13 17:34:41 UTC (rev 5647)
@@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
- <number>1</number>
+ <number>0</number>
</property>
<widget class="QWidget" name="type">
<attribute name="title">