12 QPainterPath star, aux;
14 aux.setFillRule(Qt::WindingFill);
17 for(
int i = 1; i < 5; ++i)
19 QPointF pt(0.5 + 0.5 * cos(0.8 * i * 3.14),
20 0.5 + 0.5 * sin(0.8 * i * 3.14));
22 star = aux.simplified();
31 m.scale(markSize*2, markSize*2);
33 return m.map(markShape);
38 QImage img(size, QImage::Format_ARGB32_Premultiplied);
46 p.translate(img.rect().center()-star.boundingRect().center());
48 p.fillPath(star, Qt::color1);
49 p.setPen(QPen(Qt::color1, 1));
53 p.setPen(QPen(Qt::black, 1));
71 void StarDelegate::paint(QPainter* painter,
const QStyleOptionViewItem& option,
const QModelIndex& index)
const 73 if(toHighlight(index))
77 if(index.column() == 0)
79 QRect r = option.rect;
81 if(r.size() !=
m_img.size())
85 painter->setOpacity(.5);
86 painter->drawImage(r,
m_img);
96 HighlightDelegate::setHighlightColor(value);
103 HighlightDelegate::setGroupName(tr(
"Starred"));
QPainterPath getStar()
Qt include files.
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
QImage getStarImage(const QSize &size, const QColor &c)
StarDelegate(const size_t nClass=0)
void setHighlightColor(const QColor &value)
QPainterPath recalculateMark(const QPainterPath &markShape, const int &markSize)
void paint(te::qt::widgets::Canvas *c, bool generatePNG, std::string fileName)