Commit 48514572 authored by Adrien Maglo's avatar Adrien Maglo Committed by Jean-Baptiste Kempf

Qt/EPG: Fix an EPGitem position issue.

This was wrong to update the EPGItem start times when changing the EPGView start time.
(cherry picked from commit 330016cb7d533bc6c5d7946c66aa26b9944eb830)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 751cc162
......@@ -111,14 +111,13 @@ void EPGItem::setChannel( int channelNb )
{
//qDebug() << "Channel" << channelNb;
m_channelNb = channelNb;
setPos( pos().x(), m_channelNb * TRACKS_HEIGHT );
updatePos();
}
void EPGItem::setStart( const QDateTime& start )
{
m_start = start;
int x = m_view->startTime().secsTo( start );
setPos( x, pos().y() );
updatePos();
}
void EPGItem::setDuration( int duration )
......@@ -147,6 +146,12 @@ void EPGItem::setCurrent( bool current )
m_current = current;
}
void EPGItem::updatePos()
{
int x = m_view->startTime().secsTo( m_start );
setPos( x, m_channelNb * TRACKS_HEIGHT );
}
void EPGItem::focusInEvent( QFocusEvent * event )
{
EPGEvent *evEPG = new EPGEvent( m_name );
......
......@@ -52,6 +52,7 @@ public:
void setDescription( const QString& description );
void setShortDescription( const QString& shortDescription );
void setCurrent( bool current );
void updatePos();
protected:
virtual void focusInEvent( QFocusEvent * event );
......
......@@ -56,17 +56,15 @@ void EPGView::setStartTime( const QDateTime& startTime )
{
QList<QGraphicsItem*> itemList = items();
int diff = startTime.secsTo( m_startTime );
m_startTime = startTime;
for ( int i = 0; i < itemList.count(); ++i )
{
EPGItem* item = qgraphicsitem_cast<EPGItem*>( itemList.at( i ) );
if ( !item ) continue;
item->setStart( item->start().addSecs( diff ) );
item->setStart( item->start() );
}
m_startTime = startTime;
// Our start time has changed
emit startTimeChanged( startTime );
}
......
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