QwtPixFrame(3)

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

SYNOPSIS

#include <qwt_pixframe.h>

Inherits QFrame.

Inherited by QwtPlotPixFrame.

  Signals
void pixmapResized ()

  Public Methods
QwtPixFrame (QWidget *parent, const char *name=0)
~QwtPixFrame ()
void setPixmap (const QPixmap &pix)
const QPixmap * pixmap () const
void fillPixmap (const QColor &c)
void clearPixmap ()
void updatePixmap ()
void updatePixmapRect (const QRect &r)
void setPixmapBackground (const QColor &c)
void setVariableSize (bool tf)
const QColor & pixmapBackground () const

  Protected Methods
void adjustPixmap ()
void adjustFrame ()
virtual void paintEvent (QPaintEvent *e)
virtual void resizeEvent (QResizeEvent *e)
virtual void frameChanged ()

  Protected Attributes
QPixmap d_pix
bool d_adjustPixmap

DETAILED DESCRIPTION

A frame containing a pixmap into which can be drawn.

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

Example

#include '../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
        draw_new_picture(pixframe->pixmap());
         // Generate paint event
        pixframe->updatePixmap();
}

CONSTRUCTOR & DESTRUCTOR DOCUMENTATION

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

CTOR.

  QwtPixFrame::~QwtPixFrame ()

DTOR.

MEMBER FUNCTION DOCUMENTATION

  void QwtPixFrame::adjustFrame () [protected]

Resize the frame according to the pixmap size.

  void QwtPixFrame::adjustPixmap () [protected]

Resize the pixmap according to the frame size.

  void QwtPixFrame::clearPixmap ()

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

  void QwtPixFrame::fillPixmap (const QColor & c)

Fill the pixmap with a specified color.

Parameters:

c   Fill color

  void QwtPixFrame::frameChanged () [protected, virtual]

Notify a change of the frame.

  void QwtPixFrame::paintEvent (QPaintEvent * e) [protected, virtual]

Paint event.

  const QPixmap* QwtPixFrame::pixmap () const

Returns:
a pointer to the enclosed pixmap

  const QColor& QwtPixFrame::pixmapBackground () const

Returns:
the pixmap's background color

See also:
setPixmapBackground(const QColor &c)

  void QwtPixFrame::pixmapResized () [signal]

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

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

  void QwtPixFrame::setPixmap (const QPixmap & pix)

Assign a pixmap.

 If the variable size feature is enabled (disabled by default), the size of the frame will not change when a new pixmap has been assigned.

  void QwtPixFrame::setPixmapBackground (const QColor & c)

Assign a background color the the pixmap.

Parameters:

c   New background color

  void QwtPixFrame::setVariableSize (bool tf)

Set resizing policy.

Parameters:

tf  Adjust pixmap size (TRUE) or frame size (FALSE).If tf is TRUE, the pixmap will be adjusted when the frame is resized or when the frame style is changed. If set to FALSE, the size of the pixmap will remain constant and the frame size will be adjusted. The default value is TRUE.

  void QwtPixFrame::updatePixmap ()

Maps the pixmap to the screen.

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

Warning:
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().

  void QwtPixFrame::updatePixmapRect (const QRect & r)

Repaint a part of the pixmap.

Parameters:

r   part of the pixmap to be redrawn in pixmap coordinates

AUTHOR

Generated automatically by Doxygen for Qwt User's Guide from the source code.