drawContent is no more
authorcoolo <coolo@e0cc52ee-31ee-0310-8b87-e83c4596d67c>
Wed, 5 Dec 2007 19:20:27 +0000 (19:20 +0000)
committercoolo <coolo@e0cc52ee-31ee-0310-8b87-e83c4596d67c>
Wed, 5 Dec 2007 19:20:27 +0000 (19:20 +0000)
git-svn-id: http://svn.opensuse.org/svn/yast/branches/tmp/coolo/qt4-port@42740 e0cc52ee-31ee-0310-8b87-e83c4596d67c

src/YQBarGraph.cc
src/YQBarGraph.h

index 25383d6..fc48cb7 100644 (file)
@@ -59,8 +59,12 @@ YQBarGraph::doUpdate()
 
 
 void
-YQBarGraph::drawContents( QPainter * painter )
+YQBarGraph::paintEvent( QPaintEvent* paintEvent )
 {
+    QFrame::paintEvent( paintEvent );
+
+    QPainter painter( this );
+
     unsigned nextDefaultColor = 0;
     int totalWidth     = contentsRect().width()  - 2*YQBarGraphOuterMargin;
     int segHeight      = contentsRect().height() - 2*YQBarGraphOuterMargin;
@@ -104,19 +108,19 @@ YQBarGraph::drawContents( QPainter * painter )
            textColor    = defaultTextColor   ( nextDefaultColor++ );
        }
 
-       painter->setBrush( QColor( segmentColor.red(),
+       painter.setBrush( QColor( segmentColor.red(),
                                   segmentColor.green(),
                                   segmentColor.blue() ) );
-       painter->setPen( Qt::NoPen );
-       painter->drawRect( x_off, y_off, segWidth+2, segHeight+2 );
+       painter.setPen( Qt::NoPen );
+       painter.drawRect( x_off, y_off, segWidth+2, segHeight+2 );
 
 
        //
        // Draw the label
        //
 
-       painter->setPen( Qt::SolidLine );
-       painter->setPen( QColor( textColor.red(),
+       painter.setPen( Qt::SolidLine );
+       painter.setPen( QColor( textColor.red(),
                                 textColor.green(),
                                 textColor.blue() ) );
 
@@ -125,7 +129,7 @@ YQBarGraph::drawContents( QPainter * painter )
        if ( txt.contains( "%1" ) )
            txt = txt.arg( seg.value() );               // substitute variable
 
-       painter->drawText( x_off + YQBarGraphLabelHorizontalMargin,
+       painter.drawText( x_off + YQBarGraphLabelHorizontalMargin,
                           y_off + YQBarGraphLabelVerticalMargin,
                           segWidth  - 2 * YQBarGraphLabelHorizontalMargin + 1,
                           segHeight - 2 * YQBarGraphLabelVerticalMargin   + 1,
index 91b52ac..51f0f33 100644 (file)
@@ -85,7 +85,7 @@ protected:
      *
      * Reimplemented from QFrame.
      **/
-    virtual void drawContents( QPainter * painter );
+    virtual void paintEvent( QPaintEvent * painter );
 
     /**
      * Return one from a set of default segment background colors.