Hi there,

I'm trying to draw a frame around my custom widget, so that the widget looks exactly like an empty table widget. I have overloaded the paintEvent and draw my widget's contents, but I can't get the styled frame drawing to work.

I tried

Qt Code:
  1. void DiagramWidget::paintEvent ( QPaintEvent * event ) {
  2. QStylePainter p(this);
  3.  
  4. // my own drawing code
  5. DiagramPainter diagramPainter;
  6. diagramPainter.paint(&p, QRect(0,0,width(), height()), m_results, m_inputData);
  7.  
  8. // here I want to write the frame/panel border, but that won't work
  9. panel.initFrom(this);
  10. style()->drawPrimitive(QStyle::PE_FrameFocusRect, &panel, &p, this);
  11. }
To copy to clipboard, switch view to plain text mode 

In any case, to get a nice looking interface I want to mimic the appearance of a QTableWidget that is placed side by side to the diagram. How can I do this?

Thanks,
Andreas