November 3, 2011

tonnot tonnot
Lab Rat
5 posts

Need help for delegate.paint. Does not work for me ...


I have a model / view schema.
I’m developing a general multipurpose delegates, and I’d want to use some custom widgets I have.
The first I have tested does not work:

  1. void A_delegates::paint(QPainter* painter, const QStyleOptionViewItem & option,
  2.  const QModelIndex& index) const
  3. QRect the_rect(option.rect);    
  4. A_file_chooser file_chooser;
  5. file_chooser.setGeometry(QRect(QPoint(0,0), the_rect.size()));
  6. file_chooser.render(painter,the_rect.topLeft());

I see an empty cell ?
I have read the doc searching something usefull about this but without success.
Can anybody help me ? Thanks.

( the file chooser is as simple as a label plus a button. I can see it in other scenarios)

1 reply

November 3, 2011

Gerolf Gerolf
Hobby Entomologist
3251 posts

The widget, where you call render is invisble (show is never called). This implies, it is not painted.


Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

  ‹‹ textedit changing the linespacing for wordwrap text      mouse events sent to wrong widget (QTableView as QSplitter child) ››

You must log in to post a reply. Not a member yet? Register here!