RGraphicsSceneQt
Class in GUI Module
Header: #include <src/gui/RGraphicsSceneQt.h>
Inherits: RGraphicsScene
Description
Section titled “Description”Qt based 2d graphics scene.
This graphics scene is an exporter that exports entities into QPainterPaths (2d).
graphics views.
Scriptable: This class is available in script environments.
Public Functions
Section titled “Public Functions”RGraphicsSceneQt(RDocumentInterface &documentInterface) |
|
| virtual | ~RGraphicsSceneQt() |
| void | addDrawable(RObject::Id entityId, RGraphicsSceneDrawable &drawable, bool draft=false, bool preview=false) |
| virtual void | addPathToPreview(RObject::Id entityId, RPainterPath &pp) |
| void | addTextToPreview(const RTextBasedData &text) |
| virtual void | addToPreview(RObject::Id entityId, QList< RGraphicsSceneDrawable > &drawables) |
| virtual void | addToPreview(RObject::Id entityId, RGraphicsSceneDrawable &drawable) |
| bool | beginPath()Starts a new painter path to export geometry into. |
| virtual void | clear()Clears (resets) the scene contents. |
| virtual void | clearClipRectangles() |
| virtual void | clearPreview()Clears the preview. |
| void | deleteDrawables() |
| virtual void | dump() |
| void | endPath() |
| virtual void | exportArc(const RArc &arc, double offset=RNANDOUBLE) |
| virtual void | exportArcSegment(const RArc &arc, bool allowForZeroLength=false) |
| virtual void | exportClipRectangle(const RBox &clipRectangles, bool forceSelected=false) |
| virtual void | exportEndTransform() |
| virtual void | exportEntities(bool allBlocks=true, bool undone=false, bool invisible=false) |
| void | exportEntitiesThread(int threadId, QList< RObject::Id > &list, int start, int end) |
| void | exportEntityThread(int threadId, RObject::Id id) |
| virtual void | exportImage(const RImageData &image, bool forceSelected=false) |
| virtual double | exportLine(const RLine &line, double offset=RNANDOUBLE)Exports a line with the current attributes. |
| virtual void | exportLineSegment(const RLine &line, double angle=RNANDOUBLE)Exports a line segment (a line without pattern). |
| virtual void | exportPainterPaths(const QList< RPainterPath > &paths, double z=0.0) |
| virtual void | exportPoint(const RPoint &point)Exports a point with the current attributes. |
| virtual void | exportPolyline(const RPolyline &polyline, bool polylineGen=true, double offset=RNANDOUBLE) |
| void | exportPolylineFill(const RPolyline &polyline) |
| virtual void | exportRay(const RRay &ray)Exports an infinite ray. |
| virtual void | exportRectangle(const RVector &p1, const RVector &p2)Exports a rectangle with the current attributes. |
| virtual void | exportSpline(const RSpline &spline, double offset=RNANDOUBLE) |
| virtual QList< RPainterPath > | exportText(const RTextBasedData &text, bool forceSelected=false) |
| virtual void | exportThickPolyline(const RPolyline &polyline) |
| virtual void | exportTransform(const RTransform &t) |
| virtual void | exportTriangle(const RTriangle &triangle)Exports a triangle with the current attributes. |
| virtual void | exportXLine(const RXLine &xLine)Exports an infinite line. |
| RBox | getClipRectangle(RObject::Id entityId, bool preview=false) const |
| QList< RGraphicsSceneDrawable > * | getDrawables(RObject::Id entityId) |
| QList< RGraphicsSceneDrawable > | getDrawablesList(RObject::Id entityId) |
| int | getDrawablesVersion() const |
| RGraphicsViewImage * | getGraphicsView() const |
| virtual double | getLineTypePatternScale(const RLinetypePattern &p) const |
| QList< RGraphicsSceneDrawable > * | getPreviewDrawables(RObject::Id entityId) |
| QList< RObject::Id > | getPreviewEntityIds() |
| virtual bool | getScreenBasedLinetypes() const |
| bool | hasClipRectangleFor(RObject::Id entityId, bool preview=false) const |
| bool | hasPreview() const |
| virtual void | highlightEntity(REntity &entity)Highlights the given entity. |
| virtual bool | isPixelUnitSupported() constPainter paths in pixel unit are stored as such and scaled to a constant size in pixels at paint time by the view (RGraphicsViewImage::paintDrawable). |
| virtual void | startEntity(bool topLevelEntity) |
| void | transformAndApplyPatternPath(RPainterPath &path) constTransform the given paths according to current block reference scales. |
| virtual void | translateEntities(QSet< RObject::Id > &affectedEntities, const RVector &offset)Translates the cached drawables (painter paths, texts, images), clip rectangles and reference points of the given entities by the given offset instead of exporting the entities again. |
| virtual void | unexportEntity(RObject::Id entityId)This is called for entities for which an export was requested but which cannot be instantiated because they either do not exist (anymore) in the DB or they are currently undone. |
| virtual void | updateSelectionStatus(QSet< RObject::Id > &affectedEntities, bool updateViews)Updates the selection status of the given entities. |
Protected Attributes
Section titled “Protected Attributes”| RPainterPath | currentPainterPath |
Private Attributes
Section titled “Private Attributes”| QHash< RObject::Id, RBox > | clipRectangles |
| bool | decorating |
| QHash< RObject::Id, QList< RGraphicsSceneDrawable > > | drawables |
| int | drawablesVersion bumped whenever the drawables of the document change |
| QMap< RObject::Id, RBox > | previewClipRectangles |
| QMap< RObject::Id, QList< RGraphicsSceneDrawable > > | previewDrawables |
| bool | screenBasedLinetypesOverride |
| QList< RGraphicsSceneQt * > | threadScenes |
| QStack< QTransform > | transformStack |
Friends
Section titled “Friends”| QDebug | operator<<(QDebug dbg, RGraphicsSceneQt &gs)Stream operator for QDebug. |
Member Documentation
Section titled “Member Documentation”RGraphicsSceneQt
Section titled “RGraphicsSceneQt”RGraphicsSceneQt::RGraphicsSceneQt(RDocumentInterface &documentInterface)All rights reserved.
This file is part of the QCAD project.
QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with QCAD.
~RGraphicsSceneQt
Section titled “~RGraphicsSceneQt”virtual RGraphicsSceneQt::~RGraphicsSceneQt()virtual
addDrawable
Section titled “addDrawable”void RGraphicsSceneQt::addDrawable(RObject::Id entityId, RGraphicsSceneDrawable &drawable, bool draft=false, bool preview=false)addPathToPreview
Section titled “addPathToPreview”virtual void RGraphicsSceneQt::addPathToPreview(RObject::Id entityId, RPainterPath &pp)virtual inline
Reimplemented from addPathToPreview.
addTextToPreview
Section titled “addTextToPreview”void RGraphicsSceneQt::addTextToPreview(const RTextBasedData &text)addToPreview
Section titled “addToPreview”virtual void RGraphicsSceneQt::addToPreview(RObject::Id entityId, QList< RGraphicsSceneDrawable > &drawables)virtual
Reimplemented from addToPreview.
addToPreview
Section titled “addToPreview”virtual void RGraphicsSceneQt::addToPreview(RObject::Id entityId, RGraphicsSceneDrawable &drawable)virtual
Reimplemented from addToPreview.
beginPath
Section titled “beginPath”bool RGraphicsSceneQt::beginPath()Starts a new painter path to export geometry into.
Returns: True if a path has been created, false if there is already a valid path.
virtual void RGraphicsSceneQt::clear()virtual
Clears (resets) the scene contents.
Reimplemented from clear.
clearClipRectangles
Section titled “clearClipRectangles”virtual void RGraphicsSceneQt::clearClipRectangles()virtual
Reimplemented from clearClipRectangles.
clearPreview
Section titled “clearPreview”virtual void RGraphicsSceneQt::clearPreview()virtual
Clears the preview.
Reimplemented from clearPreview.
deleteDrawables
Section titled “deleteDrawables”void RGraphicsSceneQt::deleteDrawables()virtual void RGraphicsSceneQt::dump()virtual inline
Reimplemented from dump.
endPath
Section titled “endPath”void RGraphicsSceneQt::endPath()exportArc
Section titled “exportArc”virtual void RGraphicsSceneQt::exportArc(const RArc &arc, double offset=RNANDOUBLE)virtual
Reimplemented from exportArc.
exportArcSegment
Section titled “exportArcSegment”virtual void RGraphicsSceneQt::exportArcSegment(const RArc &arc, bool allowForZeroLength=false)virtual
Reimplemented from exportArcSegment.
exportClipRectangle
Section titled “exportClipRectangle”virtual void RGraphicsSceneQt::exportClipRectangle(const RBox &clipRectangles, bool forceSelected=false)virtual
Reimplemented from exportClipRectangle.
exportEndTransform
Section titled “exportEndTransform”virtual void RGraphicsSceneQt::exportEndTransform()virtual
Reimplemented from exportEndTransform.
exportEntities
Section titled “exportEntities”virtual void RGraphicsSceneQt::exportEntities(bool allBlocks=true, bool undone=false, bool invisible=false)virtual
Reimplemented from exportEntities.
exportEntitiesThread
Section titled “exportEntitiesThread”void RGraphicsSceneQt::exportEntitiesThread(int threadId, QList< RObject::Id > &list, int start, int end)exportEntityThread
Section titled “exportEntityThread”void RGraphicsSceneQt::exportEntityThread(int threadId, RObject::Id id)exportImage
Section titled “exportImage”virtual void RGraphicsSceneQt::exportImage(const RImageData &image, bool forceSelected=false)virtual
Reimplemented from exportImage.
exportLine
Section titled “exportLine”virtual double RGraphicsSceneQt::exportLine(const RLine &line, double offset=RNANDOUBLE)virtual
Exports a line with the current attributes.
Reimplemented from exportLine.
exportLineSegment
Section titled “exportLineSegment”virtual void RGraphicsSceneQt::exportLineSegment(const RLine &line, double angle=RNANDOUBLE)virtual
Exports a line segment (a line without pattern).
This is called from the standard implementation of exportLine for every dash in a dashed line.
Reimplemented from exportLineSegment.
exportPainterPaths
Section titled “exportPainterPaths”virtual void RGraphicsSceneQt::exportPainterPaths(const QList< RPainterPath > &paths, double z=0.0)virtual
Reimplemented from exportPainterPaths.
exportPoint
Section titled “exportPoint”virtual void RGraphicsSceneQt::exportPoint(const RPoint &point)virtual
Exports a point with the current attributes.
Reimplemented from exportPoint.
exportPolyline
Section titled “exportPolyline”virtual void RGraphicsSceneQt::exportPolyline(const RPolyline &polyline, bool polylineGen=true, double offset=RNANDOUBLE)virtual
Parameters:
polylineGen: True: use pattern along whole polyline, False: pattern per segment.
Reimplemented from exportPolyline.
exportPolylineFill
Section titled “exportPolylineFill”void RGraphicsSceneQt::exportPolylineFill(const RPolyline &polyline)exportRay
Section titled “exportRay”virtual void RGraphicsSceneQt::exportRay(const RRay &ray)virtual
Exports an infinite ray.
Used for rays.
Reimplemented from exportRay.
exportRectangle
Section titled “exportRectangle”virtual void RGraphicsSceneQt::exportRectangle(const RVector &p1, const RVector &p2)virtual
Exports a rectangle with the current attributes.
This is a convenience function that exports two triangles but may also be re-implemented to do something else.
Reimplemented from exportRectangle.
exportSpline
Section titled “exportSpline”virtual void RGraphicsSceneQt::exportSpline(const RSpline &spline, double offset=RNANDOUBLE)virtual
Reimplemented from exportSpline.
exportText
Section titled “exportText”virtual QList< RPainterPath > RGraphicsSceneQt::exportText(const RTextBasedData &text, bool forceSelected=false)virtual
Reimplemented from exportText.
exportThickPolyline
Section titled “exportThickPolyline”virtual void RGraphicsSceneQt::exportThickPolyline(const RPolyline &polyline)virtual
Reimplemented from exportThickPolyline.
exportTransform
Section titled “exportTransform”virtual void RGraphicsSceneQt::exportTransform(const RTransform &t)virtual
Reimplemented from exportTransform.
exportTriangle
Section titled “exportTriangle”virtual void RGraphicsSceneQt::exportTriangle(const RTriangle &triangle)virtual
Exports a triangle with the current attributes.
Reimplemented from exportTriangle.
exportXLine
Section titled “exportXLine”virtual void RGraphicsSceneQt::exportXLine(const RXLine &xLine)virtual
Exports an infinite line.
Used for xlines (construction lines).
Reimplemented from exportXLine.
getClipRectangle
Section titled “getClipRectangle”RBox RGraphicsSceneQt::getClipRectangle(RObject::Id entityId, bool preview=false) constconst
getDrawables
Section titled “getDrawables”QList< RGraphicsSceneDrawable > * RGraphicsSceneQt::getDrawables(RObject::Id entityId)Non-Scriptable: This function is not available in script environments.
Returns: A list of all drawables (painter path, text, image) that represent the entity with the given ID.
getDrawablesList
Section titled “getDrawablesList”QList< RGraphicsSceneDrawable > RGraphicsSceneQt::getDrawablesList(RObject::Id entityId)Non-Scriptable: This function is not available in script environments.
getDrawablesVersion
Section titled “getDrawablesVersion”int RGraphicsSceneQt::getDrawablesVersion() constinline const
Returns: A number which changes whenever the drawables of the document change. Used to invalidate caches which depend on them.
getGraphicsView
Section titled “getGraphicsView”RGraphicsViewImage * RGraphicsSceneQt::getGraphicsView() constconst
getLineTypePatternScale
Section titled “getLineTypePatternScale”virtual double RGraphicsSceneQt::getLineTypePatternScale(const RLinetypePattern &p) constvirtual const
Returns: Pattern scale factor with scale applied if we are printing.
Reimplemented from getLineTypePatternScale.
getPreviewDrawables
Section titled “getPreviewDrawables”QList< RGraphicsSceneDrawable > * RGraphicsSceneQt::getPreviewDrawables(RObject::Id entityId)Non-Scriptable: This function is not available in script environments.
getPreviewEntityIds
Section titled “getPreviewEntityIds”QList< REntity::Id > RGraphicsSceneQt::getPreviewEntityIds()getScreenBasedLinetypes
Section titled “getScreenBasedLinetypes”virtual bool RGraphicsSceneQt::getScreenBasedLinetypes() constvirtual inline const
Reimplemented from getScreenBasedLinetypes.
hasClipRectangleFor
Section titled “hasClipRectangleFor”bool RGraphicsSceneQt::hasClipRectangleFor(RObject::Id entityId, bool preview=false) constconst
hasPreview
Section titled “hasPreview”bool RGraphicsSceneQt::hasPreview() constconst
highlightEntity
Section titled “highlightEntity”virtual void RGraphicsSceneQt::highlightEntity(REntity &entity)virtual
Highlights the given entity.
This is typically used to highlight entities when the mouse hovers over them.
Reimplemented from highlightEntity.
isPixelUnitSupported
Section titled “isPixelUnitSupported”virtual bool RGraphicsSceneQt::isPixelUnitSupported() constvirtual inline const
Painter paths in pixel unit are stored as such and scaled to a constant size in pixels at paint time by the view (RGraphicsViewImage::paintDrawable).
Reimplemented from isPixelUnitSupported.
startEntity
Section titled “startEntity”virtual void RGraphicsSceneQt::startEntity(bool topLevelEntity)virtual
Reimplemented from startEntity.
transformAndApplyPatternPath
Section titled “transformAndApplyPatternPath”void RGraphicsSceneQt::transformAndApplyPatternPath(RPainterPath &path) constconst
Transform the given paths according to current block reference scales.
translateEntities
Section titled “translateEntities”virtual void RGraphicsSceneQt::translateEntities(QSet< RObject::Id > &affectedEntities, const RVector &offset)virtual
Translates the cached drawables (painter paths, texts, images), clip rectangles and reference points of the given entities by the given offset instead of exporting the entities again.
Entities whose graphical representation depends on their absolute position (hatches: pattern origin, block references and viewports: transforms, nested entities) or that have no cached representation yet are exported again.
Reimplemented from translateEntities.
unexportEntity
Section titled “unexportEntity”virtual void RGraphicsSceneQt::unexportEntity(RObject::Id entityId)virtual
This is called for entities for which an export was requested but which cannot be instantiated because they either do not exist (anymore) in the DB or they are currently undone.
Reimplemented from unexportEntity.
updateSelectionStatus
Section titled “updateSelectionStatus”virtual void RGraphicsSceneQt::updateSelectionStatus(QSet< RObject::Id > &affectedEntities, bool updateViews)virtual
Updates the selection status of the given entities.
The default implementation exports the entities again. May be overridden for performance reasons.
Reimplemented from updateSelectionStatus.
currentPainterPath
Section titled “currentPainterPath”RPainterPath RGraphicsSceneQt::currentPainterPathprotected
clipRectangles
Section titled “clipRectangles”QHash<RObject::Id, RBox> RGraphicsSceneQt::clipRectanglesprivate
decorating
Section titled “decorating”bool RGraphicsSceneQt::decoratingprivate
drawables
Section titled “drawables”QHash<RObject::Id, QList<RGraphicsSceneDrawable> > RGraphicsSceneQt::drawablesprivate
drawablesVersion
Section titled “drawablesVersion”int RGraphicsSceneQt::drawablesVersionprivate
bumped whenever the drawables of the document change
previewClipRectangles
Section titled “previewClipRectangles”QMap<RObject::Id, RBox> RGraphicsSceneQt::previewClipRectanglesprivate
previewDrawables
Section titled “previewDrawables”QMap<RObject::Id, QList<RGraphicsSceneDrawable> > RGraphicsSceneQt::previewDrawablesprivate
screenBasedLinetypesOverride
Section titled “screenBasedLinetypesOverride”bool RGraphicsSceneQt::screenBasedLinetypesOverrideprivate
threadScenes
Section titled “threadScenes”QList<RGraphicsSceneQt*> RGraphicsSceneQt::threadScenesprivate
transformStack
Section titled “transformStack”QStack<QTransform> RGraphicsSceneQt::transformStackprivate
operator<<
Section titled “operator<<”QDebug operator<<(QDebug dbg, RGraphicsSceneQt &gs)Stream operator for QDebug.
Non-Scriptable: This function is not available in script environments.