Analyzer: Re-design the diagnostics view.

The old one had a number of problems, mainly due to the awkward
delegate that was used for presenting the data. For instance:
    - Only one diagnostic at a time could be looked at
      in detail.
    - Once it had been opened, it was not possible to close
      such a detailed view again, other than by opening a new one.
We now use a tree view for showing the diagnostics, so users
can show and hide details about as many diagnostics as they
wish. That also gets us sensible item selection capabilities,
so features like suppressing several diagnostics at once can
be implemented in the future.

Change-Id: I840fdbfeca4d936ce600c8f6dde58b2ab93b0d00
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Christian Kandeler
2015-06-25 10:00:49 +02:00
parent 48b4509c70
commit 6406fd3645
14 changed files with 466 additions and 729 deletions

View File

@@ -32,39 +32,25 @@
#ifndef LIBVALGRIND_PROTOCOL_ERRORLISTMODEL_H
#define LIBVALGRIND_PROTOCOL_ERRORLISTMODEL_H
#include <QAbstractItemModel>
#include <analyzerbase/detailederrorview.h>
#include <utils/treemodel.h>
#include <QSharedPointer>
namespace Valgrind {
namespace XmlProtocol {
class Error;
class ErrorListModelPrivate;
class Frame;
class ErrorListModel : public QAbstractItemModel
class ErrorListModel : public Utils::TreeModel
{
Q_OBJECT
public:
enum Column {
WhatColumn = 0,
LocationColumn,
AbsoluteFilePathColumn,
LineColumn,
UniqueColumn,
TidColumn,
KindColumn,
LeakedBlocksColumn,
LeakedBytesColumn,
HelgrindThreadIdColumn,
ColumnCount
};
enum Role {
ErrorRole = Qt::UserRole,
AbsoluteFilePathRole,
FileRole,
LineRole
ErrorRole = Analyzer::DetailedErrorView::FullTextRole + 1,
};
class RelevantFrameFinder
@@ -80,26 +66,11 @@ public:
QSharedPointer<const RelevantFrameFinder> relevantFrameFinder() const;
void setRelevantFrameFinder(const QSharedPointer<const RelevantFrameFinder> &finder);
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &child) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
Error error(const QModelIndex &index) const;
Frame findRelevantFrame(const Error &error) const;
void clear();
public slots:
void addError(const Valgrind::XmlProtocol::Error &error);
private:
class Private;
Private *const d;
ErrorListModelPrivate *const d;
};
} // namespace XmlProtocol