/*! Returns the time relative to the reference time for given pixel position (x-coordinate) \a xcoord */ double UiTimeAxis::pixelToTimeRelativeRef(double xcoord) { // make xcoord relative to the plot area only xcoord -= infoWidth(); return (xcoord*mMajorStepTime) / (MajorStepPixelWidth) + mRangeLower; }
/*! Paint event handler responsible for painting this widget. */ void UiTimeAxis::paintEvent(QPaintEvent *event) { (void)event; QPainter painter(this); int plotWidth = width()-infoWidth(); int numMinorSteps = plotWidth / (MajorStepPixelWidth/NumberOfMinorSteps) + 1; painter.save(); painter.translate(infoWidth(), 0); for (int i = 0; i < numMinorSteps; i++) { int stepHeight = 3; if (/*i > 0 &&*/ (i % NumberOfMinorSteps) == 0) { stepHeight += 9; QString stepText = getTimeLabelForStep(i/NumberOfMinorSteps); // draw text centered over a major step int textWidth = painter.fontMetrics().width(stepText); painter.drawText((MajorStepPixelWidth/NumberOfMinorSteps)*i - textWidth/2, 10, stepText); } // draw minor/major step on the time axis painter.drawLine((MajorStepPixelWidth/NumberOfMinorSteps)*i, height()-stepHeight, (MajorStepPixelWidth/NumberOfMinorSteps)*i, height()); } painter.restore(); }
/*! Returns the pixel position relative to the reference position for given time \a value */ double UiTimeAxis::timeToPixelRelativeRef(double value) { return timeToPixel(value-mRangeLower) + infoWidth(); }
int Element::skipBlockWidth() const { return st::msgDateSpace + infoWidth() - st::msgDateDelta.x(); }