Source Code (Use browser search to find items of interest.)

Class Index

kimageshop'PixmapWidget (./koffice/kimageshop/ui/iconchooser.h:91)

class PixmapWidget : public QFrame
{
public:
  PixmapWidget( const QPixmap&, QWidget *parent=0, const char *name=0 );
  ~PixmapWidget() {}

private:
  void 		paintEvent( QPaintEvent * );

  QPixmap 	pixmap;

};


kimageshop'PixmapWidget::PixmapWidget() (./koffice/kimageshop/ui/iconchooser.cc:294)

PixmapWidget::PixmapWidget( const QPixmap& pix, QWidget *parent,
			    const char *name )
  : QFrame( parent, name, WStyle_Customize | WStyle_NoBorder )
{
  setFrameStyle( QFrame::WinPanel | QFrame::Raised );
  pixmap = pix;
  int w = pix.width() + 2*lineWidth();
  int h = pix.height() + 2*lineWidth();
  resize( w, h );

  // center widget under mouse cursor
  QPoint p = QCursor::pos();
  move( p.x() - w/2, p.y() - h/2 );
  show();
}


// paint the centered pixmap; don't overpaint the frame

kimageshop'PixmapWidget::paintEvent() (./koffice/kimageshop/ui/iconchooser.cc:312)

void PixmapWidget::paintEvent( QPaintEvent *e )
{
  QFrame::paintEvent( e );
  QPainter p( this );
  p.setClipRect( e->rect() );
  p.drawPixmap( lineWidth(), lineWidth(), pixmap );
}