mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 16:50:53 +01:00
Apply clang-tidy's modernize-use-auto
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5449 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -75,7 +75,7 @@ ElementCollectionItem *ElementCollectionItem::childWithCollectionName(const QStr
|
||||
{
|
||||
rowCount();
|
||||
foreach (QStandardItem *qsi, directChilds()) {
|
||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||
auto *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||
if (eci->name() == name)
|
||||
return eci;
|
||||
}
|
||||
@@ -167,7 +167,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::elementsDirectChild() cons
|
||||
QList <ElementCollectionItem *> element_child;
|
||||
|
||||
foreach (QStandardItem *qsi, directChilds()) {
|
||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||
auto *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||
if (eci->isElement())
|
||||
element_child.append(eci);
|
||||
}
|
||||
@@ -184,7 +184,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::directoriesDirectChild() c
|
||||
QList <ElementCollectionItem *> dir_child;
|
||||
|
||||
foreach (QStandardItem *qsi, directChilds()) {
|
||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||
auto *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||
if (eci->isDir())
|
||||
dir_child.append(eci);
|
||||
}
|
||||
@@ -231,7 +231,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::items() const
|
||||
QList <ElementCollectionItem *> list;
|
||||
|
||||
for (int i=0 ; i<rowCount() ; i++) {
|
||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(child(i));
|
||||
auto *eci = static_cast<ElementCollectionItem *>(child(i));
|
||||
list.append(eci);
|
||||
list.append(eci->items());
|
||||
}
|
||||
|
||||
@@ -68,9 +68,9 @@ QMimeData *ElementsCollectionModel::mimeData(const QModelIndexList &indexes) con
|
||||
QModelIndex index = indexes.first();
|
||||
if (index.isValid())
|
||||
{
|
||||
ElementCollectionItem *item = static_cast<ElementCollectionItem*>(itemFromIndex(index));
|
||||
auto *item = static_cast<ElementCollectionItem*>(itemFromIndex(index));
|
||||
|
||||
QMimeData *mime_data = new QMimeData();
|
||||
auto *mime_data = new QMimeData();
|
||||
mime_data->setText(item->collectionPath());
|
||||
|
||||
if (item->isElement())
|
||||
@@ -120,7 +120,7 @@ bool ElementsCollectionModel::canDropMimeData(const QMimeData *data, Qt::DropAct
|
||||
if (static_cast<FileElementCollectionItem *>(qsi)->isCommonCollection())
|
||||
return false;
|
||||
|
||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||
auto *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||
|
||||
if (data->hasFormat("application/x-qet-element-uri") || data->hasFormat("application/x-qet-category-uri"))
|
||||
{
|
||||
@@ -156,7 +156,7 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
||||
|
||||
if (qsi->type() == FileElementCollectionItem::Type)
|
||||
{
|
||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(qsi);
|
||||
auto *feci = static_cast<FileElementCollectionItem *>(qsi);
|
||||
|
||||
if (feci->isCommonCollection())
|
||||
return false;
|
||||
@@ -185,7 +185,7 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
||||
return false;
|
||||
}
|
||||
else if (qsi->type() == XmlProjectElementCollectionItem::Type) {
|
||||
XmlProjectElementCollectionItem *xpeci = static_cast<XmlProjectElementCollectionItem*>(qsi);
|
||||
auto *xpeci = static_cast<XmlProjectElementCollectionItem*>(qsi);
|
||||
|
||||
if (xpeci->isElement() && xpeci->parent() && xpeci->parent()->type() == XmlProjectElementCollectionItem::Type)
|
||||
xpeci = static_cast<XmlProjectElementCollectionItem *>(xpeci->parent());
|
||||
@@ -254,7 +254,7 @@ void ElementsCollectionModel::loadCollections(bool common_collection, bool custo
|
||||
*/
|
||||
void ElementsCollectionModel::addCommonCollection(bool set_data)
|
||||
{
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
auto *feci = new FileElementCollectionItem();
|
||||
if (feci->setRootPath(QETApp::commonElementsDirN(), set_data, m_hide_element)) {
|
||||
invisibleRootItem()->appendRow(feci);
|
||||
if (set_data)
|
||||
@@ -270,7 +270,7 @@ void ElementsCollectionModel::addCommonCollection(bool set_data)
|
||||
*/
|
||||
void ElementsCollectionModel::addCustomCollection(bool set_data)
|
||||
{
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
auto *feci = new FileElementCollectionItem();
|
||||
if (feci->setRootPath(QETApp::customElementsDirN(), set_data, m_hide_element)) {
|
||||
invisibleRootItem()->appendRow(feci);
|
||||
if (set_data)
|
||||
@@ -313,7 +313,7 @@ void ElementsCollectionModel::addLocation(const ElementsLocation& location)
|
||||
foreach(ElementCollectionItem *eci, child_list) {
|
||||
|
||||
if (eci->type() == FileElementCollectionItem::Type) {
|
||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci);
|
||||
auto *feci = static_cast<FileElementCollectionItem *>(eci);
|
||||
|
||||
if (feci->isCustomCollection()) {
|
||||
last_item = feci->lastItemForPath(location.collectionPath(false), collection_name);
|
||||
@@ -341,7 +341,7 @@ void ElementsCollectionModel::addProject(QETProject *project, bool set_data)
|
||||
|
||||
m_project_list.append(project);
|
||||
int row = m_project_list.indexOf(project);
|
||||
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem();
|
||||
auto *xpeci = new XmlProjectElementCollectionItem();
|
||||
m_project_hash.insert(project, xpeci);
|
||||
|
||||
xpeci->setProject(project, set_data);
|
||||
@@ -419,7 +419,7 @@ QList <ElementCollectionItem *> ElementsCollectionModel::items() const
|
||||
QList <ElementCollectionItem *> list;
|
||||
|
||||
for (int i=0 ; i<rowCount() ; i++) {
|
||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(item(i));
|
||||
auto *eci = static_cast<ElementCollectionItem *>(item(i));
|
||||
list.append(eci);
|
||||
list.append(eci->items());
|
||||
}
|
||||
@@ -478,7 +478,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l
|
||||
ElementCollectionItem *match_eci = nullptr;
|
||||
|
||||
if (eci->type() == FileElementCollectionItem::Type) {
|
||||
if (FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci)) {
|
||||
if (auto *feci = static_cast<FileElementCollectionItem *>(eci)) {
|
||||
if ( (location.isCommonCollection() && feci->isCommonCollection()) ||
|
||||
(location.isCustomCollection() && !feci->isCommonCollection()) ) {
|
||||
match_eci = feci->itemAtPath(location.collectionPath(false));
|
||||
@@ -486,7 +486,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l
|
||||
}
|
||||
}
|
||||
else if (eci->type() == XmlProjectElementCollectionItem::Type) {
|
||||
if (XmlProjectElementCollectionItem *xpeci = static_cast<XmlProjectElementCollectionItem *>(eci)) {
|
||||
if (auto *xpeci = static_cast<XmlProjectElementCollectionItem *>(eci)) {
|
||||
match_eci = xpeci->itemAtPath(location.collectionPath(false));
|
||||
}
|
||||
}
|
||||
@@ -507,7 +507,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l
|
||||
void ElementsCollectionModel::elementIntegratedToCollection(const QString& path)
|
||||
{
|
||||
QObject *object = sender();
|
||||
XmlElementCollection *collection = static_cast<XmlElementCollection *> (object);
|
||||
auto *collection = static_cast<XmlElementCollection *> (object);
|
||||
if (!collection)
|
||||
return;
|
||||
|
||||
@@ -540,7 +540,7 @@ void ElementsCollectionModel::elementIntegratedToCollection(const QString& path)
|
||||
void ElementsCollectionModel::itemRemovedFromCollection(const QString& path)
|
||||
{
|
||||
QObject *object = sender();
|
||||
XmlElementCollection *collection = static_cast<XmlElementCollection *> (object);
|
||||
auto *collection = static_cast<XmlElementCollection *> (object);
|
||||
if (!collection)
|
||||
return;
|
||||
|
||||
@@ -568,7 +568,7 @@ void ElementsCollectionModel::itemRemovedFromCollection(const QString& path)
|
||||
void ElementsCollectionModel::updateItem(const QString& path)
|
||||
{
|
||||
QObject *object = sender();
|
||||
XmlElementCollection *collection = static_cast<XmlElementCollection *> (object);
|
||||
auto *collection = static_cast<XmlElementCollection *> (object);
|
||||
if (!collection)
|
||||
return;
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ void ElementsCollectionWidget::customContextMenu(const QPoint &point)
|
||||
if (eci->type() == FileElementCollectionItem::Type)
|
||||
{
|
||||
add_open_dir = true;
|
||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||
auto *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||
if (!feci->isCommonCollection())
|
||||
{
|
||||
if (feci->isDir())
|
||||
@@ -261,7 +261,7 @@ void ElementsCollectionWidget::customContextMenu(const QPoint &point)
|
||||
}
|
||||
if (eci->type() == XmlProjectElementCollectionItem::Type)
|
||||
{
|
||||
XmlProjectElementCollectionItem *xpeci = static_cast<XmlProjectElementCollectionItem *>(eci);
|
||||
auto *xpeci = static_cast<XmlProjectElementCollectionItem *>(eci);
|
||||
if (xpeci->isCollectionRoot())
|
||||
add_open_dir = true;
|
||||
}
|
||||
@@ -404,7 +404,7 @@ void ElementsCollectionWidget::editDirectory()
|
||||
|
||||
if (eci->type() != FileElementCollectionItem::Type) return;
|
||||
|
||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||
auto *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||
if(feci->isCommonCollection()) return;
|
||||
|
||||
ElementsLocation location(feci->collectionPath());
|
||||
@@ -424,7 +424,7 @@ void ElementsCollectionWidget::newDirectory()
|
||||
|
||||
if (eci->type() != FileElementCollectionItem::Type) return;
|
||||
|
||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||
auto *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||
if(feci->isCommonCollection()) return;
|
||||
|
||||
ElementsLocation location(feci->collectionPath());
|
||||
@@ -445,7 +445,7 @@ void ElementsCollectionWidget::newElement()
|
||||
return;
|
||||
}
|
||||
|
||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||
auto *feci = static_cast<FileElementCollectionItem*>(eci);
|
||||
if(feci->isCommonCollection()) {
|
||||
return;
|
||||
}
|
||||
@@ -533,7 +533,7 @@ void ElementsCollectionWidget::dirProperties()
|
||||
void ElementsCollectionWidget::reload()
|
||||
{
|
||||
m_progress_bar->show();
|
||||
ElementsCollectionModel *new_model = new ElementsCollectionModel(m_tree_view);
|
||||
auto *new_model = new ElementsCollectionModel(m_tree_view);
|
||||
|
||||
QList <QETProject *> project_list;
|
||||
project_list.append(m_waiting_project);
|
||||
|
||||
@@ -50,8 +50,8 @@ void ElementsTreeView::startDrag(Qt::DropActions supportedActions)
|
||||
return;
|
||||
}
|
||||
|
||||
if (QStandardItemModel *qsim = static_cast<QStandardItemModel *>(model())) {
|
||||
if (ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsim->itemFromIndex(index))) {
|
||||
if (auto *qsim = static_cast<QStandardItemModel *>(model())) {
|
||||
if (auto *eci = static_cast<ElementCollectionItem *>(qsim->itemFromIndex(index))) {
|
||||
ElementsLocation loc (eci->collectionPath());
|
||||
if (loc.exist()) {
|
||||
startElementDrag(loc);
|
||||
@@ -72,10 +72,10 @@ void ElementsTreeView::startElementDrag(const ElementsLocation &location)
|
||||
if (!location.exist())
|
||||
return;
|
||||
|
||||
QDrag *drag = new QDrag(this);
|
||||
auto *drag = new QDrag(this);
|
||||
|
||||
QString location_str = location.toString();
|
||||
QMimeData *mime_data = new QMimeData();
|
||||
auto *mime_data = new QMimeData();
|
||||
mime_data->setText(location_str);
|
||||
|
||||
if (location.isDirectory())
|
||||
|
||||
@@ -58,7 +58,7 @@ QString FileElementCollectionItem::fileSystemPath() const
|
||||
if (isCollectionRoot())
|
||||
return m_path;
|
||||
|
||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *> (parent());
|
||||
auto *feci = static_cast<FileElementCollectionItem *> (parent());
|
||||
if (feci)
|
||||
return feci->fileSystemPath() + "/" + m_path;
|
||||
else
|
||||
@@ -172,7 +172,7 @@ QString FileElementCollectionItem::collectionPath() const
|
||||
return "custom://";
|
||||
}
|
||||
else if (parent() && parent()->type() == FileElementCollectionItem::Type) {
|
||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem*>(parent());
|
||||
auto *eci = static_cast<ElementCollectionItem*>(parent());
|
||||
if (eci->isCollectionRoot())
|
||||
return eci->collectionPath() + m_path;
|
||||
else
|
||||
@@ -222,7 +222,7 @@ void FileElementCollectionItem::addChildAtPath(const QString &collection_name)
|
||||
if (collection_name.isEmpty())
|
||||
return;
|
||||
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
auto *feci = new FileElementCollectionItem();
|
||||
insertRow(rowForInsertItem(collection_name), feci);
|
||||
feci->setPathName(collection_name);
|
||||
feci->setUpData();
|
||||
@@ -299,7 +299,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
|
||||
//Get all directory in this directory.
|
||||
foreach(QString str, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
|
||||
{
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
auto *feci = new FileElementCollectionItem();
|
||||
appendRow(feci);
|
||||
feci->setPathName(str, set_data, hide_element);
|
||||
if (set_data)
|
||||
@@ -313,7 +313,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
|
||||
dir.setNameFilters(QStringList() << "*.elmt");
|
||||
foreach(QString str, dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
|
||||
{
|
||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||
auto *feci = new FileElementCollectionItem();
|
||||
appendRow(feci);
|
||||
feci->setPathName(str, set_data);
|
||||
if (set_data)
|
||||
|
||||
@@ -102,7 +102,7 @@ QString XmlProjectElementCollectionItem::embeddedPath() const
|
||||
if (isCollectionRoot())
|
||||
return "embed://";
|
||||
else if (parent()){
|
||||
XmlProjectElementCollectionItem *xpeci = static_cast<XmlProjectElementCollectionItem *>(parent());
|
||||
auto *xpeci = static_cast<XmlProjectElementCollectionItem *>(parent());
|
||||
|
||||
if (xpeci->isCollectionRoot())
|
||||
return xpeci->embeddedPath() + name();
|
||||
@@ -143,7 +143,7 @@ void XmlProjectElementCollectionItem::addChildAtPath(const QString &collection_n
|
||||
|
||||
while (!child_element.isNull()) {
|
||||
if (child_element.attribute("name") == collection_name) {
|
||||
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem ();
|
||||
auto *xpeci = new XmlProjectElementCollectionItem ();
|
||||
insertRow(rowForInsertItem(collection_name), xpeci);
|
||||
xpeci->setXmlElement(child_element, m_project);
|
||||
xpeci->setUpData();
|
||||
@@ -229,7 +229,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element)
|
||||
|
||||
foreach (QDomElement element, dom_category)
|
||||
{
|
||||
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem();
|
||||
auto *xpeci = new XmlProjectElementCollectionItem();
|
||||
appendRow(xpeci);
|
||||
xpeci->setXmlElement(element, m_project, set_data, hide_element);
|
||||
if (set_data)
|
||||
@@ -244,7 +244,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element)
|
||||
|
||||
foreach (QDomElement element, dom_elements)
|
||||
{
|
||||
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem();
|
||||
auto *xpeci = new XmlProjectElementCollectionItem();
|
||||
appendRow(xpeci);
|
||||
xpeci->setXmlElement(element, m_project, set_data);
|
||||
if (set_data)
|
||||
|
||||
Reference in New Issue
Block a user