@@ -153,11 +153,11 @@ void ResultsTree::setReportType(ReportType reportType) {
153153 mGuideline = createGuidelineMapping (reportType);
154154
155155 for (int i = 0 ; i < mModel ->rowCount (); ++i) {
156- ResultItem *fileItem = dynamic_cast <ResultItem*>(mModel ->item (i, COLUMN_FILE));
156+ auto *fileItem = dynamic_cast <ResultItem*>(mModel ->item (i, COLUMN_FILE));
157157 if (!fileItem)
158158 continue ;
159159 for (int j = 0 ; j < fileItem->rowCount (); ++j) {
160- auto & errorItem = dynamic_cast <ResultItem*>(fileItem->child (j,0 ))->errorItem ;
160+ QSharedPointer<ErrorItem> & errorItem = dynamic_cast <ResultItem*>(fileItem->child (j,0 ))->errorItem ;
161161 errorItem->guideline = getGuideline (mReportType , mGuideline , errorItem->errorId , errorItem->severity );
162162 errorItem->classification = getClassification (mReportType , errorItem->guideline );
163163 fileItem->child (j, COLUMN_CERT_LEVEL)->setText (errorItem->classification );
@@ -431,7 +431,7 @@ void ResultsTree::clear(const QString &filename)
431431 const QString stripped = QDir::toNativeSeparators (stripPath (filename, false ));
432432
433433 for (int i = 0 ; i < mModel ->rowCount (); ++i) {
434- const ResultItem *fileItem = dynamic_cast <ResultItem*>(mModel ->item (i, COLUMN_FILE));
434+ const auto *fileItem = dynamic_cast <ResultItem*>(mModel ->item (i, COLUMN_FILE));
435435 if (!fileItem)
436436 continue ;
437437
@@ -446,7 +446,7 @@ void ResultsTree::clear(const QString &filename)
446446void ResultsTree::clearRecheckFile (const QString &filename)
447447{
448448 for (int i = 0 ; i < mModel ->rowCount (); ++i) {
449- const ResultItem *fileItem = dynamic_cast <ResultItem*>(mModel ->item (i, COLUMN_FILE));
449+ const auto *fileItem = dynamic_cast <ResultItem*>(mModel ->item (i, COLUMN_FILE));
450450 if (!fileItem)
451451 continue ;
452452
@@ -527,7 +527,7 @@ void ResultsTree::refreshTree()
527527
528528 for (int i = 0 ; i < filecount; i++) {
529529 // Get file i
530- ResultItem *fileItem = dynamic_cast <ResultItem*>(mModel ->item (i, 0 ));
530+ auto *fileItem = dynamic_cast <ResultItem*>(mModel ->item (i, 0 ));
531531 if (!fileItem) {
532532 continue ;
533533 }
@@ -540,7 +540,7 @@ void ResultsTree::refreshTree()
540540
541541 for (int j = 0 ; j < errorcount; j++) {
542542 // Get the error itself
543- ResultItem *child = dynamic_cast <ResultItem*>(fileItem->child (j, 0 ));
543+ auto *child = dynamic_cast <ResultItem*>(fileItem->child (j, 0 ));
544544 if (!child) {
545545 continue ;
546546 }
@@ -913,7 +913,7 @@ void ResultsTree::copy()
913913
914914 QString text;
915915 for (const QModelIndex& index : mSelectionModel ->selectedRows ()) {
916- const ResultItem *item = dynamic_cast <ResultItem*>(mModel ->itemFromIndex (index));
916+ const auto *item = dynamic_cast <ResultItem*>(mModel ->itemFromIndex (index));
917917 if (!item)
918918 continue ;
919919 if (item->getType () == ResultItem::Type::file)
@@ -936,7 +936,7 @@ void ResultsTree::hideResult()
936936 return ;
937937 bool hide = false ;
938938 for (const QModelIndex& index : mSelectionModel ->selectedRows ()) {
939- ResultItem *item = dynamic_cast <ResultItem*>(mModel ->itemFromIndex (index));
939+ auto *item = dynamic_cast <ResultItem*>(mModel ->itemFromIndex (index));
940940 if (item && item->getType () == ResultItem::Type::message)
941941 hide = item->hidden = true ;
942942 }
@@ -953,7 +953,7 @@ void ResultsTree::recheckSelectedFiles()
953953
954954 QStringList selectedItems;
955955 for (const QModelIndex& index : mSelectionModel ->selectedRows ()) {
956- const ResultItem *item = dynamic_cast <ResultItem*>(mModel ->itemFromIndex (index));
956+ const auto *item = dynamic_cast <ResultItem*>(mModel ->itemFromIndex (index));
957957 while (item->parent ())
958958 item = dynamic_cast <const ResultItem*>(item->parent ());
959959 const auto e = item->getErrorPathItem ();
@@ -1001,7 +1001,7 @@ void ResultsTree::suppressSelectedIds()
10011001
10021002 QSet<QString> selectedIds;
10031003 for (const QModelIndex& index : mSelectionModel ->selectedRows ()) {
1004- const ResultItem *item = dynamic_cast <ResultItem*>(mModel ->itemFromIndex (index));
1004+ const auto *item = dynamic_cast <ResultItem*>(mModel ->itemFromIndex (index));
10051005 if (!item || item->getType () == ResultItem::Type::file || !item->errorItem )
10061006 continue ;
10071007 selectedIds << item->errorItem ->errorId ;
@@ -1011,7 +1011,7 @@ void ResultsTree::suppressSelectedIds()
10111011 for (int i = 0 ; i < mModel ->rowCount (); i++) {
10121012 QStandardItem * const file = mModel ->item (i, 0 );
10131013 for (int j = 0 ; j < file->rowCount ();) {
1014- const ResultItem *errorItem = dynamic_cast <ResultItem*>(file->child (j, 0 ));
1014+ const auto *errorItem = dynamic_cast <ResultItem*>(file->child (j, 0 ));
10151015 if (errorItem && errorItem->errorItem && selectedIds.contains (errorItem->errorItem ->errorId )) {
10161016 file->removeRow (j);
10171017 } else {
@@ -1037,7 +1037,7 @@ void ResultsTree::suppressHash()
10371037 ProjectFile *projectFile = ProjectFile::getActiveProject ();
10381038
10391039 for (QModelIndex index : mSelectionModel ->selectedRows ()) {
1040- ResultItem *item = dynamic_cast <ResultItem *>(mModel ->itemFromIndex (index));
1040+ auto *item = dynamic_cast <ResultItem *>(mModel ->itemFromIndex (index));
10411041 if (!item || item->getType () == ResultItem::Type::file)
10421042 continue ;
10431043 if (item->getType () == ResultItem::Type::note)
@@ -1080,7 +1080,7 @@ void ResultsTree::tagSelectedItems(const QString &tag)
10801080 bool isTagged = false ;
10811081 ProjectFile *currentProject = ProjectFile::getActiveProject ();
10821082 for (QModelIndex index : mSelectionModel ->selectedRows ()) {
1083- ResultItem *item = dynamic_cast <ResultItem*>(mModel ->itemFromIndex (index));
1083+ auto *item = dynamic_cast <ResultItem*>(mModel ->itemFromIndex (index));
10841084 if (item && item->getType () != ResultItem::Type::file) {
10851085 if (item->getType () == ResultItem::Type::note)
10861086 item = dynamic_cast <ResultItem*>(item->parent ());
@@ -1145,7 +1145,7 @@ void ResultsTree::saveErrors(Report *report, const ResultItem *fileItem) const
11451145 }
11461146
11471147 for (int i = 0 ; i < fileItem->rowCount (); i++) {
1148- const ResultItem *error = dynamic_cast <ResultItem*>(fileItem->child (i, 0 ));
1148+ const auto *error = dynamic_cast <ResultItem*>(fileItem->child (i, 0 ));
11491149
11501150 if (!error) {
11511151 continue ;
@@ -1172,9 +1172,9 @@ void ResultsTree::updateFromOldReport(const QString &filename)
11721172
11731173 // Read current results..
11741174 for (int i = 0 ; i < mModel ->rowCount (); i++) {
1175- ResultItem *fileItem = dynamic_cast <ResultItem*>(mModel ->item (i,COLUMN_FILE));
1175+ auto *fileItem = dynamic_cast <ResultItem*>(mModel ->item (i,COLUMN_FILE));
11761176 for (int j = 0 ; j < fileItem->rowCount (); j++) {
1177- ResultItem *error = dynamic_cast <ResultItem*>(fileItem->child (j,COLUMN_FILE));
1177+ auto *error = dynamic_cast <ResultItem*>(fileItem->child (j,COLUMN_FILE));
11781178 if (!error)
11791179 // FIXME..
11801180 continue ;
@@ -1258,7 +1258,7 @@ void ResultsTree::refreshFilePaths(ResultItem *fileItem)
12581258 // Loop through all errors within this file
12591259 for (int i = 0 ; i < fileItem->rowCount (); i++) {
12601260 // Get error i
1261- ResultItem *error = dynamic_cast <ResultItem*>(fileItem->child (i, COLUMN_FILE));
1261+ auto *error = dynamic_cast <ResultItem*>(fileItem->child (i, COLUMN_FILE));
12621262
12631263 if (!error) {
12641264 continue ;
@@ -1270,7 +1270,7 @@ void ResultsTree::refreshFilePaths(ResultItem *fileItem)
12701270 // Loop through all files within the error
12711271 for (int j = 0 ; j < error->rowCount (); j++) {
12721272 // Get file
1273- ResultItem *child = dynamic_cast <ResultItem*>(error->child (j, COLUMN_FILE));
1273+ auto *child = dynamic_cast <ResultItem*>(error->child (j, COLUMN_FILE));
12741274 if (child) {
12751275 // Update file's path
12761276 refreshItem (child);
@@ -1325,7 +1325,7 @@ void ResultsTree::showInconclusiveColumn(bool show)
13251325void ResultsTree::currentChanged (const QModelIndex ¤t, const QModelIndex &previous)
13261326{
13271327 QTreeView::currentChanged (current, previous);
1328- const ResultItem *item = dynamic_cast <ResultItem*>(mModel ->itemFromIndex (current));
1328+ const auto *item = dynamic_cast <ResultItem*>(mModel ->itemFromIndex (current));
13291329 emit treeSelectionChanged (item);
13301330}
13311331
0 commit comments