Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

QStyleOptionViewItem draw text ?

$
0
0
Hi, I am working on a tableView that uses a QStyledItemDelegate. Inside the itemDelegate I am trying to render a QLineEdit with someText but somehow the text is not displayed. eg if (condition) {    QStyleOptionViewItem item(option);    item.rect = option.rect;    item.text =  "Hello World";    item.palette = QPalette(Qt::Red); // just for test        QApplication::style()->drawPrimitive(QStyle::PE_PanelLineEdit, &item, painter);    QApplication::style()->drawPrimitive(QStyle::PE_FrameLineEdit, &item, painter); } But the text is not rendered at all but if I use qDebug() << item.text; it gives the right output. How to render the text using QStyleOptionViewItem ? Thanks

Viewing all articles
Browse latest Browse all 18427

Trending Articles