forked from qt-creator/qt-creator
QmlProfiler: Don't hide the "Painting" category
Hiding a category in the timeline view is highly confusing. Previously the "Painting" category would only be visible if either the model is empty or at least one painting event was available. Like this it's always there. In the obscure case of a mixed Qt4/Qt5 application you can get two "Painting" categories now. Change-Id: I54db106ed868b7e5d46d0e0ac22b46c0df8be862 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -62,6 +62,7 @@ public:
|
||||
int minAnimationCount;
|
||||
int maxAnimationCount;
|
||||
bool expanded;
|
||||
bool seenForeignPaintEvent;
|
||||
|
||||
PaintEventsModelProxy *q;
|
||||
};
|
||||
@@ -100,6 +101,7 @@ void PaintEventsModelProxy::clear()
|
||||
d->minAnimationCount = 1;
|
||||
d->maxAnimationCount = 1;
|
||||
d->expanded = false;
|
||||
d->seenForeignPaintEvent = false;
|
||||
m_modelManager->modelProxyCountUpdated(m_modelId, 0, 1);
|
||||
}
|
||||
|
||||
@@ -122,8 +124,11 @@ void PaintEventsModelProxy::loadData()
|
||||
qint64 minNextStartTime = 0;
|
||||
|
||||
foreach (const QmlProfilerSimpleModel::QmlEventData &event, referenceList) {
|
||||
if (!eventAccepted(event))
|
||||
if (!eventAccepted(event)) {
|
||||
if (event.eventType == QmlDebug::Painting)
|
||||
d->seenForeignPaintEvent = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// initial estimation of the event duration: 1/framerate
|
||||
qint64 estimatedDuration = event.numericData1 > 0 ? 1e9/event.numericData1 : 1;
|
||||
@@ -190,7 +195,7 @@ int PaintEventsModelProxy::categoryDepth(int categoryIndex) const
|
||||
{
|
||||
Q_UNUSED(categoryIndex);
|
||||
if (isEmpty())
|
||||
return 0;
|
||||
return d->seenForeignPaintEvent ? 0 : 1;
|
||||
else
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ struct CategorySpan {
|
||||
int expandedRows;
|
||||
int contractedRows;
|
||||
int rowStart;
|
||||
bool empty;
|
||||
};
|
||||
|
||||
class BasicTimelineModel::BasicTimelineModelPrivate : public SortedTimelineModel<BasicTimelineModel::QmlRangeEventStartInstance>
|
||||
@@ -70,6 +69,7 @@ public:
|
||||
QVector <BasicTimelineModel::QmlRangeEventData> eventDict;
|
||||
QVector <QString> eventHashes;
|
||||
QVector <CategorySpan> categorySpan;
|
||||
bool seenPaintEvent;
|
||||
|
||||
BasicTimelineModel *q;
|
||||
};
|
||||
@@ -108,6 +108,7 @@ void BasicTimelineModel::clear()
|
||||
d->eventDict.clear();
|
||||
d->eventHashes.clear();
|
||||
d->categorySpan.clear();
|
||||
d->seenPaintEvent = false;
|
||||
|
||||
m_modelManager->modelProxyCountUpdated(m_modelId, 0, 1);
|
||||
}
|
||||
@@ -116,7 +117,7 @@ void BasicTimelineModel::BasicTimelineModelPrivate::prepare()
|
||||
{
|
||||
categorySpan.clear();
|
||||
for (int i = 0; i < QmlDebug::MaximumQmlEventType; i++) {
|
||||
CategorySpan newCategory = {false, 1, 1, i, true};
|
||||
CategorySpan newCategory = {false, 1, 1, i};
|
||||
categorySpan << newCategory;
|
||||
}
|
||||
}
|
||||
@@ -125,7 +126,7 @@ bool BasicTimelineModel::eventAccepted(const QmlProfilerSimpleModel::QmlEventDat
|
||||
{
|
||||
// only accept Qt4.x Painting events
|
||||
if (event.eventType == QmlDebug::Painting)
|
||||
return event.bindingType == QmlDebug::QPainterEvent;
|
||||
return (event.bindingType == QmlDebug::QPainterEvent);
|
||||
|
||||
return (event.eventType <= QmlDebug::HandlingSignal);
|
||||
}
|
||||
@@ -146,6 +147,8 @@ void BasicTimelineModel::loadData()
|
||||
foreach (const QmlProfilerSimpleModel::QmlEventData &event, eventList) {
|
||||
if (!eventAccepted(event))
|
||||
continue;
|
||||
if (event.eventType == QmlDebug::Painting)
|
||||
d->seenPaintEvent = true;
|
||||
|
||||
QString eventHash = QmlProfilerSimpleModel::getHashString(event);
|
||||
|
||||
@@ -231,7 +234,6 @@ void BasicTimelineModel::BasicTimelineModelPrivate::computeNestingContracted()
|
||||
// nestingdepth
|
||||
for (i = 0; i < eventCount; i++) {
|
||||
int eventType = q->getEventType(i);
|
||||
categorySpan[eventType].empty = false;
|
||||
if (categorySpan[eventType].contractedRows <= ranges[i].displayRowCollapsed)
|
||||
categorySpan[eventType].contractedRows = ranges[i].displayRowCollapsed + 1;
|
||||
}
|
||||
@@ -245,7 +247,6 @@ void BasicTimelineModel::BasicTimelineModelPrivate::computeExpandedLevels()
|
||||
int eventId = ranges[i].eventId;
|
||||
int eventType = eventDict[eventId].eventType;
|
||||
if (!eventRow.contains(eventId)) {
|
||||
categorySpan[eventType].empty = false;
|
||||
eventRow[eventId] = categorySpan[eventType].expandedRows++;
|
||||
}
|
||||
ranges[i].displayRowExpanded = eventRow[eventId];
|
||||
@@ -340,11 +341,11 @@ void BasicTimelineModel::setExpanded(int category, bool expanded)
|
||||
|
||||
int BasicTimelineModel::categoryDepth(int categoryIndex) const
|
||||
{
|
||||
// special for paint events: show only when empty model or there's actual events
|
||||
if (categoryIndex == QmlDebug::Painting && !d->seenPaintEvent)
|
||||
return 0;
|
||||
if (d->categorySpan.count() <= categoryIndex)
|
||||
return 1;
|
||||
// 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
|
||||
@@ -393,7 +394,7 @@ int BasicTimelineModel::getEventCategory(int index) const
|
||||
{
|
||||
int evTy = getEventType(index);
|
||||
// special: paint events shown?
|
||||
if (d->categorySpan[0].empty && !isEmpty())
|
||||
if (!d->seenPaintEvent)
|
||||
return evTy - 1;
|
||||
return evTy;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user