Commit e29018e7 authored by Adrien Maglo's avatar Adrien Maglo

Qt: EPGItem aesthetic rework.

Do not display the description in the items.
Display the start and end times in the items.
Change the item colors.
Feel free to modify these choices.
parent 540bcfd7
...@@ -62,9 +62,9 @@ void EPGItem::paint( QPainter *painter, const QStyleOptionGraphicsItem*, QWidget ...@@ -62,9 +62,9 @@ void EPGItem::paint( QPainter *painter, const QStyleOptionGraphicsItem*, QWidget
painter->setPen( QPen( Qt::black ) ); painter->setPen( QPen( Qt::black ) );
if ( m_current ) if ( m_current )
painter->setBrush( QBrush( Qt::red ) ); painter->setBrush( QBrush( QColor( 100, 100, 100 ) ) );
else else
painter->setBrush( QBrush( Qt::blue ) ); painter->setBrush( QBrush( QColor( 150, 150, 150 ) ) );
painter->drawRect( mapped ); painter->drawRect( mapped );
...@@ -73,30 +73,28 @@ void EPGItem::paint( QPainter *painter, const QStyleOptionGraphicsItem*, QWidget ...@@ -73,30 +73,28 @@ void EPGItem::paint( QPainter *painter, const QStyleOptionGraphicsItem*, QWidget
// Setup the font // Setup the font
QFont f = painter->font(); QFont f = painter->font();
f.setBold( true );
painter->setFont( f );
// Get the font metrics // Get the font metrics
QFontMetrics fm = painter->fontMetrics(); QFontMetrics fm = painter->fontMetrics();
// Adjust the drawing rect // Adjust the drawing rect
mapped.adjust( 2, 2, -2, -2 ); mapped.adjust( 6, 6, -6, -6 );
painter->setPen( Qt::white ); painter->setPen( Qt::white );
/* Draw the title. */
painter->drawText( mapped, Qt::AlignTop | Qt::AlignLeft, fm.elidedText( m_name, Qt::ElideRight, mapped.width() ) ); painter->drawText( mapped, Qt::AlignTop | Qt::AlignLeft, fm.elidedText( m_name, Qt::ElideRight, mapped.width() ) );
mapped.adjust( 0, 20, 0, 0 );
f.setBold( false ); QDateTime m_end = m_start.addSecs( m_duration );
f.setPixelSize( 10 );
f.setItalic( true ); f.setItalic( true );
painter->setFont( f ); painter->setFont( f );
QTextOption textoption; /* Draw the hours. */
textoption.setWrapMode( QTextOption::WordWrap ); painter->drawText( mapped, Qt::AlignTop | Qt::AlignLeft,
textoption.setAlignment( Qt::AlignTop | Qt::AlignLeft ); fm.elidedText( m_start.toString( "hh:mm" ) + " - " +
m_end.toString( "hh:mm" ),
painter->drawText( mapped.adjusted( 0, 20, 0, 0 ), Qt::ElideRight, mapped.width() ) );
m_shortDescription,
textoption );
} }
const QDateTime& EPGItem::start() const const QDateTime& EPGItem::start() const
......
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