[Qt-jambi-interest] help~~, sth about QPainter

朱欢 hotaru5423 at gmail.com
Thu Jul 24 11:18:16 CEST 2008


public class GroupEntryDelegate extends QItemDelegate {

 protected void drawDisplay(QPainter painter, QStyleOptionViewItem option,
QRect rect, String text) {
  rect.setHeight(16);
  super.drawDisplay(painter, option, rect, text);
  rect.moveTop(rect.top() + 16);
  option.setFont(new QFont("Helvetica [Cronyx]", 12));
  painter.setBrush(QColor.gray);
  super.drawDisplay(painter, option, rect, "test");
  System.out.println(rect.size().width() + " " + rect.size().height());
  System.out.println("drawing");
 }
}

I extend the QItemDelegate to feature myself's QTreeItem. But why the
painter doesn't work? The "test" should be in blue and brush style, but it
isn't. I want to solve it, how can I correct it?

And if I want to set two Icons and rich text in each Item of a QListView. Is
there any solutions? As I know, the default QStandardItem can only set a
single Icon, and with plain text.

Thanks a lot for your attention.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-jambi-interest/attachments/20080724/571780f7/attachment.html 


More information about the Qt-jambi-interest mailing list