Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeQtQuickLabel::Private Struct Reference

Public Member Functions

QRectF addPaddingToBounds (QRectF bounds)
 
QRectF adjustBBoxToScaling (const QRectF &bbox, const QRectF &widgetBounds)
 
 Private ()
 
 ~Private ()
 

Public Attributes

Qt::Alignment alignment = Qt::AlignHCenter | Qt::AlignVCenter
 
int bottomPadding = 0
 
QRectF documentRect
 
QColor fgColor = Qt::black
 
bool fullColor = false
 
int leftPadding = 0
 
int rightPadding = 0
 
KoShapeQtQuickLabel::ScalingType scalingType = KoShapeQtQuickLabel::Fit
 
QScopedPointer< KoShapePaintershapePainter
 
QList< KoShape * > shapes
 
QString svgData
 
int topPadding = 0
 

Detailed Description

Definition at line 17 of file KoShapeQtQuickLabel.cpp.

Constructor & Destructor Documentation

◆ Private()

KoShapeQtQuickLabel::Private::Private ( )
inline

Definition at line 19 of file KoShapeQtQuickLabel.cpp.

19 {
20
21 }

◆ ~Private()

KoShapeQtQuickLabel::Private::~Private ( )
inline

Definition at line 23 of file KoShapeQtQuickLabel.cpp.

23 {
24 shapePainter.reset();
25 qDeleteAll(shapes);
26 }
QScopedPointer< KoShapePainter > shapePainter

References shapePainter, and shapes.

Member Function Documentation

◆ addPaddingToBounds()

QRectF KoShapeQtQuickLabel::Private::addPaddingToBounds ( QRectF bounds)
inline

◆ adjustBBoxToScaling()

QRectF KoShapeQtQuickLabel::Private::adjustBBoxToScaling ( const QRectF & bbox,
const QRectF & widgetBounds )
inline

< "Fit" behaviour.

Definition at line 44 of file KoShapeQtQuickLabel.cpp.

44 {
45 const double newWidth = widgetBounds.width() - (leftPadding + rightPadding);
46 const double newHeight = widgetBounds.height() - (topPadding + bottomPadding);
47
48 QRectF newBox = bbox;
50 const double docWidth = bbox.width();
51 const double docHeight = bbox.width() * (newHeight / newWidth);
52 double docY = bbox.top();
53 if (alignment.testFlag(Qt::AlignBottom)) {
54 docY = bbox.bottom() - docHeight;
55 } else if (alignment.testFlag(Qt::AlignVCenter)) {
56 docY = (bbox.bottom()*0.5) - (docHeight*0.5);
57 }
58 newBox = QRectF(bbox.left(), docY, docWidth, docHeight);
60 const double docWidth = bbox.height() * (newWidth / newHeight);
61 const double docHeight = bbox.height();
62 double docX = bbox.left();
63 if (alignment.testFlag(Qt::AlignRight)) {
64 docX = bbox.right() - docWidth;
65 } else if (alignment.testFlag(Qt::AlignHCenter)) {
66 docX = (bbox.right()*0.5) - (docWidth*0.5);
67 }
68 newBox = QRectF(docX, bbox.top(), docWidth, docHeight);
69 }
70 const double newTop = (topPadding/newHeight) * newBox.height();
71 const double newBottom = (bottomPadding/newHeight) * newBox.height();
72 const double newLeft = (leftPadding/newWidth) * newBox.width();
73 const double newRight = (rightPadding/newWidth) * newBox.width();
74 return newBox.adjusted(-newLeft, -newTop, newRight, newBottom);
75 }
@ FitWidth
Scale document view to document width. Use alignment to position top or bottom on the document.
@ FitHeight
Scale document view to document height. Use alignment to position left or right on the document.
KoShapeQtQuickLabel::ScalingType scalingType

References alignment, bottomPadding, KoShapeQtQuickLabel::FitHeight, KoShapeQtQuickLabel::FitWidth, leftPadding, rightPadding, scalingType, and topPadding.

Member Data Documentation

◆ alignment

Qt::Alignment KoShapeQtQuickLabel::Private::alignment = Qt::AlignHCenter | Qt::AlignVCenter

Definition at line 35 of file KoShapeQtQuickLabel.cpp.

◆ bottomPadding

int KoShapeQtQuickLabel::Private::bottomPadding = 0

Definition at line 42 of file KoShapeQtQuickLabel.cpp.

◆ documentRect

QRectF KoShapeQtQuickLabel::Private::documentRect

Definition at line 37 of file KoShapeQtQuickLabel.cpp.

◆ fgColor

QColor KoShapeQtQuickLabel::Private::fgColor = Qt::black

Definition at line 32 of file KoShapeQtQuickLabel.cpp.

◆ fullColor

bool KoShapeQtQuickLabel::Private::fullColor = false

Definition at line 33 of file KoShapeQtQuickLabel.cpp.

◆ leftPadding

int KoShapeQtQuickLabel::Private::leftPadding = 0

Definition at line 39 of file KoShapeQtQuickLabel.cpp.

◆ rightPadding

int KoShapeQtQuickLabel::Private::rightPadding = 0

Definition at line 40 of file KoShapeQtQuickLabel.cpp.

◆ scalingType

KoShapeQtQuickLabel::ScalingType KoShapeQtQuickLabel::Private::scalingType = KoShapeQtQuickLabel::Fit

Definition at line 34 of file KoShapeQtQuickLabel.cpp.

◆ shapePainter

QScopedPointer<KoShapePainter> KoShapeQtQuickLabel::Private::shapePainter

Definition at line 29 of file KoShapeQtQuickLabel.cpp.

◆ shapes

QList<KoShape*> KoShapeQtQuickLabel::Private::shapes

Definition at line 28 of file KoShapeQtQuickLabel.cpp.

◆ svgData

QString KoShapeQtQuickLabel::Private::svgData

Definition at line 30 of file KoShapeQtQuickLabel.cpp.

◆ topPadding

int KoShapeQtQuickLabel::Private::topPadding = 0

Definition at line 41 of file KoShapeQtQuickLabel.cpp.


The documentation for this struct was generated from the following file: