forked from qt-creator/qt-creator
QmlProfiler: make notes model usable on its own
Change-Id: Ifbc42208d3a34051fbf87cff7e9179f7dcdd7bf9 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
namespace QmlProfiler {
|
||||
class QMLPROFILER_EXPORT QmlProfilerNotesModel : public QObject {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int count READ count NOTIFY changed)
|
||||
public:
|
||||
struct Note {
|
||||
// Saved properties
|
||||
@@ -55,21 +56,23 @@ public:
|
||||
void setModelManager(QmlProfilerModelManager *modelManager);
|
||||
void addTimelineModel(const AbstractTimelineModel *timelineModel);
|
||||
|
||||
int typeId(int index) const;
|
||||
QString text(int index) const;
|
||||
int timelineModel(int index) const;
|
||||
int timelineIndex(int index) const;
|
||||
Q_INVOKABLE int typeId(int index) const;
|
||||
Q_INVOKABLE QString text(int index) const;
|
||||
Q_INVOKABLE int timelineModel(int index) const;
|
||||
Q_INVOKABLE int timelineIndex(int index) const;
|
||||
|
||||
QVariantList byTypeId(int typeId) const;
|
||||
Q_INVOKABLE QVariantList byTypeId(int typeId) const;
|
||||
Q_INVOKABLE QVariantList byTimelineModel(int timelineModel) const;
|
||||
|
||||
QVariantList byTimelineModel(int timelineModel) const;
|
||||
Q_INVOKABLE int get(int timelineModel, int timelineIndex) const;
|
||||
Q_INVOKABLE int add(int timelineModel, int timelineIndex, const QString &text);
|
||||
Q_INVOKABLE void update(int index, const QString &text);
|
||||
Q_INVOKABLE void remove(int index);
|
||||
|
||||
Q_INVOKABLE void setText(int noteId, const QString &text);
|
||||
Q_INVOKABLE void setText(int modelIndex, int index, const QString &text);
|
||||
|
||||
int get(int timelineModel, int timelineIndex) const;
|
||||
int add(int timelineModel, int timelineIndex, const QString &text);
|
||||
void update(int index, const QString &text);
|
||||
void remove(int index);
|
||||
bool isModified() const;
|
||||
|
||||
void loadData();
|
||||
void saveData();
|
||||
void clear();
|
||||
|
||||
Reference in New Issue
Block a user