Qwt Programmer's manual
QwtPixFrame
QwtPixFrame -- A frame containing a pixmap into which
can be drawn.
QFrame
- 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
- pixmapResized
- Notify a change of the pixmap's size
QwtPixFrame is a frame which contains a pixmap. The size of the
pixmap is dynamically adjusted in order to fit the frame's
contents.
#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();
}
see examples/curvdemo/curvdemo2
Constructs a QwtPixFrame object.
QwtPixFrame::QwtPixFrame(QWidget *parent, const char *name)
- QWidget *parent
- parent widget (default = 0)
- const char *name
- name (default = 0)
Destroys a QwtPixFrame object.
QwtPixFrame::~QwtPixFrame()
Fill the pixmap with a specified color
void QwtPixFrame::fillPixmap(const QColor &c)
- const QColor &c
- fill color
Maps the pixmap to the screen
void QwtPixFrame::updatePixmap()
This function synchronizes the screen contents with the
current contents of the pixmap. It generates a paint event
which updates the widget.
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().
Repaint a part of the pixmap
void QwtPixFrame::updatePixmapRect(const QRect& r)
- const QRect& r - part of the pixmap to be redrawn
-
in pixmap coordinates
Assign a background color the the pixmap
void QwtPixFrame::setPixmapBackground(const QColor &c)
- const QColor &c
- new background color
Clear the contents of the pixmap and fill it with
its background color
void QwtPixFrame::clearPixmap()
setPixmapBackground
A signal which is emitted when the size of the
pixmap has been changed.
void QwtPixFrame::pixmapResized()
When resized, the pixmap is cleared and filled with
its background color.
Return the pixmap's background color
const QColor& QwtPixFrame::pixmapBackground()
setPixmapBackground
return a pointer to the enclosed pixmap
const QPixmap* QwtPixFrame::pixmap()
Qwt Widget Library 02/02/1998