How can i change the mouse pointer , when mouse over text with QStyledItemDelegate
-
how can i change the mouse icon when mouse is over the text in item delegate ?
i have this part but i can't find any example to change the mouse pointer . what im missing ?@void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
if (index.isValid())
{
int j = index.column();
if(j==4)
{
QString headerText_DisplayRole = index.data(Qt::DisplayRole).toString() ;
QApplication::style()->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter );QFont font = QApplication::font();
QRect headerRect = option.rect;
font.setBold(true);
font.setUnderline(true);
painter->setFont(font);
painter->setPen(QPen(option.palette.brush(QPalette::Text), 0));
const bool isSelected = option.state & QStyle::State_Selected;
if (isSelected)
painter->setPen(QPen(option.palette.brush(QPalette::HighlightedText), 0));
else
painter->setPen(QPen(option.palette.brush(QPalette::Text), 0));
painter->save();
painter->drawText(headerRect,headerText_DisplayRole);
painter->restore();
bool hover = false;
if ( option.state & QStyle::State_MouseOver )
{
hover = true;
}
if(hover)
{
// THIS part i missing , how detect when mouse is over the text
// and if its over how to change the icon of the mouse?
}}
else
{
QStyledItemDelegate::paint(painter, option, index);
}
}
}
@