#include <previewlabel.h>
Inheritance diagram for PreviewLabel:


Definition at line 33 of file previewlabel.h.
Public Member Functions | |
| PreviewLabel (QWidget *parent=0) | |
| void | setPixmap (const QPixmap &pixmap) |
Protected Member Functions | |
| void | paintEvent (QPaintEvent *event) |
Private Attributes | |
| QPixmap | pixmap |
| PreviewLabel::PreviewLabel | ( | QWidget * | parent = 0 |
) |
| void PreviewLabel::setPixmap | ( | const QPixmap & | pixmap | ) |
Definition at line 41 of file previewlabel.cpp.
References pixmap.
Referenced by PreviewDialog::on_pageList_currentItemChanged().
| void PreviewLabel::paintEvent | ( | QPaintEvent * | event | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive paint events which are passed in the event parameter.
A paint event is a request to repaint all or part of the widget. It can happen as a result of repaint() or update(), or because the widget was obscured and has now been uncovered, or for many other reasons.
Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QTableView do this, for example.
Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::united()). repaint() does not permit this optimization, so we suggest using update() whenever possible.
When the paint event occurs, the update region has normally been erased, so that you're painting on the widget's background.
The background can be set using setBackgroundRole() and setPalette().
From Qt 4.0, QWidget automatically double-buffers its painting, so there's no need to write double-buffering code in paintEvent() to avoid flicker.
Note: Under X11 it is possible to toggle the global double buffering by calling qt_x11_set_global_double_buffer(). Example usage:
...
extern void qt_x11_set_global_double_buffer(bool);
qt_x11_set_global_double_buffer(false);
...
Reimplemented from QWidget.
Definition at line 32 of file previewlabel.cpp.
References QPainter::begin(), QPainter::drawPixmap(), QPainter::end(), QWidget::event(), QPainter::fillRect(), and pixmap.
00033 { 00034 QPainter painter; 00035 painter.begin(this); 00036 painter.fillRect(event->rect(), QColor(224,224,224)); 00037 painter.drawPixmap(0, 0, pixmap); 00038 painter.end(); 00039 }
Here is the call graph for this function:

QPixmap PreviewLabel::pixmap [private] |
1.5.1