Commit 27c46196 authored by Christophe Courtaut's avatar Christophe Courtaut
Browse files

Resolved real to int implicit conversion warnings

parent cdb7ab4b
......@@ -28,11 +28,11 @@ QVariant GraphicsCursorItem::itemChange( GraphicsItemChange change, const QVaria
{
qreal posX = value.toPointF().x();
if ( posX < 0 ) posX = 0;
return QPoint( posX, pos().y() );
return QPoint( ( int ) posX, ( int ) pos().y() );
}
if ( change == ItemPositionHasChanged )
{
emit cursorPositionChanged( pos().x() );
emit cursorPositionChanged( ( int ) pos().x() );
}
return QGraphicsItem::itemChange( change, value );
}
......
......@@ -14,7 +14,7 @@ class GraphicsCursorItem : public QObject, public QGraphicsItem
Q_OBJECT
public:
GraphicsCursorItem( int height, const QPen& pen );
int cursorPos() const { return pos().x(); }
int cursorPos() const { return ( int )pos().x(); }
void setCursorPos( int position );
virtual QRectF boundingRect() const;
......
......@@ -95,11 +95,11 @@ void MediaListWidget::paintEvent( QPaintEvent* event )
if ( wRatio < hRatio )
{
destRect.setWidth( viewportRect.width() );
destRect.setHeight( svgRect.height() * wRatio );
destRect.setHeight( ( int ) ( svgRect.height() * wRatio ) );
}
else
{
destRect.setWidth( svgRect.width() * hRatio );
destRect.setWidth( ( int ) ( svgRect.width() * hRatio ) );
destRect.setHeight( viewportRect.height() );
}
......
......@@ -94,8 +94,8 @@ void TracksRuler::setDuration( int duration )
{
int oldDuration = m_duration;
m_duration = duration;
update( qMin( oldDuration, m_duration ) * m_factor - 1 - m_offset, 0,
qAbs( oldDuration - m_duration ) * m_factor + 2, height() );
update( ( int ) ( qMin( oldDuration, m_duration ) * m_factor - 1 - m_offset ), 0,
( int ) ( qAbs( oldDuration - m_duration ) * m_factor + 2 ), height() );
}
void TracksRuler::paintEvent( QPaintEvent* e )
......@@ -117,8 +117,8 @@ void TracksRuler::paintEvent( QPaintEvent* e )
QPalette palette;
painter.setPen( palette.dark().color() );
offsetMin = ( e->rect().left() + m_offset ) / m_textSpacing;
offsetMin = offsetMin * m_textSpacing;
offsetMin = ( int ) ( ( e->rect().left() + m_offset ) / m_textSpacing );
offsetMin = ( int ) ( offsetMin * m_textSpacing );
for ( f = offsetMin; f < offsetMax; f += m_textSpacing )
{
QString time = getTimeCode( (int)( f / m_factor + 0.5 ) );
......@@ -149,7 +149,7 @@ void TracksRuler::paintEvent( QPaintEvent* e )
painter.drawLine( ( int )f, BIG_MARK_X1, ( int )f, BIG_MARK_X2 );
// Draw the pointer
int cursorPos = m_tracksView->cursorPos() * m_factor - offset();
int cursorPos = ( int ) ( m_tracksView->cursorPos() * m_factor - offset() );
QPolygon cursor( 3 );
cursor.setPoints( 3, cursorPos - 9, 11, cursorPos + 9, 11, cursorPos, 30 );
painter.setBrush( QBrush( QColor( 82, 97, 122, 150 ) ) );
......@@ -161,7 +161,7 @@ void TracksRuler::mousePressEvent( QMouseEvent* event )
if ( event->buttons() == Qt::LeftButton &&
event->modifiers() == Qt::NoModifier )
{
m_tracksView->setCursorPos( ( event->x() + offset() ) / m_factor );
m_tracksView->setCursorPos( ( int ) ( ( event->x() + offset() ) / m_factor ) );
}
}
......@@ -170,7 +170,7 @@ void TracksRuler::mouseMoveEvent( QMouseEvent* event )
if ( event->buttons() == Qt::LeftButton &&
event->modifiers() == Qt::NoModifier )
{
m_tracksView->setCursorPos( ( event->x() + offset() ) / m_factor );
m_tracksView->setCursorPos( ( int ) ( ( event->x() + offset() ) / m_factor ) );
}
}
......
......@@ -140,7 +140,7 @@ void TracksView::dragEnterEvent( QDragEnterEvent* event )
if ( m_dragItem ) delete m_dragItem;
m_dragItem = new GraphicsMovieItem( new Clip( media ) );
m_dragItem->setWidth( ( (double)media->getLength() / 1000 ) * m_fps );
m_dragItem->setWidth( ( int ) ( ( (double)media->getLength() / 1000 ) * m_fps ) );
m_dragItem->setHeight( tracksHeight() );
m_dragItem->setPos( mappedXPos, 0 );
m_dragItem->setParentItem( m_layout->itemAt( 0 )->graphicsItem() );
......@@ -257,7 +257,7 @@ void TracksView::dropEvent( QDropEvent* event )
void TracksView::setDuration( int duration )
{
int diff = qAbs( duration - sceneRect().width() );
int diff = ( int ) qAbs( ( qreal )duration - sceneRect().width() );
if ( diff * matrix().m11() > -50 )
{
if ( matrix().m11() < 0.4 )
......@@ -280,9 +280,9 @@ void TracksView::drawBackground( QPainter* painter, const QRectF& rect )
painter->setBrush( QBrush( palette().dark().color(), Qt::Dense3Pattern ) );
painter->setPen( Qt::transparent );
painter->drawRect( r.left(), m_separator->y(),
r.right(),
m_separator->boundingRect().height() );
painter->drawRect( ( int ) r.left(), ( int ) m_separator->y(),
( int ) r.right(),
( int ) m_separator->boundingRect().height() );
/*QColor base = palette().button().color();
QRectF r = rect;
......@@ -427,7 +427,7 @@ void TracksView::setScale( double scaleFactor )
//TODO update the scene scale ?
setMatrix( matrix );
int diff = sceneRect().width() - m_projectDuration;
int diff = ( int ) ( sceneRect().width() - ( qreal ) m_projectDuration );
if ( diff * matrix.m11() < 50 )
{
if ( matrix.m11() < 0.4 )
......@@ -461,7 +461,7 @@ void TracksView::updateDuration()
dynamic_cast<AbstractGraphicsMediaItem*>( sceneItems.at( i ) );
if ( !item ) continue;
if ( item->pos().x() + item->boundingRect().width() > projectDuration )
projectDuration = item->pos().x() + item->boundingRect().width();
projectDuration = ( int ) ( item->pos().x() + item->boundingRect().width() );
}
m_projectDuration = projectDuration;
......
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