Commit 10a14ced authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Increase minimum size of timeline items to 3px

One pixel wide lines are too hard to spot.

Change-Id: I94f71ba4305078d8682673618be0f5a5e1f85ba8
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent 8e7a95f0
......@@ -109,16 +109,20 @@ inline void TimelineRenderer::getItemXExtent(int modelIndex, int i, int &current
qint64 start = m_profilerModelProxy->startTime(modelIndex, i) - m_startTime;
if (start > 0) {
currentX = start * m_spacing;
itemWidth = qMax(1.0, (qMin(m_profilerModelProxy->duration(modelIndex, i) *
m_spacing, m_spacedDuration)));
itemWidth = m_profilerModelProxy->duration(modelIndex, i) * m_spacing;
} else {
currentX = -OutOfScreenMargin;
// Explicitly round the "start" part down, away from 0, to match the implicit rounding of
// currentX in the > 0 case. If we don't do that we get glitches where a pixel is added if
// the element starts outside the screen and subtracted if it starts inside the screen.
itemWidth = qMax(1.0, (qMin(m_profilerModelProxy->duration(modelIndex, i) * m_spacing +
floor(start * m_spacing) + OutOfScreenMargin,
m_spacedDuration)));
itemWidth = m_profilerModelProxy->duration(modelIndex, i) * m_spacing +
floor(start * m_spacing) + OutOfScreenMargin;
}
if (itemWidth < MinimumItemWidth) {
currentX -= (MinimumItemWidth - itemWidth) / 2;
itemWidth = MinimumItemWidth;
} else if (itemWidth > m_spacedDuration) {
itemWidth = m_spacedDuration;
}
}
......
......@@ -197,6 +197,8 @@ private:
private:
static const int OutOfScreenMargin = 3; // margin to make sure the rectangles stay invisible
static const int MinimumItemWidth = 3;
inline void getItemXExtent(int modelIndex, int i, int &currentX, int &itemWidth);
void resetCurrentSelection();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment