Move flame graph view from QmlProfiler to separate library

We want to use it for other profilers, too.

Change-Id: Ice4bd7fdfce6e0153d62a7c9a83dc7de6d5cba30
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Ulf Hermann
2016-07-18 11:19:00 +02:00
parent 97a465ae18
commit 392955488c
26 changed files with 413 additions and 261 deletions

View File

@@ -24,10 +24,12 @@
****************************************************************************/
#include "flamegraphview.h"
#include "flamegraph.h"
#include "qmlprofilerconstants.h"
#include "qmlprofilertool.h"
#include <flamegraph/flamegraph.h>
#include <QQmlEngine>
#include <QQmlContext>
#include <QVBoxLayout>
#include <QMenu>
@@ -44,14 +46,15 @@ FlameGraphView::FlameGraphView(QmlProfilerModelManager *manager, QWidget *parent
// We cannot change this without breaking the settings.
setObjectName(QStringLiteral("QmlProfilerFlamegraph"));
qmlRegisterType<FlameGraph>("FlameGraph", 1, 0, "FlameGraph");
qmlRegisterUncreatableType<FlameGraphModel>("FlameGraphModel", 1, 0, "FlameGraphModel",
qmlRegisterType<FlameGraph::FlameGraph>("FlameGraph", 1, 0, "FlameGraph");
qmlRegisterUncreatableType<FlameGraphModel>("QmlProfilerFlameGraphModel", 1, 0,
"QmlProfilerFlameGraphModel",
QLatin1String("use the context property"));
qmlRegisterUncreatableType<QAbstractItemModel>("AbstractItemModel", 1, 0, "AbstractItemModel",
QLatin1String("only for Qt 5.4"));
m_content->rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), m_model);
m_content->setSource(QUrl(QStringLiteral("qrc:/qmlprofiler/FlameGraphView.qml")));
m_content->setSource(QUrl(QStringLiteral("qrc:/qmlprofiler/QmlProfilerFlameGraphView.qml")));
m_content->setClearColor(QColor(0xdc, 0xdc, 0xdc));
m_content->setResizeMode(QQuickWidget::SizeRootObjectToView);