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
painter->setPen( QPen( Qt::black ) );
if ( m_current )
painter->setBrush( QBrush( Qt::red ) );
painter->setBrush( QBrush( QColor( 100, 100, 100 ) ) );
else
painter->setBrush( QBrush( Qt::blue ) );
painter->setBrush( QBrush( QColor( 150, 150, 150 ) ) );
painter->drawRect( mapped );
......@@ -73,30 +73,28 @@ void EPGItem::paint( QPainter *painter, const QStyleOptionGraphicsItem*, QWidget
// Setup the font
QFont f = painter->font();
f.setBold( true );
painter->setFont( f );
// Get the font metrics
QFontMetrics fm = painter->fontMetrics();
// Adjust the drawing rect
mapped.adjust( 2, 2, -2, -2 );
mapped.adjust( 6, 6, -6, -6 );
painter->setPen( Qt::white );
/* Draw the title. */
painter->drawText( mapped, Qt::AlignTop | Qt::AlignLeft, fm.elidedText( m_name, Qt::ElideRight, mapped.width() ) );
f.setBold( false );
mapped.adjust( 0, 20, 0, 0 );
QDateTime m_end = m_start.addSecs( m_duration );
f.setPixelSize( 10 );
f.setItalic( true );
painter->setFont( f );
QTextOption textoption;
textoption.setWrapMode( QTextOption::WordWrap );
textoption.setAlignment( Qt::AlignTop | Qt::AlignLeft );
painter->drawText( mapped.adjusted( 0, 20, 0, 0 ),
m_shortDescription,
textoption );
/* Draw the hours. */
painter->drawText( mapped, Qt::AlignTop | Qt::AlignLeft,
fm.elidedText( m_start.toString( "hh:mm" ) + " - " +
m_end.toString( "hh:mm" ),
Qt::ElideRight, mapped.width() ) );
}
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