Qwt Programmer's manual

QwtPixFrame


NAME

QwtPixFrame -- A frame containing a pixmap into which can be drawn.

INHERITED CLASSES

QFrame

PUBLIC MEMBERS

clearPixmap
Clear the pixmap
fillPixmap
Fill the pixmap with a specified color
setPixmapBackground
Assign a background color
updatePixmap
Repaint the pixmap
updatePixmapRect
Repaint a part of the pixmap
pixmap
Return a pointer to the embedded pixmap
pixmapBackground
Return the pixmap's background color

SIGNALS

pixmapResized
Notify a change of the pixmap's size

DESCRIPTION

QwtPixFrame is a frame which contains a pixmap. The size of the pixmap is dynamically adjusted in order to fit the frame's contents.

USAGE

      #include <qwt_pixframe.h>

      class ParentClass : ...
      {
              ...
              QwtPixFrame *pixframe;
              ...
              void newPicture();
              ..
      private slots:
              void repaintPixmap();
      }


      //
      //     Connect pixmapResized() to a slot
      //
      ParentClass::ParentClass(...)
      {
              ...
              connect(pixframe, SIGNAL(pixmapResized()), SLOT(repaintPixmap()));
      }


      //
      // Repaint when the pixmap has been resized
      //
      ParentClass::repaintPixmap()
      {
              QPainter p;
              p.begin(pixframe->pixmap());

              redraw_picture(&p, pixframe->pixmap().rect());

              p.end();

              // Note: No updatePixmap() required here
      }

      //
      // Renew the pixmap's contents independently
      //
      ParentClass::newPicture()
      {
              // Change the pixmap's contents
              drawnewpicture(pixframe->pixmap());

              // Generate paint event
              pixframe->updatePixmap();
      }


EXAMPLES

see examples/curvdemo/curvdemo2

QwtPixFrame::QwtPixFrame

Constructs a QwtPixFrame object.

Syntax

QwtPixFrame::QwtPixFrame(QWidget *parent, const char *name)

Parameters

QWidget *parent
parent widget (default = 0)
const char *name
name (default = 0)

QwtPixFrame::~QwtPixFrame

Destroys a QwtPixFrame object.

Syntax

QwtPixFrame::~QwtPixFrame()

QwtPixFrame::fillPixmap

Fill the pixmap with a specified color

Syntax

void QwtPixFrame::fillPixmap(const QColor &c)

Parameters

const QColor &c
fill color

QwtPixFrame::updatePixmap

Maps the pixmap to the screen

Syntax

void QwtPixFrame::updatePixmap()

Description

This function synchronizes the screen contents with the current contents of the pixmap. It generates a paint event which updates the widget.

Note

When the widget gets resized, a paint event is generated automatically after the pixmapResized() signal has been emitted. It is not necessary to call updatePixmap() within a slot which is connected to pixmapResized().

QwtPixFrame::updatePixmapRect

Repaint a part of the pixmap

Syntax

void QwtPixFrame::updatePixmapRect(const QRect& r)

Parameters

const QRect& r - part of the pixmap to be redrawn
in pixmap coordinates

QwtPixFrame::setPixmapBackground

Assign a background color the the pixmap

Syntax

void QwtPixFrame::setPixmapBackground(const QColor &c)

Parameters

const QColor &c
new background color

Description


QwtPixFrame::clearPixmap

Clear the contents of the pixmap and fill it with its background color

Syntax

void QwtPixFrame::clearPixmap()

See also

setPixmapBackground

QwtPixFrame::pixmapResized

A signal which is emitted when the size of the pixmap has been changed.

Syntax

void QwtPixFrame::pixmapResized()

Description

When resized, the pixmap is cleared and filled with its background color.

QwtPixFrame::pixmapBackground

Return the pixmap's background color

Syntax

const QColor& QwtPixFrame::pixmapBackground()

See Also

setPixmapBackground

QwtPixFrame::pixmap

return a pointer to the enclosed pixmap

Syntax

const QPixmap* QwtPixFrame::pixmap()
Qwt Widget Library 02/02/1998