Thanks.
Anyway, it turned out that QListWidget/View delegate actually doesn't paint text - it asks style to draw a native control, and that draws contrast text somewhere deep in Qt theming engine. If pen and brush are same as in default palette, their colors may be changed to os-themed.
Native drawing solved text color issue for me.
void customDelegate::paint(QPainter *painter,
const QStyleOptionViewItem &option, const QModelIndex &index) const
{
// ...
QStyleOptionViewItemV4 opt = option;
opt.state = opt.state & (~QStyle::State_HasFocus); // no dots
opt.displayAlignment = Qt::AlignVCenter | Qt::AlignLeft; // or right
opt.features = QStyleOptionViewItemV2::HasDisplay;
opt.text = displayText(textGoesThere, opt.locale); // <--
opt.rect = option.rect;
//...
if (multipartDrawing) {
if (drawingSomethingAtLeft)
opt.viewItemPosition = QStyleOptionViewItem::Beginning;
else if (somethingAtRight)
opt.viewItemPosition = QStyleOptionViewItem::End;
else
opt.viewItemPosition = QStyleOptionViewItem::Middle;
}
else opt.viewItemPosition = QStyleOptionViewItem::OnlyOne;
owner->style()->drawControl(QStyle::CE_ItemViewItem, &opt, painter);
//...
}