mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Element panel : elements can be searched by their name but also with by all their informations.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5698 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -40,8 +40,9 @@ This commit fix it, now the search function search for every terminals of a term
|
|||||||
* QETshapeItem rectangle can have rounded corner.
|
* QETshapeItem rectangle can have rounded corner.
|
||||||
* Add in config the possibility to start the numbering of the columns of titleblocks at 0.
|
* Add in config the possibility to start the numbering of the columns of titleblocks at 0.
|
||||||
* Add new function Search and replace widget Crtl +F
|
* Add new function Search and replace widget Crtl +F
|
||||||
Diagram properties, Element properties, Independent text item can be changed (and mass changed) through the search and replace widget.
|
* Diagram properties, Element properties, Independent text item can be changed (and mass changed) through the search and replace widget.
|
||||||
* Added 4 tools for edit the depth (Z value) of items.
|
* Added 4 tools for edit the depth (Z value) of items.
|
||||||
|
* Element panel : elements can be searched by their name but also with by all their informations.
|
||||||
|
|
||||||
|
|
||||||
* Title block editor :
|
* Title block editor :
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ void ElementCollectionItem::clearData()
|
|||||||
setText(QString());
|
setText(QString());
|
||||||
setToolTip(QString());
|
setToolTip(QString());
|
||||||
setIcon(QIcon());
|
setIcon(QIcon());
|
||||||
|
setData(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -624,7 +624,7 @@ void ElementsCollectionWidget::search()
|
|||||||
QModelIndexList match_index;
|
QModelIndexList match_index;
|
||||||
foreach (QString txt, text_list) {
|
foreach (QString txt, text_list) {
|
||||||
match_index << m_model->match(m_showed_index.isValid() ? m_model->index(0,0,m_showed_index) : m_model->index(0,0),
|
match_index << m_model->match(m_showed_index.isValid() ? m_model->index(0,0,m_showed_index) : m_model->index(0,0),
|
||||||
Qt::DisplayRole, QVariant(txt), -1, Qt::MatchContains | Qt::MatchRecursive);
|
Qt::UserRole+1, QVariant(txt), -1, Qt::MatchContains | Qt::MatchRecursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(QModelIndex index, match_index)
|
foreach(QModelIndex index, match_index)
|
||||||
|
|||||||
@@ -681,6 +681,23 @@ QString ElementsLocation::fileName() const
|
|||||||
else return qsl.last();
|
else return qsl.last();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ElementsLocation::elementInformations
|
||||||
|
* @return the element information of the element represented by this location.
|
||||||
|
* If the location is a directory, the returned diagram context is empty
|
||||||
|
*/
|
||||||
|
DiagramContext ElementsLocation::elementInformations() const
|
||||||
|
{
|
||||||
|
DiagramContext context;
|
||||||
|
if (isDirectory()) {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDomElement dom = this->xml().firstChildElement("elementInformations");
|
||||||
|
context.fromXml(dom, "elementInformation");
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@param location A standard element location
|
@param location A standard element location
|
||||||
@return a hash identifying this location
|
@return a hash identifying this location
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#define ELEMENTS_LOCATION_H
|
#define ELEMENTS_LOCATION_H
|
||||||
|
|
||||||
#include "nameslist.h"
|
#include "nameslist.h"
|
||||||
|
#include "diagramcontext.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
||||||
@@ -77,6 +78,7 @@ class ElementsLocation
|
|||||||
QIcon icon() const;
|
QIcon icon() const;
|
||||||
QString name() const;
|
QString name() const;
|
||||||
QString fileName() const;
|
QString fileName() const;
|
||||||
|
DiagramContext elementInformations() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_collection_path;
|
QString m_collection_path;
|
||||||
|
|||||||
@@ -240,8 +240,21 @@ void FileElementCollectionItem::setUpData()
|
|||||||
if (isDir())
|
if (isDir())
|
||||||
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled);
|
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
|
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
|
//Set the local name and all informations of the element
|
||||||
|
//in the data Qt::UserRole+1, these data will be use for search.
|
||||||
|
ElementsLocation location(collectionPath());
|
||||||
|
DiagramContext context = location.elementInformations();
|
||||||
|
QStringList search_list;
|
||||||
|
for (QString key : context.keys()) {
|
||||||
|
search_list.append(context.value(key).toString());
|
||||||
|
}
|
||||||
|
search_list.append(localName());
|
||||||
|
setData(search_list.join(" "));
|
||||||
|
}
|
||||||
|
|
||||||
setToolTip(collectionPath());
|
setToolTip(collectionPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -189,11 +189,25 @@ void XmlProjectElementCollectionItem::setUpData()
|
|||||||
//Setup the displayed name
|
//Setup the displayed name
|
||||||
localName();
|
localName();
|
||||||
|
|
||||||
if (isDir())
|
if (isDir()) {
|
||||||
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled);
|
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
|
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
|
||||||
|
|
||||||
|
//Set the local name and all informations of the element
|
||||||
|
//in the data Qt::UserRole+1, these data will be use for search.
|
||||||
|
ElementsLocation location(embeddedPath(), m_project);
|
||||||
|
DiagramContext context = location.elementInformations();
|
||||||
|
QStringList search_list;
|
||||||
|
for (QString key : context.keys()) {
|
||||||
|
search_list.append(context.value(key).toString());
|
||||||
|
}
|
||||||
|
search_list.append(localName());
|
||||||
|
setData(search_list.join(" "));
|
||||||
|
}
|
||||||
|
|
||||||
setToolTip(collectionPath());
|
setToolTip(collectionPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user