Start the work on a new feature : search and replace.

This commit let user find for : texts, conductors and elements.
WIP.


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5526 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2018-09-25 16:05:24 +00:00
parent 76e72b0353
commit 6a12a008e9
10 changed files with 1123 additions and 48 deletions

View File

@@ -0,0 +1,690 @@
/*
Copyright 2006-2018 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "searchandreplacewidget.h"
#include "ui_searchandreplacewidget.h"
#include "qetdiagrameditor.h"
#include "qetproject.h"
#include "diagram.h"
#include "qeticons.h"
#include "element.h"
#include "independenttextitem.h"
#include "conductor.h"
/**
* @brief SearchAndReplaceWidget::SearchAndReplaceWidget
* Constructor
* @param parent
*/
SearchAndReplaceWidget::SearchAndReplaceWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::SearchAndReplaceWidget)
{
ui->setupUi(this);
setHideAdvanced(true);
setUpTreeItems();
connect(ui->m_search_le, &QLineEdit::textEdited, this, &SearchAndReplaceWidget::search);
}
/**
* @brief SearchAndReplaceWidget::~SearchAndReplaceWidget
* Destructor
*/
SearchAndReplaceWidget::~SearchAndReplaceWidget() {
delete ui;
}
/**
* @brief SearchAndReplaceWidget::event
* Reimplemented to clear the the lines edit and hide
* the advanced widgets, when this widget become hidden
* @param event
* @return
*/
bool SearchAndReplaceWidget::event(QEvent *event)
{
if (event->type() == QEvent::Hide)
{
clear();
setHideAdvanced(true);
if (m_highlighted_element)
{
m_highlighted_element.data()->setHighlighted(false);
m_highlighted_element.clear();
}
}
else if (event->type() == QEvent::Show)
{
ui->m_search_le->setFocus();
fillItemsList();
m_root_qtwi->setExpanded(true);
}
return QWidget::event(event);
}
/**
* @brief SearchAndReplaceWidget::clear
* Clear the content of the search and replace line edit
* Clear all tree items in the tree widget (except the category items).
*/
void SearchAndReplaceWidget::clear()
{
disconnect(ui->m_tree_widget, &QTreeWidget::itemChanged, this, &SearchAndReplaceWidget::itemChanged);
qDeleteAll(m_element_hash.keys());
m_element_hash.clear();
qDeleteAll(m_text_hash.keys());
m_text_hash.clear();
qDeleteAll(m_conductor_hash.keys());
m_conductor_hash.clear();
for (QTreeWidgetItem *qtwi : m_category_qtwi)
qtwi->setHidden(false);
ui->m_tree_widget->collapseAll();
ui->m_tree_widget->clearSelection();
ui->m_search_le->clear();
ui->m_replace_le->clear();
updateNextPreviousButtons();
ui->m_search_le->setPalette(QPalette());
}
/**
* @brief SearchAndReplaceWidget::setEditor
* Set the diagram editor of this widget
* @param editor
*/
void SearchAndReplaceWidget::setEditor(QETDiagramEditor *editor) {
m_editor = editor;
}
/**
* @brief SearchAndReplaceWidget::setUpTreeItems
* Set up the main tree widget items
*/
void SearchAndReplaceWidget::setUpTreeItems()
{
m_root_qtwi = new QTreeWidgetItem(ui->m_tree_widget);
m_root_qtwi->setIcon(0, QET::Icons::ProjectProperties);
m_root_qtwi->setText(0, tr("Correspondance :"));
m_root_qtwi->setCheckState(0, Qt::Checked);
m_category_qtwi.append(m_root_qtwi);
m_folio_qtwi = new QTreeWidgetItem(m_root_qtwi);
m_folio_qtwi->setIcon(0, QET::Icons::Diagram);
m_folio_qtwi->setText(0, tr("Folios"));
m_folio_qtwi->setCheckState(0, Qt::Checked);
m_category_qtwi.append(m_folio_qtwi);
m_indi_text_qtwi = new QTreeWidgetItem(m_root_qtwi);
m_indi_text_qtwi->setIcon(0, QET::Icons::PartText);
m_indi_text_qtwi->setText(0, tr("Champs texte"));
m_indi_text_qtwi->setCheckState(0, Qt::Checked);
m_category_qtwi.append(m_indi_text_qtwi);
m_elements_qtwi = new QTreeWidgetItem(m_root_qtwi);
m_elements_qtwi->setIcon(0, QET::Icons::Element);
m_elements_qtwi->setText(0, tr("Elements"));
m_elements_qtwi->setCheckState(0, Qt::Checked);
m_category_qtwi.append(m_elements_qtwi);
m_simple_elmt_qtwi = new QTreeWidgetItem(m_elements_qtwi);
m_simple_elmt_qtwi->setText(0, tr("Elements simple"));
m_simple_elmt_qtwi->setIcon(0, QET::Icons::Element);
m_simple_elmt_qtwi->setCheckState(0, Qt::Checked);
m_qtwi_elmts.append(m_simple_elmt_qtwi);
m_master_elmt_qtwi= new QTreeWidgetItem(m_elements_qtwi);
m_master_elmt_qtwi->setText(0, tr("Elements maître"));
m_master_elmt_qtwi->setCheckState(0, Qt::Checked);
m_qtwi_elmts.append(m_master_elmt_qtwi);
m_slave_elmt_qtwi = new QTreeWidgetItem(m_elements_qtwi);
m_slave_elmt_qtwi->setText(0, tr("Elements esclave"));
m_slave_elmt_qtwi->setCheckState(0, Qt::Checked);
m_qtwi_elmts.append(m_slave_elmt_qtwi);
m_report_elmt_qtwi = new QTreeWidgetItem(m_elements_qtwi);
m_report_elmt_qtwi->setText(0, tr("Elements report de folio"));
m_report_elmt_qtwi->setCheckState(0, Qt::Checked);
m_qtwi_elmts.append(m_report_elmt_qtwi);
m_terminal_elmt_qtwi = new QTreeWidgetItem(m_elements_qtwi);
m_terminal_elmt_qtwi->setText(0, tr("Elements bornier"));
m_terminal_elmt_qtwi->setCheckState(0, Qt::Checked);
m_qtwi_elmts.append(m_terminal_elmt_qtwi);
m_category_qtwi.append(m_qtwi_elmts);
m_conductor_qtwi = new QTreeWidgetItem(m_root_qtwi);
m_conductor_qtwi->setIcon(0, QET::Icons::ConductorSettings);
m_conductor_qtwi->setText(0, tr("Conducteurs"));
m_conductor_qtwi->setCheckState(0, Qt::Checked);
m_category_qtwi.append(m_conductor_qtwi);
updateNextPreviousButtons();
}
/**
* @brief SearchAndReplaceWidget::setHideAdvanced
* Hide advanced widgets
* @param hide
*/
void SearchAndReplaceWidget::setHideAdvanced(bool hide) const
{
ui->m_advanced_pb ->setChecked(!hide);
ui->m_replace ->setHidden(hide);
ui->m_replace_le ->setHidden(hide);
ui->m_mode ->setHidden(hide);
ui->m_mode_cb ->setHidden(hide);
ui->m_tree_widget ->setHidden(hide);
ui->m_replace_pb ->setHidden(hide);
ui->m_replace_all_pb->setHidden(hide);
QSize size = ui->m_v_spacer->sizeHint();
ui->m_v_spacer->changeSize(size.width(), size.height(), QSizePolicy::Minimum, hide ? QSizePolicy::Expanding : QSizePolicy::Ignored);
}
/**
* @brief SearchAndReplaceWidget::fillItemsList
* Fill the tree
*/
void SearchAndReplaceWidget::fillItemsList()
{
disconnect(ui->m_tree_widget, &QTreeWidget::itemChanged, this, &SearchAndReplaceWidget::itemChanged);
qDeleteAll(m_element_hash.keys());
m_element_hash.clear();
QETProject *project_ = m_editor->currentProject();
if (!project_) {
return;
}
DiagramContent dc;
for (Diagram *diagram : project_->diagrams()) {
dc += DiagramContent(diagram, false);
}
for (Element *elmt : dc.m_elements)
addElement(elmt);
//Sort child of each "element type" tree item.
//we hide, "element type" tree item, if they do not have children
for(QTreeWidgetItem *qtwi : m_qtwi_elmts)
{
qtwi->sortChildren(0, Qt::AscendingOrder);
qtwi->setHidden(qtwi->childCount() ? false : true);
}
for (IndependentTextItem *iti : dc.m_text_fields)
{
QTreeWidgetItem *qtwi = new QTreeWidgetItem(m_indi_text_qtwi);
qtwi->setText(0, iti->toPlainText());
qtwi->setCheckState(0, Qt::Checked);
m_text_hash.insert(qtwi, QPointer<IndependentTextItem>(iti));
}
m_indi_text_qtwi->sortChildren(0, Qt::AscendingOrder);
for (Conductor *c : dc.m_potential_conductors)
{
QTreeWidgetItem *qtwi = new QTreeWidgetItem(m_conductor_qtwi);
qtwi->setText(0, c->properties().text);
qtwi->setCheckState(0, Qt::Checked);
m_conductor_hash.insert(qtwi, QPointer<Conductor>(c));
}
m_conductor_qtwi->sortChildren(0, Qt::AscendingOrder);
updateNextPreviousButtons();
connect(ui->m_tree_widget, &QTreeWidget::itemChanged, this, &SearchAndReplaceWidget::itemChanged);
}
/**
* @brief SearchAndReplaceWidget::addElement
* Add a tree widget item for @element
* @param element
*/
void SearchAndReplaceWidget::addElement(Element *element)
{
QTreeWidgetItem *parent = m_elements_qtwi;
switch (element->linkType()) {
case Element::Simple:
parent = m_simple_elmt_qtwi;
break;
case Element::NextReport:
parent = m_report_elmt_qtwi;
break;
case Element::PreviousReport:
parent = m_report_elmt_qtwi;
break;
case Element::Master:
parent = m_master_elmt_qtwi;
break;
case Element::Slave:
parent = m_slave_elmt_qtwi;
break;
case Element::Terminale:
parent = m_terminal_elmt_qtwi;
break;
default:
break;
}
QTreeWidgetItem *qtwi = new QTreeWidgetItem(parent);
m_element_hash.insert(qtwi, QPointer<Element>(element));
QString str;
str += element->elementInformations().value("label").toString();
if(!str.isEmpty())
str += (" ");
str += element->elementInformations().value("comment").toString();
if (str.isEmpty())
str = tr("Inconnue");
qtwi->setText(0, str);
qtwi->setCheckState(0, Qt::Checked);
}
/**
* @brief SearchAndReplaceWidget::search
* Start the search
*/
void SearchAndReplaceWidget::search()
{
QString str = ui->m_search_le->text();
if(str.isEmpty())
{
for (QTreeWidgetItemIterator it(m_root_qtwi) ; *it ; ++it) {
(*it)->setHidden(false);
}
for (QTreeWidgetItem *item : m_category_qtwi) {
item->setExpanded(false);
}
m_root_qtwi->setExpanded(true);
ui->m_tree_widget->setCurrentItem(m_root_qtwi);
ui->m_search_le->setPalette(QPalette());
}
else
{
for (QTreeWidgetItemIterator it(m_root_qtwi) ; *it ; ++it) {
(*it)->setHidden(true);
}
bool match = false;
for(QTreeWidgetItem *qtwi : ui->m_tree_widget->findItems(str, Qt::MatchContains | Qt::MatchRecursive))
{
match = true;
qtwi->setHidden(false);
setVisibleAllParents(qtwi);
}
QPalette background = ui->m_search_le->palette();
background.setColor(QPalette::Base, match ? QColor("#E0FFF0") : QColor("#FFE0EF"));
ui->m_search_le->setPalette(background);
//Go to the first occurence
ui->m_tree_widget->setCurrentItem(m_root_qtwi);
on_m_next_pb_clicked();
}
}
/**
* @brief SearchAndReplaceWidget::setVisibleAllParents
* Set visible all parents of @item until the invisible root item
* @param item
* @param expend_parent
*/
void SearchAndReplaceWidget::setVisibleAllParents(QTreeWidgetItem *item, bool expend_parent)
{
if (item->parent())
{
QTreeWidgetItem *parent = item->parent();
parent->setHidden(false);
setVisibleAllParents(parent);
parent->setExpanded(expend_parent);
}
}
/**
* @brief SearchAndReplaceWidget::nextItem
* @param item : find the next item from @item, if @item is nullptr, start the search for the root of the tree
* @param flags
* @return the next item according to flag or nullptr if there is not a next item
*/
QTreeWidgetItem *SearchAndReplaceWidget::nextItem(QTreeWidgetItem *item, QTreeWidgetItemIterator::IteratorFlag flags) const
{
QTreeWidgetItem *qtwi = item;
if (!item) {
qtwi = ui->m_tree_widget->currentItem();
}
if (!qtwi) {
qtwi = m_root_qtwi;
}
QTreeWidgetItemIterator it(qtwi, flags);
++it;
QTreeWidgetItem *next_ = *it;
if (next_) {
return next_;
}
else {
return nullptr;
}
}
/**
* @brief SearchAndReplaceWidget::previousItem
* @param item : find the previous item from @item, if @item is nullptr, start the search for the root of the tree
* @param flags
* @return the previous item according to flag or nullptr if there is not a previous item
*/
QTreeWidgetItem *SearchAndReplaceWidget::previousItem(QTreeWidgetItem *item, QTreeWidgetItemIterator::IteratorFlag flags) const
{
QTreeWidgetItem *qtwi = item;
if (!item) {
qtwi = ui->m_tree_widget->currentItem();
}
if (!qtwi) {
qtwi = m_root_qtwi;
}
QTreeWidgetItemIterator it(qtwi, flags);
--it;
QTreeWidgetItem *previous_ = *it;
if (previous_) {
return previous_;
}
else {
return nullptr;
}
}
/**
* @brief SearchAndReplaceWidget::updateNextPreviousButtons
* According to the current item, if there is a next or a previous item,
* we enable/disable the buttons next/previous item.
*/
void SearchAndReplaceWidget::updateNextPreviousButtons()
{
QTreeWidgetItem *item_ = ui->m_tree_widget->currentItem();
if (!item_)
{
ui->m_next_pb->setEnabled(true);
ui->m_previous_pb->setDisabled(true);
return;
}
QTreeWidgetItem *next_ = item_;
do
{
next_ = nextItem(next_, QTreeWidgetItemIterator::NotHidden);
if (!next_)
{
ui->m_next_pb->setDisabled(true);
break;
}
else if (!m_category_qtwi.contains(next_))
{
ui->m_next_pb->setEnabled(true);
break;
}
} while (m_category_qtwi.contains(next_));
QTreeWidgetItem *previous_ = item_;
do
{
previous_ = previousItem(previous_, QTreeWidgetItemIterator::NotHidden);
if (!previous_)
{
ui->m_previous_pb->setDisabled(true);
break;
}
else if (!m_category_qtwi.contains(previous_))
{
ui->m_previous_pb->setEnabled(true);
break;
}
} while (m_category_qtwi.contains(previous_));
}
/**
* @brief SearchAndReplaceWidget::itemChanged
* Reimplemented from QTreeWidget.
* Use to update the check state of items.
* @param item
* @param column
*/
void SearchAndReplaceWidget::itemChanged(QTreeWidgetItem *item, int column)
{
Q_UNUSED(column);
ui->m_tree_widget->blockSignals(true);
setChildCheckState(item, item->checkState(0));
updateParentCheckState(item);
ui->m_tree_widget->blockSignals(false);
}
/**
* @brief SearchAndReplaceWidget::setChildCheckState
* @param item : Parent of the items to be evaluated
* @param check : check state
* @param deep : if true, we evaluate every subchilds.
*/
void SearchAndReplaceWidget::setChildCheckState(QTreeWidgetItem *item, Qt::CheckState check, bool deep)
{
for (int i=0 ; i<item->childCount() ; ++i)
{
item->child(i)->setCheckState(0, check);
if (deep && item->child(i)->childCount()) {
setChildCheckState(item->child(i), check, deep);
}
}
}
/**
* @brief SearchAndReplaceWidget::updateParentCheckState
* @param item : a child item of the parent to be evaluated.
* @param all_parents : if true, we evaluate every parents, until the root item.
*/
void SearchAndReplaceWidget::updateParentCheckState(QTreeWidgetItem *item, bool all_parents)
{
QTreeWidgetItem *parent = item->parent();
if (!parent) {
parent = item;
}
int check=0,
partially=0;
for (int i=0 ; i<parent->childCount() ; ++i)
{
switch (parent->child(i)->checkState(0)) {
case Qt::Checked:
++check;
break;
case Qt::PartiallyChecked:
++partially;
break;
default:
break;
}
}
if (check == parent->childCount()) {
parent->setCheckState(0, Qt::Checked);
}
else if (partially || check) {
parent->setCheckState(0, Qt::PartiallyChecked);
}
else {
parent->setCheckState(0, Qt::Unchecked);
}
if (all_parents && item->parent()) {
updateParentCheckState(parent, all_parents);
}
}
void SearchAndReplaceWidget::on_m_quit_button_clicked() {
this->setHidden(true);
}
void SearchAndReplaceWidget::on_m_advanced_pb_toggled(bool checked) {
setHideAdvanced(!checked);
}
void SearchAndReplaceWidget::on_m_tree_widget_itemDoubleClicked(QTreeWidgetItem *item, int column)
{
Q_UNUSED(column);
if (m_element_hash.keys().contains(item))
{
QPointer<Element> elmt = m_element_hash.value(item);
if (elmt) {
elmt.data()->diagram()->showMe();
}
}
else if (m_text_hash.keys().contains(item))
{
QPointer<IndependentTextItem> text = m_text_hash.value(item);
if (text) {
text.data()->diagram()->showMe();
}
}
else if (m_conductor_hash.keys().contains(item))
{
QPointer<Conductor> cond = m_conductor_hash.value(item);
if (cond) {
cond.data()->diagram()->showMe();
}
}
}
void SearchAndReplaceWidget::on_m_reload_pb_clicked()
{
clear();
if (m_highlighted_element)
{
m_highlighted_element.data()->setHighlighted(false);
m_highlighted_element.clear();
}
if (m_last_selected)
{
m_last_selected.data()->setSelected(false);
m_last_selected.clear();
}
ui->m_search_le->setFocus();
fillItemsList();
m_root_qtwi->setExpanded(true);
}
void SearchAndReplaceWidget::on_m_tree_widget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
{
Q_UNUSED(previous);
if(m_highlighted_element) {
m_highlighted_element.data()->setHighlighted(false);
}
if (m_last_selected) {
m_last_selected.data()->setSelected(false);
}
if (m_element_hash.keys().contains(current))
{
QPointer<Element> elmt = m_element_hash.value(current);
if (elmt)
{
m_highlighted_element = elmt;
elmt.data()->setHighlighted(true);
}
}
else if (m_text_hash.keys().contains(current))
{
QPointer<IndependentTextItem> text = m_text_hash.value(current);
if (text)
{
text.data()->setSelected(true);
m_last_selected = text;
}
}
else if (m_conductor_hash.keys().contains(current))
{
QPointer<Conductor> cond = m_conductor_hash.value(current);
if (cond)
{
cond.data()->setSelected(true);
m_last_selected = cond;
}
}
updateNextPreviousButtons();
}
void SearchAndReplaceWidget::on_m_next_pb_clicked()
{
QTreeWidgetItem *item = nullptr;
do
{
item = nextItem(nullptr, QTreeWidgetItemIterator::NotHidden);
if (item) {
ui->m_tree_widget->setCurrentItem(item);
} else {
return;
}
} while (m_category_qtwi.contains(item));
ui->m_tree_widget->setCurrentItem(item);
ui->m_tree_widget->scrollToItem(item);
on_m_tree_widget_itemDoubleClicked(item, 0);
}
void SearchAndReplaceWidget::on_m_previous_pb_clicked()
{
QTreeWidgetItem *item = nullptr;
do
{
item = previousItem(nullptr, QTreeWidgetItemIterator::NotHidden);
if (item) {
ui->m_tree_widget->setCurrentItem(item);
}
else
{
//There is not a previous selected item, so the current item is m_root_qtwi but we know he must not be selected
//we user click on the button 'next item'.
//So we select the first selectable item by calling on_m_next_pb_clicked
on_m_next_pb_clicked();
return;
}
} while (m_category_qtwi.contains(item));
ui->m_tree_widget->setCurrentItem(item);
ui->m_tree_widget->scrollToItem(item);
on_m_tree_widget_itemDoubleClicked(item, 0);
}

View File

@@ -0,0 +1,92 @@
/*
Copyright 2006-2018 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SEARCHANDREPLACEWIDGET_H
#define SEARCHANDREPLACEWIDGET_H
#include <QWidget>
#include <QTreeWidgetItemIterator>
#include "element.h"
#include "independenttextitem.h"
class QTreeWidgetItem;
namespace Ui {
class SearchAndReplaceWidget;
}
class QETDiagramEditor;
class SearchAndReplaceWidget : public QWidget
{
Q_OBJECT
public:
explicit SearchAndReplaceWidget(QWidget *parent = nullptr);
~SearchAndReplaceWidget();
bool event(QEvent *event) override;
void clear();
void setEditor(QETDiagramEditor *editor);
private:
void setUpTreeItems();
void setHideAdvanced(bool hide) const;
void fillItemsList();
void addElement(Element *element);
void search();
void setVisibleAllParents(QTreeWidgetItem *item, bool expend_parent = true);
QTreeWidgetItem *nextItem(QTreeWidgetItem *item=nullptr, QTreeWidgetItemIterator::IteratorFlag flags = QTreeWidgetItemIterator::All) const;
QTreeWidgetItem *previousItem(QTreeWidgetItem *item=nullptr, QTreeWidgetItemIterator::IteratorFlag flags = QTreeWidgetItemIterator::All) const;
void updateNextPreviousButtons();
void itemChanged(QTreeWidgetItem *item, int column);
void setChildCheckState(QTreeWidgetItem *item, Qt::CheckState check, bool deep = true);
void updateParentCheckState(QTreeWidgetItem *item, bool all_parents = true);
private slots:
void on_m_quit_button_clicked();
void on_m_advanced_pb_toggled(bool checked);
void on_m_tree_widget_itemDoubleClicked(QTreeWidgetItem *item, int column);
void on_m_reload_pb_clicked();
void on_m_tree_widget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
void on_m_next_pb_clicked();
void on_m_previous_pb_clicked();
private:
Ui::SearchAndReplaceWidget *ui;
QETDiagramEditor *m_editor;
QTreeWidgetItem *m_root_qtwi = nullptr,
*m_folio_qtwi = nullptr,
*m_indi_text_qtwi = nullptr,
*m_elements_qtwi = nullptr,
*m_simple_elmt_qtwi = nullptr,
*m_master_elmt_qtwi = nullptr,
*m_slave_elmt_qtwi = nullptr,
*m_report_elmt_qtwi = nullptr,
*m_terminal_elmt_qtwi = nullptr,
*m_conductor_qtwi = nullptr;
QList<QTreeWidgetItem *> m_qtwi_elmts;
QList<QTreeWidgetItem *> m_category_qtwi;
QHash<QTreeWidgetItem *, QPointer <Element>> m_element_hash;
QHash<QTreeWidgetItem *, QPointer <IndependentTextItem>> m_text_hash;
QHash<QTreeWidgetItem *, QPointer <Conductor>> m_conductor_hash;
QPointer<Element> m_highlighted_element;
QPointer<QGraphicsObject> m_last_selected;
};
#endif // SEARCHANDREPLACEWIDGET_H

View File

@@ -0,0 +1,236 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SearchAndReplaceWidget</class>
<widget class="QWidget" name="SearchAndReplaceWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>897</width>
<height>596</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0,0,1,0">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="4">
<widget class="QPushButton" name="m_next_pb">
<property name="toolTip">
<string>Aller à la correspondance suivante</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="arrow-down-double">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0" colspan="8">
<widget class="QTreeWidget" name="m_tree_widget">
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="m_previous_pb">
<property name="toolTip">
<string>Aller à la correspondance précédente</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="arrow-up-double">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="m_quit_button">
<property name="toolTip">
<string>Quitter</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="window-close">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="3" rowspan="3">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1" colspan="4">
<widget class="QLineEdit" name="m_replace_le">
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="m_replace">
<property name="text">
<string>Remplacer :</string>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="m_replace_pb">
<property name="toolTip">
<string>Remplacer la correspondance séléctionner</string>
</property>
<property name="text">
<string>Remplacer</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QPushButton" name="m_replace_all_pb">
<property name="toolTip">
<string>Remplacer les correspondances coché</string>
</property>
<property name="text">
<string>Tout remplacer</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="m_mode">
<property name="text">
<string>Mode :</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="m_mode_cb">
<item>
<property name="text">
<string>Texte brut</string>
</property>
</item>
<item>
<property name="text">
<string>Mots entiers</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1" colspan="4">
<widget class="QLineEdit" name="m_search_le">
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="m_search">
<property name="text">
<string>Chercher :</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="7">
<widget class="QPushButton" name="m_advanced_pb">
<property name="toolTip">
<string>Avancé</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../qelectrotech.qrc">
<normaloff>:/ico/16x16/configure-toolbars.png</normaloff>:/ico/16x16/configure-toolbars.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="m_v_spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="6">
<widget class="QPushButton" name="m_reload_pb">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="view-refresh"/>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../../qelectrotech.qrc"/>
</resources>
<connections/>
</ui>