forked from qt-creator/qt-creator
QmlProfiler: Increase minimum size of timeline items to 3px
One pixel wide lines are too hard to spot. Change-Id: I94f71ba4305078d8682673618be0f5a5e1f85ba8 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -109,16 +109,20 @@ inline void TimelineRenderer::getItemXExtent(int modelIndex, int i, int ¤t
|
|||||||
qint64 start = m_profilerModelProxy->startTime(modelIndex, i) - m_startTime;
|
qint64 start = m_profilerModelProxy->startTime(modelIndex, i) - m_startTime;
|
||||||
if (start > 0) {
|
if (start > 0) {
|
||||||
currentX = start * m_spacing;
|
currentX = start * m_spacing;
|
||||||
itemWidth = qMax(1.0, (qMin(m_profilerModelProxy->duration(modelIndex, i) *
|
itemWidth = m_profilerModelProxy->duration(modelIndex, i) * m_spacing;
|
||||||
m_spacing, m_spacedDuration)));
|
|
||||||
} else {
|
} else {
|
||||||
currentX = -OutOfScreenMargin;
|
currentX = -OutOfScreenMargin;
|
||||||
// Explicitly round the "start" part down, away from 0, to match the implicit rounding of
|
// 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
|
// 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.
|
// 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 +
|
itemWidth = m_profilerModelProxy->duration(modelIndex, i) * m_spacing +
|
||||||
floor(start * m_spacing) + OutOfScreenMargin,
|
floor(start * m_spacing) + OutOfScreenMargin;
|
||||||
m_spacedDuration)));
|
}
|
||||||
|
if (itemWidth < MinimumItemWidth) {
|
||||||
|
currentX -= (MinimumItemWidth - itemWidth) / 2;
|
||||||
|
itemWidth = MinimumItemWidth;
|
||||||
|
} else if (itemWidth > m_spacedDuration) {
|
||||||
|
itemWidth = m_spacedDuration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,6 +197,8 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static const int OutOfScreenMargin = 3; // margin to make sure the rectangles stay invisible
|
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 ¤tX, int &itemWidth);
|
inline void getItemXExtent(int modelIndex, int i, int ¤tX, int &itemWidth);
|
||||||
void resetCurrentSelection();
|
void resetCurrentSelection();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user