Skip to content

RGraphicsSceneQt

Class in GUI Module
Header: #include <src/gui/RGraphicsSceneQt.h>
Inherits: RGraphicsScene

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.

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() 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).
virtual void startEntity(bool topLevelEntity)
void transformAndApplyPatternPath(RPainterPath &path) const
Transform 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.
RPainterPath currentPainterPath
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
QDebug operator<<(QDebug dbg, RGraphicsSceneQt &gs)
Stream operator for QDebug.

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.

virtual RGraphicsSceneQt::~RGraphicsSceneQt()

virtual

void RGraphicsSceneQt::addDrawable(RObject::Id entityId, RGraphicsSceneDrawable &drawable, bool draft=false, bool preview=false)

virtual void RGraphicsSceneQt::addPathToPreview(RObject::Id entityId, RPainterPath &pp)

virtual inline

Reimplemented from addPathToPreview.

void RGraphicsSceneQt::addTextToPreview(const RTextBasedData &text)

virtual void RGraphicsSceneQt::addToPreview(RObject::Id entityId, QList< RGraphicsSceneDrawable > &drawables)

virtual

Reimplemented from addToPreview.

virtual void RGraphicsSceneQt::addToPreview(RObject::Id entityId, RGraphicsSceneDrawable &drawable)

virtual

Reimplemented from addToPreview.

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.

virtual void RGraphicsSceneQt::clearClipRectangles()

virtual

Reimplemented from clearClipRectangles.

virtual void RGraphicsSceneQt::clearPreview()

virtual

Clears the preview.

Reimplemented from clearPreview.

void RGraphicsSceneQt::deleteDrawables()

virtual void RGraphicsSceneQt::dump()

virtual inline

Reimplemented from dump.

void RGraphicsSceneQt::endPath()

virtual void RGraphicsSceneQt::exportArc(const RArc &arc, double offset=RNANDOUBLE)

virtual

Reimplemented from exportArc.

virtual void RGraphicsSceneQt::exportArcSegment(const RArc &arc, bool allowForZeroLength=false)

virtual

Reimplemented from exportArcSegment.

virtual void RGraphicsSceneQt::exportClipRectangle(const RBox &clipRectangles, bool forceSelected=false)

virtual

Reimplemented from exportClipRectangle.

virtual void RGraphicsSceneQt::exportEndTransform()

virtual

Reimplemented from exportEndTransform.

virtual void RGraphicsSceneQt::exportEntities(bool allBlocks=true, bool undone=false, bool invisible=false)

virtual

Reimplemented from exportEntities.

void RGraphicsSceneQt::exportEntitiesThread(int threadId, QList< RObject::Id > &list, int start, int end)

void RGraphicsSceneQt::exportEntityThread(int threadId, RObject::Id id)

virtual void RGraphicsSceneQt::exportImage(const RImageData &image, bool forceSelected=false)

virtual

Reimplemented from exportImage.

virtual double RGraphicsSceneQt::exportLine(const RLine &line, double offset=RNANDOUBLE)

virtual

Exports a line with the current attributes.

Reimplemented from exportLine.

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.

virtual void RGraphicsSceneQt::exportPainterPaths(const QList< RPainterPath > &paths, double z=0.0)

virtual

Reimplemented from exportPainterPaths.

virtual void RGraphicsSceneQt::exportPoint(const RPoint &point)

virtual

Exports a point with the current attributes.

Reimplemented from exportPoint.

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.

void RGraphicsSceneQt::exportPolylineFill(const RPolyline &polyline)

virtual void RGraphicsSceneQt::exportRay(const RRay &ray)

virtual

Exports an infinite ray.

Used for rays.

Reimplemented from exportRay.

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.

virtual void RGraphicsSceneQt::exportSpline(const RSpline &spline, double offset=RNANDOUBLE)

virtual

Reimplemented from exportSpline.

virtual QList< RPainterPath > RGraphicsSceneQt::exportText(const RTextBasedData &text, bool forceSelected=false)

virtual

Reimplemented from exportText.

virtual void RGraphicsSceneQt::exportThickPolyline(const RPolyline &polyline)

virtual

Reimplemented from exportThickPolyline.

virtual void RGraphicsSceneQt::exportTransform(const RTransform &t)

virtual

Reimplemented from exportTransform.

virtual void RGraphicsSceneQt::exportTriangle(const RTriangle &triangle)

virtual

Exports a triangle with the current attributes.

Reimplemented from exportTriangle.

virtual void RGraphicsSceneQt::exportXLine(const RXLine &xLine)

virtual

Exports an infinite line.

Used for xlines (construction lines).

Reimplemented from exportXLine.

RBox RGraphicsSceneQt::getClipRectangle(RObject::Id entityId, bool preview=false) const

const

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.

QList< RGraphicsSceneDrawable > RGraphicsSceneQt::getDrawablesList(RObject::Id entityId)

Non-Scriptable: This function is not available in script environments.

int RGraphicsSceneQt::getDrawablesVersion() const

inline const

Returns: A number which changes whenever the drawables of the document change. Used to invalidate caches which depend on them.

RGraphicsViewImage * RGraphicsSceneQt::getGraphicsView() const

const

virtual double RGraphicsSceneQt::getLineTypePatternScale(const RLinetypePattern &p) const

virtual const

Returns: Pattern scale factor with scale applied if we are printing.

Reimplemented from getLineTypePatternScale.

QList< RGraphicsSceneDrawable > * RGraphicsSceneQt::getPreviewDrawables(RObject::Id entityId)

Non-Scriptable: This function is not available in script environments.

QList< REntity::Id > RGraphicsSceneQt::getPreviewEntityIds()

virtual bool RGraphicsSceneQt::getScreenBasedLinetypes() const

virtual inline const

Reimplemented from getScreenBasedLinetypes.

bool RGraphicsSceneQt::hasClipRectangleFor(RObject::Id entityId, bool preview=false) const

const

bool RGraphicsSceneQt::hasPreview() const

const

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.

virtual bool RGraphicsSceneQt::isPixelUnitSupported() const

virtual 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.

virtual void RGraphicsSceneQt::startEntity(bool topLevelEntity)

virtual

Reimplemented from startEntity.

void RGraphicsSceneQt::transformAndApplyPatternPath(RPainterPath &path) const

const

Transform the given paths according to current block reference scales.

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.

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.

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.

RPainterPath RGraphicsSceneQt::currentPainterPath

protected

QHash<RObject::Id, RBox> RGraphicsSceneQt::clipRectangles

private

bool RGraphicsSceneQt::decorating

private

QHash<RObject::Id, QList<RGraphicsSceneDrawable> > RGraphicsSceneQt::drawables

private

int RGraphicsSceneQt::drawablesVersion

private

bumped whenever the drawables of the document change

QMap<RObject::Id, RBox> RGraphicsSceneQt::previewClipRectangles

private

QMap<RObject::Id, QList<RGraphicsSceneDrawable> > RGraphicsSceneQt::previewDrawables

private

bool RGraphicsSceneQt::screenBasedLinetypesOverride

private

QList<RGraphicsSceneQt*> RGraphicsSceneQt::threadScenes

private

QStack<QTransform> RGraphicsSceneQt::transformStack

private

QDebug operator<<(QDebug dbg, RGraphicsSceneQt &gs)

Stream operator for QDebug.

Non-Scriptable: This function is not available in script environments.