QmlProfiler: make notes model usable on its own

Change-Id: Ifbc42208d3a34051fbf87cff7e9179f7dcdd7bf9
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2014-11-04 12:32:25 +01:00
committed by Ulf Hermann
parent 7956b176e6
commit 85768a4864
2 changed files with 34 additions and 11 deletions

View File

@@ -188,6 +188,26 @@ int QmlProfilerNotesModel::add(int typeId, qint64 start, qint64 duration, const
return m_data.count() - 1;
}
void QmlProfilerNotesModel::setText(int noteId, const QString &text)
{
if (text.length() > 0) {
update(noteId, text);
} else {
remove(noteId);
}
}
void QmlProfilerNotesModel::setText(int modelIndex, int index, const QString &text)
{
int noteId = get(modelIndex, index);
if (noteId == -1) {
if (text.length() > 0)
add(modelIndex, index, text);
} else {
setText(noteId, text);
}
}
void QmlProfilerNotesModel::clear()
{
m_data.clear();