QmlProfiler: hiding paintevents depending on Qt version

Change-Id: I7f542c8e3abe3eaf8e3221e174f5255a78ceff02
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Christiaan Janssen
2013-06-13 16:23:22 +02:00
committed by Kai Koehne
parent 1068b288f6
commit 1b49b4df11
4 changed files with 22 additions and 27 deletions

View File

@@ -40,17 +40,11 @@ Item {
property variant extdescriptions: [] property variant extdescriptions: []
property variant eventIds: [] property variant eventIds: []
visible: qmlProfilerModelProxy.categoryDepth(modelIndex, categoryIndex) > 0;
height: root.singleRowHeight height: root.singleRowHeight
width: 150 width: 150
visible: (!qmlProfilerModelProxy.empty) && qmlProfilerModelProxy.categoryDepth(modelIndex,categoryIndex) > 0;
onVisibleChanged: {
if (visible) {
modelIndex = qmlProfilerModelProxy.modelIndexForCategory(index);
categoryIndex = qmlProfilerModelProxy.correctedCategoryIndexForModel(modelIndex, index);
}
}
onExpandedChanged: { onExpandedChanged: {
qmlProfilerModelProxy.setExpanded(modelIndex, categoryIndex, expanded); qmlProfilerModelProxy.setExpanded(modelIndex, categoryIndex, expanded);
backgroundMarks.requestRedraw(); backgroundMarks.requestRedraw();
@@ -67,6 +61,10 @@ Item {
} }
function getDescriptions() { function getDescriptions() {
visible = qmlProfilerModelProxy.categoryDepth(modelIndex, categoryIndex) > 0;
if (!visible)
return;
var desc=[]; var desc=[];
var ids=[]; var ids=[];
var extdesc=[]; var extdesc=[];

View File

@@ -299,8 +299,8 @@ Rectangle {
// which tracks only events from the basic model // which tracks only events from the basic model
if (!lockItemSelection) { if (!lockItemSelection) {
lockItemSelection = true; lockItemSelection = true;
var itemIndex = view.nextItemFromId( eventId );
var modelIndex = qmlProfilerModelProxy.basicModelIndex(); var modelIndex = qmlProfilerModelProxy.basicModelIndex();
var itemIndex = view.nextItemFromId( modelIndex, eventId );
// select an item, lock to it, and recenter if necessary // select an item, lock to it, and recenter if necessary
if (view.selectedItem != itemIndex || view.selectedModel != modelIndex) { if (view.selectedItem != itemIndex || view.selectedModel != modelIndex) {
view.selectedModel = modelIndex; view.selectedModel = modelIndex;

View File

@@ -209,7 +209,7 @@ int PaintEventsModelProxy::categoryDepth(int categoryIndex) const
{ {
Q_UNUSED(categoryIndex); Q_UNUSED(categoryIndex);
if (isEmpty()) if (isEmpty())
return 1; return 0;
else else
return 2; return 2;
} }
@@ -222,7 +222,7 @@ int PaintEventsModelProxy::categoryCount() const
const QString PaintEventsModelProxy::categoryLabel(int categoryIndex) const const QString PaintEventsModelProxy::categoryLabel(int categoryIndex) const
{ {
Q_UNUSED(categoryIndex); 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 const QVariantList PaintEventsModelProxy::getLabelsForCategory(int category) const
{ {
// TODO Q_UNUSED(category);
QVariantList result; QVariantList result;
// if (d->categorySpan.count() > category && d->categorySpan[category].expanded) { if (!isEmpty()) {
// int eventCount = d->eventDict.count(); QVariantMap element;
// for (int i = 0; i < eventCount; i++) { element.insert(QLatin1String("displayName"), QVariant(QLatin1String("Animations")));
// if (d->eventDict[i].eventType == category) { element.insert(QLatin1String("description"), QVariant(QLatin1String("Animations")));
// QVariantMap element; element.insert(QLatin1String("id"), QVariant(0));
// element.insert(QLatin1String("displayName"), QVariant(d->eventDict[i].displayName)); result << element;
// element.insert(QLatin1String("description"), QVariant(d->eventDict[i].details)); }
// element.insert(QLatin1String("id"), QVariant(d->eventDict[i].eventId));
// result << element;
// }
// }
// }
return result; return result;
} }

View File

@@ -145,7 +145,7 @@ void BasicTimelineModel::BasicTimelineModelPrivate::prepare()
{ {
categorySpan.clear(); categorySpan.clear();
for (int i = 0; i < QmlDebug::MaximumQmlEventType; i++) { for (int i = 0; i < QmlDebug::MaximumQmlEventType; i++) {
CategorySpan newCategory = {false, 1, 1, true}; CategorySpan newCategory = {false, 1, 1, i, true};
categorySpan << newCategory; categorySpan << newCategory;
} }
} }
@@ -421,8 +421,9 @@ int BasicTimelineModel::categoryDepth(int categoryIndex) const
{ {
if (d->categorySpan.count() <= categoryIndex) if (d->categorySpan.count() <= categoryIndex)
return 1; return 1;
if (d->categorySpan[categoryIndex].empty) // special for paint events: show only when empty model or there's actual events
return 1; // TODO if (categoryIndex == QmlDebug::Painting && d->categorySpan[categoryIndex].empty && !isEmpty())
return 0;
if (d->categorySpan[categoryIndex].expanded) if (d->categorySpan[categoryIndex].expanded)
return d->categorySpan[categoryIndex].expandedRows; return d->categorySpan[categoryIndex].expandedRows;
else else
@@ -581,6 +582,7 @@ QColor BasicTimelineModel::getColor(int index) const
float BasicTimelineModel::getHeight(int index) const float BasicTimelineModel::getHeight(int index) const
{ {
Q_UNUSED(index);
// 100% height for regular events // 100% height for regular events
return 1.0f; return 1.0f;
} }