Commit 4436a1c7 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Add some more consistency to flame graph model

model.parent(someFirstLevelItem) should return the invisible root item.
Methods with default parameter in the base class should also have a
default parameter in the derived class. As rowCount() is Q_INVOKABLE
columnCount() should also be.

Change-Id: I62a0ec6f91d01581fd47a43c97af63c58cdd13fa
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@theqtcompany.com>
parent 7dce6bb4
......@@ -222,7 +222,8 @@ QModelIndex FlameGraphModel::parent(const QModelIndex &child) const
{
if (child.isValid()) {
FlameGraphData *childData = static_cast<FlameGraphData *>(child.internalPointer());
return createIndex(0, 0, childData->parent);
return childData->parent == &m_stackBottom ? QModelIndex() :
createIndex(0, 0, childData->parent);
} else {
return QModelIndex();
}
......
......@@ -74,10 +74,11 @@ public:
FlameGraphModel(QmlProfilerModelManager *modelManager, QObject *parent = 0);
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
QModelIndex index(int row, int column,
const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &child) const override;
Q_INVOKABLE int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent) const override;
Q_INVOKABLE int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
QHash<int, QByteArray> roleNames() const override;
QmlProfilerModelManager *modelManager() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment