viewgit/index.php:465 Only variables should be passed by reference [2048]

viewgit/index.php:466 Non-static method GeSHi::get_language_name_from_extension() should not be called statically [2048]

  1. #include "unreadcountitemdelegate.h"
  2. #include "feednode.h"
  3. #include <QStyledItemDelegate>
  4. #include <QPainter>
  5.  
  6. using namespace Larss;
  7.  
  8. UnReadCountItemDelegate::UnReadCountItemDelegate(FeedModel *feedModel, RssParser *rssParser, QObject *parent) :
  9. QStyledItemDelegate(parent), feedModel(feedModel), rssParser(rssParser)
  10. {
  11. }
  12.  
  13. void
  14. UnReadCountItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
  15. {
  16. if (index.isValid())
  17. {
  18. FeedNode *node = feedModel->itemFromIndex(index);
  19. if (node->type() == FeedNode::Feed)
  20. {
  21. quint32 unreadPosts = rssParser->getUnreadCount(index);
  22. if (unreadPosts > 0)
  23. {
  24. // Draw highlight if necessary
  25. if (option.state & QStyle::State_Selected)
  26. painter->fillRect(option.rect, option.palette.highlight());
  27.  
  28. // Set bold font
  29. QFont font = option.font;
  30. font.setBold(true);
  31. painter->setFont(font);
  32. painter->drawText(option.rect, option.displayAlignment,
  33. QString (" %1 (%2)").arg(index.data(Qt::DisplayRole).toString()).arg(unreadPosts));
  34.  
  35. return;
  36. }
  37. }
  38. }
  39. QStyledItemDelegate::paint(painter, option, index);
  40. }