1#include <Gui/Timeline/TimelineTimeScale.hpp>
5#include <Gui/Timeline/TimelineScrollArea.hpp>
9TimelineTimeScale::TimelineTimeScale( QWidget* parent ) : QFrame( parent ) {}
12 m_scrollArea = scrollArea;
15void TimelineTimeScale::paintEvent( QPaintEvent* event ) {
16 if ( m_scrollArea ==
nullptr ) {
17 QFrame::paintEvent( event );
21 QPainter painter(
this );
22 painter.setRenderHint( QPainter::Antialiasing );
24 painter.drawText( 0, 11,
"sec" );
25 Scalar pixPerSec = m_scrollArea->getPixPerSec();
26 Scalar step = m_scrollArea->getStep();
27 for (
int i = 1; i < m_scrollArea->getNbInterval(); i++ ) {
28 int x = int( pixPerSec * step * i );
29 QString time = QString::number(
double( ( i - 1 ) * step ) );
30 int dec = time.size() * 6 / 2;
31 painter.drawText( x - dec, 11, time );