Do not plot text twice for information.

Well, the information was bad, it was being printed twice
if the text is HTML, print only once.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-07-17 22:01:11 -03:00 committed by Dirk Hohndel
parent 94bcd2622a
commit 571755cc64

View file

@ -346,8 +346,7 @@ ProfilePrintDelegate::ProfilePrintDelegate(QObject *parent) : QStyledItemDelegat
{ {
} }
/* this method overrides the default table drawing method and places grid lines only at certain rows and columns */ static void paintRect(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index)
void ProfilePrintDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
const QRect rect(option.rect); const QRect rect(option.rect);
const int row = index.row(); const int row = index.row();
@ -368,6 +367,12 @@ void ProfilePrintDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
painter->drawLine(rect.topRight(), rect.bottomRight()); painter->drawLine(rect.topRight(), rect.bottomRight());
} }
painter->restore(); painter->restore();
}
/* this method overrides the default table drawing method and places grid lines only at certain rows and columns */
void ProfilePrintDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
paintRect(painter, option, index);
QStyledItemDelegate::paint(painter, option, index); QStyledItemDelegate::paint(painter, option, index);
} }
@ -409,6 +414,7 @@ HTMLDelegate::HTMLDelegate(QObject *parent) : ProfilePrintDelegate(parent)
void HTMLDelegate::paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex &index) const void HTMLDelegate::paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex &index) const
{ {
paintRect(painter, option, index);
QStyleOptionViewItemV4 options = option; QStyleOptionViewItemV4 options = option;
initStyleOption(&options, index); initStyleOption(&options, index);
painter->save(); painter->save();
@ -422,7 +428,6 @@ void HTMLDelegate::paint(QPainter* painter, const QStyleOptionViewItem & option,
QRect clip(0, 0, options.rect.width(), options.rect.height()); QRect clip(0, 0, options.rect.width(), options.rect.height());
doc.drawContents(painter, clip); doc.drawContents(painter, clip);
painter->restore(); painter->restore();
ProfilePrintDelegate::paint(painter,option,index);
} }
QSize HTMLDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const QSize HTMLDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const