aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristiaan Janssen <christiaan.janssen@digia.com>2013-06-13 16:23:22 +0200
committerKai Koehne <kai.koehne@digia.com>2013-06-14 16:52:52 +0300
commit1b49b4df118b92d70c71482fe69bc5a54906685c (patch)
treeb8b0cb24a04ad52324d4e2f7270edf7b1146d90f
parent1068b288f657051a22ba00ea8c31856423cb7162 (diff)
QmlProfiler: hiding paintevents depending on Qt version
Change-Id: I7f542c8e3abe3eaf8e3221e174f5255a78ceff02 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
-rw-r--r--plugins/qmlprofiler/qml/Label.qml14
-rw-r--r--plugins/qmlprofiler/qml/MainView.qml2
-rw-r--r--plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp25
-rw-r--r--plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp8
4 files changed, 22 insertions, 27 deletions
diff --git a/plugins/qmlprofiler/qml/Label.qml b/plugins/qmlprofiler/qml/Label.qml
index 4163b9b3ac..5c0ac3ca60 100644
--- a/plugins/qmlprofiler/qml/Label.qml
+++ b/plugins/qmlprofiler/qml/Label.qml
@@ -40,17 +40,11 @@ Item {
property variant extdescriptions: []
property variant eventIds: []
+ visible: qmlProfilerModelProxy.categoryDepth(modelIndex, categoryIndex) > 0;
+
height: root.singleRowHeight
width: 150
- visible: (!qmlProfilerModelProxy.empty) && qmlProfilerModelProxy.categoryDepth(modelIndex,categoryIndex) > 0;
- onVisibleChanged: {
- if (visible) {
- modelIndex = qmlProfilerModelProxy.modelIndexForCategory(index);
- categoryIndex = qmlProfilerModelProxy.correctedCategoryIndexForModel(modelIndex, index);
- }
- }
-
onExpandedChanged: {
qmlProfilerModelProxy.setExpanded(modelIndex, categoryIndex, expanded);
backgroundMarks.requestRedraw();
@@ -67,6 +61,10 @@ Item {
}
function getDescriptions() {
+ visible = qmlProfilerModelProxy.categoryDepth(modelIndex, categoryIndex) > 0;
+ if (!visible)
+ return;
+
var desc=[];
var ids=[];
var extdesc=[];
diff --git a/plugins/qmlprofiler/qml/MainView.qml b/plugins/qmlprofiler/qml/MainView.qml
index 849d22b8b7..ab7289d309 100644
--- a/plugins/qmlprofiler/qml/MainView.qml
+++ b/plugins/qmlprofiler/qml/MainView.qml
@@ -299,8 +299,8 @@ Rectangle {
// which tracks only events from the basic model
if (!lockItemSelection) {
lockItemSelection = true;
- var itemIndex = view.nextItemFromId( eventId );
var modelIndex = qmlProfilerModelProxy.basicModelIndex();
+ var itemIndex = view.nextItemFromId( modelIndex, eventId );
// select an item, lock to it, and recenter if necessary
if (view.selectedItem != itemIndex || view.selectedModel != modelIndex) {
view.selectedModel = modelIndex;
diff --git a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp
index 12420eebbd..95dd476400 100644
--- a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp
+++ b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp
@@ -209,7 +209,7 @@ int PaintEventsModelProxy::categoryDepth(int categoryIndex) const
{
Q_UNUSED(categoryIndex);
if (isEmpty())
- return 1;
+ return 0;
else
return 2;
}
@@ -222,7 +222,7 @@ int PaintEventsModelProxy::categoryCount() const
const QString PaintEventsModelProxy::categoryLabel(int categoryIndex) const
{
Q_UNUSED(categoryIndex);
- return tr("Animations");
+ return tr("Painting");
}
@@ -336,21 +336,16 @@ float PaintEventsModelProxy::getHeight(int index) const
const QVariantList PaintEventsModelProxy::getLabelsForCategory(int category) const
{
- // TODO
+ Q_UNUSED(category);
QVariantList result;
-// if (d->categorySpan.count() > category && d->categorySpan[category].expanded) {
-// int eventCount = d->eventDict.count();
-// for (int i = 0; i < eventCount; i++) {
-// if (d->eventDict[i].eventType == category) {
-// QVariantMap element;
-// element.insert(QLatin1String("displayName"), QVariant(d->eventDict[i].displayName));
-// element.insert(QLatin1String("description"), QVariant(d->eventDict[i].details));
-// element.insert(QLatin1String("id"), QVariant(d->eventDict[i].eventId));
-// result << element;
-// }
-// }
-// }
+ if (!isEmpty()) {
+ QVariantMap element;
+ element.insert(QLatin1String("displayName"), QVariant(QLatin1String("Animations")));
+ element.insert(QLatin1String("description"), QVariant(QLatin1String("Animations")));
+ element.insert(QLatin1String("id"), QVariant(0));
+ result << element;
+ }
return result;
}
diff --git a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
index b0601e8719..1e6820e64b 100644
--- a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
+++ b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
@@ -145,7 +145,7 @@ void BasicTimelineModel::BasicTimelineModelPrivate::prepare()
{
categorySpan.clear();
for (int i = 0; i < QmlDebug::MaximumQmlEventType; i++) {
- CategorySpan newCategory = {false, 1, 1, true};
+ CategorySpan newCategory = {false, 1, 1, i, true};
categorySpan << newCategory;
}
}
@@ -421,8 +421,9 @@ int BasicTimelineModel::categoryDepth(int categoryIndex) const
{
if (d->categorySpan.count() <= categoryIndex)
return 1;
- if (d->categorySpan[categoryIndex].empty)
- return 1; // TODO
+ // special for paint events: show only when empty model or there's actual events
+ if (categoryIndex == QmlDebug::Painting && d->categorySpan[categoryIndex].empty && !isEmpty())
+ return 0;
if (d->categorySpan[categoryIndex].expanded)
return d->categorySpan[categoryIndex].expandedRows;
else
@@ -581,6 +582,7 @@ QColor BasicTimelineModel::getColor(int index) const
float BasicTimelineModel::getHeight(int index) const
{
+ Q_UNUSED(index);
// 100% height for regular events
return 1.0f;
}