QGIS API Documentation  2.4.0-Chugiak
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Slots | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
QgsComposerHtml Class Reference

#include <qgscomposerhtml.h>

Inheritance diagram for QgsComposerHtml:
Inheritance graph
[legend]
Collaboration diagram for QgsComposerHtml:
Collaboration graph
[legend]

Public Slots

void loadHtml ()
 Reloads the html source from the url and redraws the item. More...
 
- Public Slots inherited from QgsComposerMultiFrame
void recalculateFrameSizes ()
 Recalculates the portion of the multiframe item which is shown in each of it's component frames. More...
 

Public Member Functions

 QgsComposerHtml (QgsComposition *c, bool createUndoCommands)
 
 QgsComposerHtml ()
 
 ~QgsComposerHtml ()
 
void setUrl (const QUrl &url)
 
const QUrl & url () const
 
QSizeF totalSize () const
 
void render (QPainter *p, const QRectF &renderExtent)
 
bool writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const
 
bool readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false)
 
void addFrame (QgsComposerFrame *frame, bool recalcFrameSizes=true)
 
double findNearbyPageBreak (double yPos)
 Finds the optimal position to break a frame at. More...
 
bool useSmartBreaks () const
 Returns whether html item is using smart breaks. More...
 
void setUseSmartBreaks (bool useSmartBreaks)
 Sets whether the html item should use smart breaks. More...
 
void setMaxBreakDistance (double maxBreakDistance)
 Sets the maximum distance allowed when calculating where to place page breaks in the html. More...
 
double maxBreakDistance () const
 Returns the maximum distance allowed when calculating where to place page breaks in the html. More...
 
- Public Member Functions inherited from QgsComposerMultiFrame
 QgsComposerMultiFrame (QgsComposition *c, bool createUndoCommands)
 
virtual ~QgsComposerMultiFrame ()
 
void removeFrame (int i)
 
void update ()
 
void setResizeMode (ResizeMode mode)
 
ResizeMode resizeMode () const
 
bool _writeXML (QDomElement &elem, QDomDocument &doc, bool ignoreFrames=false) const
 
bool _readXML (const QDomElement &itemElem, const QDomDocument &doc, bool ignoreFrames=false)
 
QgsCompositioncomposition ()
 
bool createUndoCommands () const
 
void setCreateUndoCommands (bool enabled)
 
void deleteFrames ()
 Removes and deletes all frames from mComposition. More...
 
int frameCount () const
 Return the number of frames associated with this multiframeset. More...
 
QgsComposerFrameframe (int i) const
 
QgsComposerFramecreateNewFrame (QgsComposerFrame *currentFrame, QPointF pos, QSizeF size)
 Creates a new frame and adds it to the multi frame and composition. More...
 

Private Slots

void frameLoaded (bool ok)
 

Private Member Functions

double htmlUnitsToMM ()
 
void renderCachedImage ()
 

Private Attributes

QUrl mUrl
 
QWebPage * mWebPage
 
bool mLoaded
 
QSizeF mSize
 
double mHtmlUnitsToMM
 
QImage * mRenderedPage
 
bool mUseSmartBreaks
 
double mMaxBreakDistance
 

Additional Inherited Members

- Public Types inherited from QgsComposerMultiFrame
enum  ResizeMode { UseExistingFrames = 0, ExtendToNextPage, RepeatOnEveryPage, RepeatUntilFinished }
 
- Signals inherited from QgsComposerMultiFrame
void changed ()
 
- Protected Slots inherited from QgsComposerMultiFrame
void handleFrameRemoval (QgsComposerItem *item)
 Called before a frame is going to be removed (update frame list) More...
 
void handlePageChange ()
 Adapts to changed number of pages if resize type is RepeatOnEveryPage. More...
 
- Protected Attributes inherited from QgsComposerMultiFrame
QgsCompositionmComposition
 
QList< QgsComposerFrame * > mFrameItems
 
ResizeMode mResizeMode
 
bool mCreateUndoCommands
 True: creates QgsMultiFrameCommands on internal changes (e.g. More...
 

Detailed Description

Definition at line 25 of file qgscomposerhtml.h.

Constructor & Destructor Documentation

QgsComposerHtml::QgsComposerHtml ( QgsComposition c,
bool  createUndoCommands 
)
QgsComposerHtml::QgsComposerHtml ( )

Definition at line 47 of file qgscomposerhtml.cpp.

QgsComposerHtml::~QgsComposerHtml ( )

Definition at line 57 of file qgscomposerhtml.cpp.

References mRenderedPage, and mWebPage.

Member Function Documentation

void QgsComposerHtml::addFrame ( QgsComposerFrame frame,
bool  recalcFrameSizes = true 
)
virtual
double QgsComposerHtml::findNearbyPageBreak ( double  yPos)
virtual

Finds the optimal position to break a frame at.

Parameters
yPosmaximum vertical position for break
Returns
the optimal breakable position which occurs in the multi frame close to and before the specified yPos
Note
added in version 2.3

Reimplemented from QgsComposerMultiFrame.

Definition at line 180 of file qgscomposerhtml.cpp.

References candidateSort(), htmlUnitsToMM(), mMaxBreakDistance, mRenderedPage, mUseSmartBreaks, and mWebPage.

void QgsComposerHtml::frameLoaded ( bool  ok)
privateslot

Definition at line 104 of file qgscomposerhtml.cpp.

References mLoaded.

Referenced by QgsComposerHtml().

double QgsComposerHtml::htmlUnitsToMM ( )
private
void QgsComposerHtml::loadHtml ( )
slot
double QgsComposerHtml::maxBreakDistance ( ) const
inline

Returns the maximum distance allowed when calculating where to place page breaks in the html.

This distance is the maximum amount of empty space allowed at the bottom of a frame after calculating the optimum break location. This setting is only effective if useSmartBreaks is true.

Returns
maximum amount of empty space to leave when calculating page break locations
Note
added in 2.3
See also
setMaxBreakDistance
useSmartBreaks

Definition at line 85 of file qgscomposerhtml.h.

Referenced by setMaxBreakDistance().

bool QgsComposerHtml::readXML ( const QDomElement &  itemElem,
const QDomDocument &  doc,
bool  ignoreFrames = false 
)
virtual
void QgsComposerHtml::render ( QPainter *  p,
const QRectF &  renderExtent 
)
virtual

Implements QgsComposerMultiFrame.

Definition at line 129 of file qgscomposerhtml.cpp.

References mHtmlUnitsToMM, and mWebPage.

void QgsComposerHtml::renderCachedImage ( )
private

Definition at line 110 of file qgscomposerhtml.cpp.

References mRenderedPage, and mWebPage.

Referenced by loadHtml().

void QgsComposerHtml::setMaxBreakDistance ( double  maxBreakDistance)

Sets the maximum distance allowed when calculating where to place page breaks in the html.

This distance is the maximum amount of empty space allowed at the bottom of a frame after calculating the optimum break location. Setting a larger value will result in better choice of page break location, but more wasted space at the bottom of frames. This setting is only effective if useSmartBreaks is true.

Parameters
maxBreakDistancemaximum amount of empty space to leave when calculating page break locations
Note
added in 2.3
See also
maxBreakDistance
setUseSmartBreaks

Definition at line 264 of file qgscomposerhtml.cpp.

References QgsComposerMultiFrame::changed(), maxBreakDistance(), mMaxBreakDistance, and QgsComposerMultiFrame::recalculateFrameSizes().

void QgsComposerHtml::setUrl ( const QUrl &  url)

Definition at line 63 of file qgscomposerhtml.cpp.

References loadHtml(), mUrl, mWebPage, and url().

Referenced by readXML().

void QgsComposerHtml::setUseSmartBreaks ( bool  useSmartBreaks)

Sets whether the html item should use smart breaks.

Smart breaks prevent the html frame contents from breaking mid-way though a line of text.

Parameters
useSmartBreaksset to true to prevent content from breaking mid-way through a line of text
See also
useSmartBreaks

Definition at line 257 of file qgscomposerhtml.cpp.

References QgsComposerMultiFrame::changed(), mUseSmartBreaks, QgsComposerMultiFrame::recalculateFrameSizes(), and useSmartBreaks().

QSizeF QgsComposerHtml::totalSize ( ) const
virtual

Implements QgsComposerMultiFrame.

Definition at line 124 of file qgscomposerhtml.cpp.

References mSize.

const QUrl& QgsComposerHtml::url ( ) const
inline

Definition at line 34 of file qgscomposerhtml.h.

Referenced by setUrl().

bool QgsComposerHtml::useSmartBreaks ( ) const
inline

Returns whether html item is using smart breaks.

Smart breaks prevent the html frame contents from breaking mid-way though a line of text.

Returns
true if html item is using smart breaks
See also
setUseSmartBreaks

Definition at line 52 of file qgscomposerhtml.h.

Referenced by setUseSmartBreaks().

bool QgsComposerHtml::writeXML ( QDomElement &  elem,
QDomDocument &  doc,
bool  ignoreFrames = false 
) const
virtual

Member Data Documentation

double QgsComposerHtml::mHtmlUnitsToMM
private

Definition at line 103 of file qgscomposerhtml.h.

Referenced by loadHtml(), QgsComposerHtml(), and render().

bool QgsComposerHtml::mLoaded
private

Definition at line 101 of file qgscomposerhtml.h.

Referenced by frameLoaded(), and loadHtml().

double QgsComposerHtml::mMaxBreakDistance
private

Definition at line 106 of file qgscomposerhtml.h.

Referenced by findNearbyPageBreak(), readXML(), setMaxBreakDistance(), and writeXML().

QImage* QgsComposerHtml::mRenderedPage
private

Definition at line 104 of file qgscomposerhtml.h.

Referenced by findNearbyPageBreak(), renderCachedImage(), and ~QgsComposerHtml().

QSizeF QgsComposerHtml::mSize
private

Definition at line 102 of file qgscomposerhtml.h.

Referenced by loadHtml(), and totalSize().

QUrl QgsComposerHtml::mUrl
private

Definition at line 99 of file qgscomposerhtml.h.

Referenced by loadHtml(), setUrl(), and writeXML().

bool QgsComposerHtml::mUseSmartBreaks
private

Definition at line 105 of file qgscomposerhtml.h.

Referenced by findNearbyPageBreak(), readXML(), setUseSmartBreaks(), and writeXML().

QWebPage* QgsComposerHtml::mWebPage
private

The documentation for this class was generated from the following files: