アイテムの代理人のテキストの上にマウスがある場合、マウスアイコンを変更するにはどうすればよいですか? 私はこの部分を持っていますが、マウスポインタを変更する例は見つかりません。QStyledItemDelegateでマウスの上にマウスを置くと、マウスポインタをどのように変更できますか?
私には何が欠けていますか?
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);
}
}
}
ありがとう、ありがとう、ありがとう!ブログの投稿は検索の2日後に私を救った – user63898