SvgGLView Class Reference

#include <svgview.h>

Inheritance diagram for SvgGLView:

Inheritance graph
[legend]
Collaboration diagram for SvgGLView:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 75 of file svgview.h.

Public Member Functions

 SvgGLView (const QString &file, QWidget *parent=0)
virtual QSize sizeHint () const

Protected Member Functions

virtual void paintEvent (QPaintEvent *event)
virtual void wheelEvent (QWheelEvent *event)

Private Attributes

QSvgRendererdoc


Constructor & Destructor Documentation

SvgGLView::SvgGLView ( const QString file,
QWidget parent = 0 
)

Definition at line 125 of file svgview.cpp.

References QObject::connect(), doc, SIGNAL, SLOT, and QWidget::update().

00126     : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
00127 {
00128     doc = new QSvgRenderer(file, this);
00129     connect(doc, SIGNAL(repaintNeeded()),
00130             this, SLOT(update()));
00131 }

Here is the call graph for this function:


Member Function Documentation

QSize SvgGLView::sizeHint (  )  const [virtual]

Reimplemented from QWidget.

Definition at line 139 of file svgview.cpp.

References QSvgRenderer::defaultSize(), doc, and QWidget::sizeHint().

00140 {
00141     if (doc)
00142         return doc->defaultSize();
00143     return QGLWidget::sizeHint();
00144 }

Here is the call graph for this function:

void SvgGLView::paintEvent ( QPaintEvent event  )  [protected, virtual]

Handles paint events passed in the event parameter. Will cause the virtual paintGL() function to be called.

The widget's rendering context will become the current context and initializeGL() will be called if it hasn't already been called.

Reimplemented from QGLWidget.

Definition at line 133 of file svgview.cpp.

References doc, p, and QSvgRenderer::render().

00134 {
00135     QPainter p(this);
00136     doc->render(&p);
00137 }

void SvgGLView::wheelEvent ( QWheelEvent event  )  [protected, virtual]

This event handler, for event event, can be reimplemented in a subclass to receive wheel events for the widget.

If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget's parent can interpret it.

The default implementation ignores the event.

See also:
QWheelEvent::ignore(), QWheelEvent::accept(), event(), QWheelEvent

Reimplemented from QWidget.

Definition at line 146 of file svgview.cpp.

References QSvgRenderer::defaultSize(), QWheelEvent::delta(), diff(), doc, QWidget::height(), QSize::height(), int, QWidget::resize(), QWidget::size(), QSize::width(), and QWidget::width().

00147 {
00148     const double diff = 0.1;
00149     QSize size = doc->defaultSize();
00150     int width  = size.width();
00151     int height = size.height();
00152     if (e->delta() > 0) {
00153         width = int(this->width()+this->width()*diff);
00154         height = int(this->height()+this->height()*diff);
00155     } else {
00156         width  = int(this->width()-this->width()*diff);
00157         height = int(this->height()-this->height()*diff);
00158     }
00159     resize(width, height);
00160 }

Here is the call graph for this function:


Member Data Documentation

QSvgRenderer* SvgGLView::doc [private]

Definition at line 88 of file svgview.h.

Referenced by paintEvent(), sizeHint(), SvgGLView(), and wheelEvent().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 20:04:13 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1