LibrePCB Developers Documentation
Loading...
Searching...
No Matches
GraphicsScene Class Reference

The GraphicsScene class. More...

#include <graphicsscene.h>

+ Inheritance diagram for GraphicsScene:
+ Collaboration diagram for GraphicsScene:

Classes

struct  RulerGauge
 

Public Member Functions

 GraphicsScene (QObject *parent=nullptr) noexcept
 
virtual ~GraphicsScene () noexcept
 
const PositiveLengthgetGridInterval () const noexcept
 
Theme::GridStyle getGridStyle () const noexcept
 
void setBackgroundColors (const QColor &fill, const QColor &grid) noexcept
 
void setOverlayColors (const QColor &fill, const QColor &content) noexcept
 
void setSelectionRectColors (const QColor &line, const QColor &fill) noexcept
 
void setGridStyle (Theme::GridStyle style) noexcept
 
void setGridInterval (const PositiveLength &interval) noexcept
 
void setOriginCrossVisible (bool visible) noexcept
 
void setGrayOut (bool grayOut) noexcept
 
void setSelectionRect (const Point &p1, const Point &p2) noexcept
 
void clearSelectionRect () noexcept
 
void setSceneRectMarker (const QRectF &rect) noexcept
 Setup the marker for a specific scene rect.
 
void setSceneCursor (const Point &pos, bool cross, bool circle) noexcept
 
void setRulerPositions (const std::optional< std::pair< Point, Point > > &pos) noexcept
 
void addItem (QGraphicsItem &item) noexcept
 
void removeItem (QGraphicsItem &item) noexcept
 
QPixmap toPixmap (int dpi, const QColor &background=Qt::transparent) noexcept
 
QPixmap toPixmap (const QSize &size, const QColor &background=Qt::transparent) noexcept
 

Protected Member Functions

void drawBackground (QPainter *painter, const QRectF &rect) noexcept override
 
void drawForeground (QPainter *painter, const QRectF &rect) noexcept override
 

Private Attributes

Theme::GridStyle mGridStyle
 
PositiveLength mGridInterval
 
QColor mBackgroundColor
 
QColor mGridColor
 
QColor mOverlayFillColor
 
QColor mOverlayContentColor
 
QRectF mSceneRectMarker
 
bool mOriginCrossVisible
 
bool mGrayOut
 
std::unique_ptr< QGraphicsRectItem > mSelectionRectItem
 
Point mSceneCursorPos
 
bool mSceneCursorCross
 
bool mSceneCursorCircle
 
QVector< RulerGaugemRulerGauges
 
std::optional< std::pair< Point, Point > > mRulerPositions
 

Detailed Description

The GraphicsScene class.

Constructor & Destructor Documentation

◆ GraphicsScene()

GraphicsScene ( QObject *  parent = nullptr)
explicitnoexcept
+ Here is the call graph for this function:

◆ ~GraphicsScene()

~GraphicsScene ( )
virtualnoexcept

Member Function Documentation

◆ getGridInterval()

const PositiveLength & getGridInterval ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getGridStyle()

Theme::GridStyle getGridStyle ( ) const
inlinenoexcept

◆ setBackgroundColors()

void setBackgroundColors ( const QColor &  fill,
const QColor &  grid 
)
noexcept
+ Here is the caller graph for this function:

◆ setOverlayColors()

void setOverlayColors ( const QColor &  fill,
const QColor &  content 
)
noexcept

◆ setSelectionRectColors()

void setSelectionRectColors ( const QColor &  line,
const QColor &  fill 
)
noexcept

◆ setGridStyle()

void setGridStyle ( Theme::GridStyle  style)
noexcept

◆ setGridInterval()

void setGridInterval ( const PositiveLength interval)
noexcept

◆ setOriginCrossVisible()

void setOriginCrossVisible ( bool  visible)
noexcept
+ Here is the caller graph for this function:

◆ setGrayOut()

void setGrayOut ( bool  grayOut)
noexcept
+ Here is the caller graph for this function:

◆ setSelectionRect()

void setSelectionRect ( const Point p1,
const Point p2 
)
noexcept
+ Here is the caller graph for this function:

◆ clearSelectionRect()

void clearSelectionRect ( )
noexcept
+ Here is the caller graph for this function:

◆ setSceneRectMarker()

void setSceneRectMarker ( const QRectF &  rect)
noexcept

Setup the marker for a specific scene rect.

This is intended to mark a specific area in a scene, with a line starting from the top left of the view, so the user can easily locate the specified area, even if it is very small.

Parameters
rectThe rect to mark. Pass an empty rect to clear the marker.

◆ setSceneCursor()

void setSceneCursor ( const Point pos,
bool  cross,
bool  circle 
)
noexcept
+ Here is the caller graph for this function:

◆ setRulerPositions()

void setRulerPositions ( const std::optional< std::pair< Point, Point > > &  pos)
noexcept

◆ addItem()

void addItem ( QGraphicsItem &  item)
noexcept
+ Here is the caller graph for this function:

◆ removeItem()

void removeItem ( QGraphicsItem &  item)
noexcept

◆ toPixmap() [1/2]

QPixmap toPixmap ( int  dpi,
const QColor &  background = Qt::transparent 
)
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toPixmap() [2/2]

QPixmap toPixmap ( const QSize &  size,
const QColor &  background = Qt::transparent 
)
noexcept

◆ drawBackground()

void drawBackground ( QPainter *  painter,
const QRectF &  rect 
)
overrideprotectednoexcept

◆ drawForeground()

void drawForeground ( QPainter *  painter,
const QRectF &  rect 
)
overrideprotectednoexcept
+ Here is the call graph for this function:

Member Data Documentation

◆ mGridStyle

Theme::GridStyle mGridStyle
private

◆ mGridInterval

PositiveLength mGridInterval
private

◆ mBackgroundColor

QColor mBackgroundColor
private

◆ mGridColor

QColor mGridColor
private

◆ mOverlayFillColor

QColor mOverlayFillColor
private

◆ mOverlayContentColor

QColor mOverlayContentColor
private

◆ mSceneRectMarker

QRectF mSceneRectMarker
private

◆ mOriginCrossVisible

bool mOriginCrossVisible
private

◆ mGrayOut

bool mGrayOut
private

◆ mSelectionRectItem

std::unique_ptr<QGraphicsRectItem> mSelectionRectItem
private

◆ mSceneCursorPos

Point mSceneCursorPos
private

◆ mSceneCursorCross

bool mSceneCursorCross
private

◆ mSceneCursorCircle

bool mSceneCursorCircle
private

◆ mRulerGauges

QVector<RulerGauge> mRulerGauges
private

◆ mRulerPositions

std::optional<std::pair<Point, Point> > mRulerPositions
private

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