Krita Source Code Documentation
Loading...
Searching...
No Matches
RulerAssistant Class Reference

#include <RulerAssistant.h>

+ Inheritance diagram for RulerAssistant:

Public Member Functions

void adjustLine (QPointF &point, QPointF &strokeBegin) override
 
QPointF adjustPosition (const QPointF &point, const QPointF &strokeBegin, const bool snapToAny, qreal moveThresholdPt) override
 
KisPaintingAssistantSP clone (QMap< KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP > &handleMap) const override
 
void enableFixedLength (bool enabled)
 
void ensureLength ()
 
qreal fixedLength () const
 
QString fixedLengthUnit () const
 
QPointF getDefaultEditorPosition () const override
 
bool hasFixedLength () const
 
bool isAssistantComplete () const override
 
bool loadCustomXml (QXmlStreamReader *xml) override
 
int minorSubdivisions () const
 
int numHandles () const override
 
 RulerAssistant ()
 
void saveCustomXml (QXmlStreamWriter *xml) override
 
void setFixedLength (qreal length)
 
void setFixedLengthUnit (QString unit)
 
void setMinorSubdivisions (int subdivisions)
 
void setSubdivisions (int subdivisions)
 
int subdivisions () const
 
- Public Member Functions inherited from KisPaintingAssistant
void addHandle (KisPaintingAssistantHandleSP handle, HandleType type)
 
bool areTwoPointsClose (const QPointF &pointOne, const QPointF &pointTwo)
 
QColor assistantCustomColor ()
 
KisPaintingAssistantHandleSP bottomLeft ()
 
const KisPaintingAssistantHandleSP bottomLeft () const
 
KisPaintingAssistantHandleSP bottomMiddle ()
 
const KisPaintingAssistantHandleSP bottomMiddle () const
 
KisPaintingAssistantHandleSP bottomRight ()
 
const KisPaintingAssistantHandleSP bottomRight () const
 
virtual bool canBeLocal () const
 canBeLocal
 
KisPaintingAssistantHandleSP closestCornerHandleFromPoint (QPointF point)
 
void copySharedData (KisPaintingAssistantSP assistant)
 
void drawError (QPainter &painter, const QPainterPath &path)
 
void drawPath (QPainter &painter, const QPainterPath &path, bool drawActive=true)
 
void drawPreview (QPainter &painter, const QPainterPath &path)
 
void drawX (QPainter &painter, const QPointF &pt)
 
QPointF editorWidgetOffset ()
 
QColor effectiveAssistantColor () const
 
virtual void endStroke ()
 
void findPerspectiveAssistantHandleLocation ()
 
virtual QPointF getEditorPosition () const
 
QList< KisPaintingAssistantHandleSPhandles ()
 
const QList< KisPaintingAssistantHandleSP > & handles () const
 
const QString & id () const
 
bool isDuplicating ()
 isDuplicating
 
bool isLocal () const
 isLocal
 
bool isLocked ()
 isLocked
 
bool isSnappingActive () const
 
 KisPaintingAssistant (const QString &id, const QString &name)
 
KisPaintingAssistantHandleSP leftMiddle ()
 
const KisPaintingAssistantHandleSP leftMiddle () const
 
void loadXml (KoStore *store, QMap< int, KisPaintingAssistantHandleSP > &handleMap, QString path)
 
const QString & name () const
 
KisPaintingAssistantHandleSP oppHandleOne ()
 
void replaceHandle (KisPaintingAssistantHandleSP _handle, KisPaintingAssistantHandleSP _with)
 
KisPaintingAssistantHandleSP rightMiddle ()
 
const KisPaintingAssistantHandleSP rightMiddle () const
 
QByteArray saveXml (QMap< KisPaintingAssistantHandleSP, int > &handleMap)
 
void saveXmlList (QDomDocument &doc, QDomElement &assistantsElement, int count)
 
virtual void setAdjustedBrushPosition (const QPointF position)
 
void setAssistantCustomColor (QColor color)
 
void setAssistantGlobalColorCache (const QColor &color)
 
void setDecorationThickness (int thickness)
 
void setDuplicating (bool value)
 setDuplicating
 
void setEditorWidgetOffset (QPointF offset)
 
virtual void setFollowBrushPosition (bool follow)
 
void setLocal (bool value)
 setLocal
 
void setLocked (bool value)
 setLocked
 
void setSnappingActive (bool set)
 
void setUseCustomColor (bool useCustomColor)
 
QList< KisPaintingAssistantHandleSPsideHandles ()
 
const QList< KisPaintingAssistantHandleSP > & sideHandles () const
 
KisPaintingAssistantHandleSP topLeft ()
 
const KisPaintingAssistantHandleSP topLeft () const
 
KisPaintingAssistantHandleSP topMiddle ()
 
const KisPaintingAssistantHandleSP topMiddle () const
 
KisPaintingAssistantHandleSP topRight ()
 
const KisPaintingAssistantHandleSP topRight () const
 
virtual void transform (const QTransform &transform)
 
void uncache ()
 
bool useCustomColor ()
 
QPointF viewportConstrainedEditorPosition (const KisCoordinatesConverter *converter, const QSize editorSize)
 
virtual ~KisPaintingAssistant ()
 

Protected Member Functions

void drawAssistant (QPainter &gc, const QRectF &updateRect, const KisCoordinatesConverter *converter, bool cached, KisCanvas2 *canvas, bool assistantVisible=true, bool previewVisible=true) override
 
void drawCache (QPainter &gc, const KisCoordinatesConverter *converter, bool assistantVisible=true) override
 performance layer where the graphics can be drawn from a cache instead of generated every render update
 
 RulerAssistant (const QString &id, const QString &name)
 
 RulerAssistant (const RulerAssistant &rhs, QMap< KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP > &handleMap)
 
- Protected Member Functions inherited from KisPaintingAssistant
virtual QRect boundingRect () const
 
QPointF effectiveBrushPosition (const KisCoordinatesConverter *converter, KisCanvas2 *canvas) const
 Query the effective brush position to be used for preview lines. This is intended to be used for painting the dynamic preview lines for assistants that feature them. Affected by setAdjustedBrushPosition() and setFollowBrushPosition().
 
virtual KisPaintingAssistantHandleSP firstLocalHandle () const
 firstLocalHandle Note: this doesn't guarantee it will be the topleft corner! For that, use getLocalRect().topLeft() The only purpose of those functions to exist is to be able to put getLocalRect() function in the KisPaintingAssistant instead of reimplementing it in every specific assistant.
 
QRectF getLocalRect () const
 getLocalRect The function deals with local handles not being topLeft and bottomRight gracefully and returns a correct rectangle. Thanks to that the user can place handles in a "wrong" order or move them around but the local rectangle will still be correct.
 
void initHandles (QList< KisPaintingAssistantHandleSP > _handles)
 
 KisPaintingAssistant (const KisPaintingAssistant &rhs, QMap< KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP > &handleMap)
 
QPointF pixelToView (const QPoint pixelCoords) const
 
virtual KisPaintingAssistantHandleSP secondLocalHandle () const
 secondLocalHandle Note: this doesn't guarantee it will be the bottomRight corner! For that, use getLocalRect().bottomRight() (and remember that for QRect bottomRight() works differently than for QRectF, so don't convert to QRect before accessing the corner)
 

Private Member Functions

void drawHandleAnnotations (QPainter &gc, const KisCoordinatesConverter *converter)
 
void drawSubdivisions (QPainter &gc, const KisCoordinatesConverter *converter)
 
QPointF project (const QPointF &pt) const
 

Private Attributes

qreal m_fixedLength {0.0}
 
QString m_fixedLengthUnit {"px"}
 
bool m_hasFixedLength {false}
 
int m_minorSubdivisions {0}
 
int m_subdivisions {0}
 

Additional Inherited Members

- Static Public Member Functions inherited from KisPaintingAssistant
static QList< KisPaintingAssistantSPcloneAssistantList (const QList< KisPaintingAssistantSP > &list)
 
static double norm2 (const QPointF &p)
 
- Protected Attributes inherited from KisPaintingAssistant
QList< KisPaintingAssistantHandleSPm_handles
 
bool m_hasBeenInsideLocalRect {false}
 

Detailed Description

Definition at line 18 of file RulerAssistant.h.

Constructor & Destructor Documentation

◆ RulerAssistant() [1/3]

RulerAssistant::RulerAssistant ( )

Definition at line 24 of file RulerAssistant.cc.

25 : RulerAssistant("ruler", i18n("Ruler assistant"))
26{
27}

◆ RulerAssistant() [2/3]

RulerAssistant::RulerAssistant ( const QString & id,
const QString & name )
explicitprotected

Definition at line 29 of file RulerAssistant.cc.

31{
32}
const QString & name() const
KisPaintingAssistant(const QString &id, const QString &name)

◆ RulerAssistant() [3/3]

RulerAssistant::RulerAssistant ( const RulerAssistant & rhs,
QMap< KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP > & handleMap )
explicitprotected

Member Function Documentation

◆ adjustLine()

void RulerAssistant::adjustLine ( QPointF & point,
QPointF & strokeBegin )
overridevirtual

Implements KisPaintingAssistant.

Definition at line 77 of file RulerAssistant.cc.

78{
79 point = project(point);
80 strokeBegin = project(strokeBegin);
81}
QPointF project(const QPointF &pt) const

References project().

◆ adjustPosition()

QPointF RulerAssistant::adjustPosition ( const QPointF & point,
const QPointF & strokeBegin,
const bool snapToAny,
qreal moveThresholdPt )
overridevirtual

Adjust the position given in parameter.

Parameters
pointthe coordinates in point in the document reference
strokeBeginthe coordinates of the beginning of the stroke
snapToAnybecause now assistants can be composited out of multiple inside assistants. snapToAny true means that you can use any of the inside assistant, while it being false means you should use the last used one. The logic determining when it happens (first stroke etc.) is in the decoration, so those two options are enough.
moveThresholdPtthe threshold for the "move" of the cursor measured in pt (usually equals to 2px in screen coordinates converted to pt)

Implements KisPaintingAssistant.

Definition at line 72 of file RulerAssistant.cc.

73{
74 return project(pt);
75}

References project().

◆ clone()

KisPaintingAssistantSP RulerAssistant::clone ( QMap< KisPaintingAssistantHandleSP, KisPaintingAssistantHandleSP > & handleMap) const
overridevirtual

Implements KisPaintingAssistant.

Definition at line 34 of file RulerAssistant.cc.

35{
36 return KisPaintingAssistantSP(new RulerAssistant(*this, handleMap));
37}
QSharedPointer< KisPaintingAssistant > KisPaintingAssistantSP
Definition kis_types.h:189

References RulerAssistant().

◆ drawAssistant()

void RulerAssistant::drawAssistant ( QPainter & gc,
const QRectF & updateRect,
const KisCoordinatesConverter * converter,
bool cached,
KisCanvas2 * canvas,
bool assistantVisible = true,
bool previewVisible = true )
overrideprotectedvirtual

Reimplemented from KisPaintingAssistant.

Definition at line 182 of file RulerAssistant.cc.

183{
184 // Draw the subdivisions
185 // When the number of subdivisions (or minor subdivisions) is set to
186 // 0, the respective feature is turned off and won't be rendered.
187 if (assistantVisible && isAssistantComplete() && subdivisions() > 0) {
188 drawSubdivisions(gc, converter);
189 }
190
191 // Indicate handle type on fixed-length handles
192 if (canvas && canvas->paintingAssistantsDecoration()->isEditingAssistants() && hasFixedLength()) {
193 drawHandleAnnotations(gc, converter);
194 }
195
196 // Draw the ruler itself via drawCache
197 KisPaintingAssistant::drawAssistant(gc, updateRect, converter, cached, canvas, assistantVisible, previewVisible);
198}
KisPaintingAssistantsDecorationSP paintingAssistantsDecoration() const
virtual void drawAssistant(QPainter &gc, const QRectF &updateRect, const KisCoordinatesConverter *converter, bool cached, KisCanvas2 *canvas=0, bool assistantVisible=true, bool previewVisible=true)
void drawHandleAnnotations(QPainter &gc, const KisCoordinatesConverter *converter)
bool isAssistantComplete() const override
bool hasFixedLength() const
int subdivisions() const
void drawSubdivisions(QPainter &gc, const KisCoordinatesConverter *converter)

References KisPaintingAssistant::drawAssistant(), drawHandleAnnotations(), drawSubdivisions(), hasFixedLength(), isAssistantComplete(), KisPaintingAssistantsDecoration::isEditingAssistants(), KisCanvas2::paintingAssistantsDecoration(), and subdivisions().

◆ drawCache()

void RulerAssistant::drawCache ( QPainter & gc,
const KisCoordinatesConverter * converter,
bool assistantVisible = true )
overrideprotectedvirtual

performance layer where the graphics can be drawn from a cache instead of generated every render update

Implements KisPaintingAssistant.

Definition at line 200 of file RulerAssistant.cc.

201{
202 if (!assistantVisible || !isAssistantComplete()){
203 return;
204 }
205
206 QTransform initialTransform = converter->documentToWidgetTransform();
207
208 // Draw the line
209 QPointF p1 = *handles()[0];
210 QPointF p2 = *handles()[1];
211
212 gc.setTransform(initialTransform);
213 QPainterPath path;
214 path.moveTo(p1);
215 path.lineTo(p2);
216 drawPath(gc, path, isSnappingActive());
217}
QPointF p2
QPointF p1
void drawPath(QPainter &painter, const QPainterPath &path, bool drawActive=true)
const QList< KisPaintingAssistantHandleSP > & handles() const

References KisCoordinatesConverter::documentToWidgetTransform(), KisPaintingAssistant::drawPath(), KisPaintingAssistant::handles(), isAssistantComplete(), KisPaintingAssistant::isSnappingActive(), p1, and p2.

◆ drawHandleAnnotations()

void RulerAssistant::drawHandleAnnotations ( QPainter & gc,
const KisCoordinatesConverter * converter )
private

Definition at line 150 of file RulerAssistant.cc.

150 {
151 gc.save();
152 gc.resetTransform();
153
154 QTransform doc2widget = converter->documentToWidgetTransform();
155 QPointF center = doc2widget.map(*handles()[0]);
156 QPointF handle = doc2widget.map(*handles()[1]);
157
158 QPainterPath path;
159
160 // Center / Movement handle
161 for (int i = 0; i < 4; ++i) {
162 QTransform rot = QTransform().rotate(i * 90);
163
164 path.moveTo(center + rot.map(QPointF(12, -3)));
165 path.lineTo(center + rot.map(QPointF(9, 0)));
166 path.lineTo(center + rot.map(QPointF(12, 3)));
167 }
168
169 // Rotation handle
170 QRectF bounds = QRectF(handle, QSizeF(0, 0)).adjusted(-11, -11, 11, 11);
171 for (int i = 0; i < 2; ++i) {
172 int dir = i == 0 ? 1 : -1;
173
174 path.moveTo(handle + QPointF(dir * 11, 0));
175 path.arcTo(bounds, i * 180, -90);
176 }
177
178 drawPath(gc, path);
179 gc.restore();
180}
#define bounds(x, a, b)

References bounds, KisCoordinatesConverter::documentToWidgetTransform(), KisPaintingAssistant::drawPath(), and KisPaintingAssistant::handles().

◆ drawSubdivisions()

void RulerAssistant::drawSubdivisions ( QPainter & gc,
const KisCoordinatesConverter * converter )
private

Definition at line 83 of file RulerAssistant.cc.

83 {
84 if (subdivisions() == 0) {
85 return;
86 }
87
88 // Get handle positions
89 QTransform document2widget = converter->documentToWidgetTransform();
90
91 QPointF p1 = document2widget.map(*handles()[0]);
92 QPointF p2 = document2widget.map(*handles()[1]);
93
94 const qreal scale = 16.0 / 2;
95 const qreal minorScale = scale / 2;
96 const QRectF clipping = QRectF(gc.viewport()).adjusted(-scale, -scale, scale, scale);
97 // If the lines would end up closer to each other than this threshold (in
98 // screen coordinates), they are not rendered, as they wouldn't be
99 // distinguishable anymore.
100 const qreal threshold = 3.0;
101
102 // Calculate line direction and normal vector
103 QPointF delta = p2 - p1;
104 qreal length = sqrt(KisPaintingAssistant::norm2(delta));
105 qreal stepsize = length / subdivisions();
106
107 // Only draw if lines are far enough apart
108 if (stepsize >= threshold) {
109 QPointF normal = QPointF(delta.y(), -delta.x());
110 normal /= length;
111
112 QPainterPath path;
113
114 // Draw the major subdivisions
115 for (int ii = 0; ii <= subdivisions(); ++ii) {
116
117 QPointF pos = p1 + delta * ((qreal)ii / subdivisions());
118
119 if (clipping.contains(pos)) {
120 path.moveTo(pos - normal * scale);
121 path.lineTo(pos + normal * scale);
122 }
123
124 // Draw minor subdivisions, if they exist (implicit check due to
125 // the loop bounds)
126 // Skip for the last iteration of the outer loop, which would
127 // already be beyond the ruler's length
128 // Also skip if major subdivisions are too close already
129 if (ii == subdivisions() || stepsize / minorSubdivisions() < threshold)
130 continue;
131 // Draw minor marks in between the major ones
132 for (int jj = 1; jj < minorSubdivisions(); ++jj) {
133
134 QPointF mpos = pos + delta * ((qreal)jj / (subdivisions() * minorSubdivisions()));
135
136 if (clipping.contains(mpos)) {
137 path.moveTo(mpos - normal * minorScale);
138 path.lineTo(mpos + normal * minorScale);
139 }
140 }
141 }
142
143 gc.save();
144 gc.resetTransform();
145 drawPath(gc, path, isSnappingActive());
146 gc.restore();
147 }
148}
qreal length(const QPointF &vec)
Definition Ellipse.cc:82
static double norm2(const QPointF &p)
int minorSubdivisions() const

References KisCoordinatesConverter::documentToWidgetTransform(), KisPaintingAssistant::drawPath(), KisPaintingAssistant::handles(), KisPaintingAssistant::isSnappingActive(), length(), minorSubdivisions(), KisPaintingAssistant::norm2(), p1, p2, and subdivisions().

◆ enableFixedLength()

void RulerAssistant::enableFixedLength ( bool enabled)

Definition at line 257 of file RulerAssistant.cc.

257 {
258 m_hasFixedLength = enabled;
259}

References m_hasFixedLength.

◆ ensureLength()

void RulerAssistant::ensureLength ( )

Definition at line 285 of file RulerAssistant.cc.

285 {
286 if (!hasFixedLength() || fixedLength() < 1e-3) {
287 return;
288 }
289
290 QPointF center = *handles()[0];
291 QPointF handle = *handles()[1];
292 QPointF direction = handle - center;
293 qreal distance = sqrt(KisPaintingAssistant::norm2(direction));
294 QPointF delta = direction / distance * fixedLength();
295 *handles()[1] = center + delta;
296 uncache();
297}
qreal distance(const QPointF &p1, const QPointF &p2)
qreal fixedLength() const

References distance(), fixedLength(), KisPaintingAssistant::handles(), hasFixedLength(), KisPaintingAssistant::norm2(), and KisPaintingAssistant::uncache().

◆ fixedLength()

qreal RulerAssistant::fixedLength ( ) const

Definition at line 261 of file RulerAssistant.cc.

261 {
262 return m_fixedLength;
263}

References m_fixedLength.

◆ fixedLengthUnit()

QString RulerAssistant::fixedLengthUnit ( ) const

Definition at line 273 of file RulerAssistant.cc.

273 {
274 return m_fixedLengthUnit;
275}

References m_fixedLengthUnit.

◆ getDefaultEditorPosition()

QPointF RulerAssistant::getDefaultEditorPosition ( ) const
overridevirtual

Implements KisPaintingAssistant.

Definition at line 219 of file RulerAssistant.cc.

220{
221 return (*handles()[0] + *handles()[1]) * 0.5;
222}

References KisPaintingAssistant::handles().

◆ hasFixedLength()

bool RulerAssistant::hasFixedLength ( ) const

Definition at line 253 of file RulerAssistant.cc.

253 {
254 return m_hasFixedLength;
255}

References m_hasFixedLength.

◆ isAssistantComplete()

bool RulerAssistant::isAssistantComplete ( ) const
overridevirtual

determines if the assistant has enough handles to be considered created new assistants get in a "creation" phase where they are currently being made on the canvas it will return false if we are in the middle of creating the assistant.

Reimplemented from KisPaintingAssistant.

Definition at line 224 of file RulerAssistant.cc.

225{
226 return handles().size() >= 2;
227}

References KisPaintingAssistant::handles().

◆ loadCustomXml()

bool RulerAssistant::loadCustomXml ( QXmlStreamReader * xml)
overridevirtual

Reimplemented from KisPaintingAssistant.

Definition at line 315 of file RulerAssistant.cc.

315 {
316 if (xml) {
317 if (xml->name() == "subdivisions") {
318 setSubdivisions(KisDomUtils::toInt(xml->attributes().value("value").toString()));
319 }
320 else if (xml->name() == "minorSubdivisions") {
321 setMinorSubdivisions(KisDomUtils::toInt(xml->attributes().value("value").toString()));
322 }
323 else if (xml->name() == "fixedLength") {
324 setFixedLength(KisDomUtils::toDouble(xml->attributes().value("value").toString()));
325 enableFixedLength(0 != KisDomUtils::toInt(xml->attributes().value("enabled").toString()));
326 setFixedLengthUnit(xml->attributes().value("unit").toString());
327 }
328 }
329 return true;
330}
void setFixedLength(qreal length)
void setFixedLengthUnit(QString unit)
void setMinorSubdivisions(int subdivisions)
void setSubdivisions(int subdivisions)
void enableFixedLength(bool enabled)
double toDouble(const QString &str, bool *ok=nullptr)
int toInt(const QString &str, bool *ok=nullptr)

References enableFixedLength(), setFixedLength(), setFixedLengthUnit(), setMinorSubdivisions(), setSubdivisions(), KisDomUtils::toDouble(), and KisDomUtils::toInt().

◆ minorSubdivisions()

int RulerAssistant::minorSubdivisions ( ) const

Definition at line 241 of file RulerAssistant.cc.

241 {
242 return m_minorSubdivisions;
243}

References m_minorSubdivisions.

◆ numHandles()

int RulerAssistant::numHandles ( ) const
inlineoverridevirtual

Implements KisPaintingAssistant.

Definition at line 26 of file RulerAssistant.h.

26{ return 2; }

◆ project()

QPointF RulerAssistant::project ( const QPointF & pt) const
private

Definition at line 49 of file RulerAssistant.cc.

50{
51 Q_ASSERT(isAssistantComplete());
52 QPointF pt1 = *handles()[0];
53 QPointF pt2 = *handles()[1];
54
55 QPointF a = pt - pt1;
56 QPointF u = pt2 - pt1;
57
58 qreal u_norm = sqrt(u.x() * u.x() + u.y() * u.y());
59
60 if(u_norm == 0) return pt;
61
62 u /= u_norm;
63
64 double t = a.x() * u.x() + a.y() * u.y();
65
66 if(t < 0.0) return pt1;
67 if(t > u_norm) return pt2;
68
69 return t * u + pt1;
70}
qreal u

References KisPaintingAssistant::handles(), isAssistantComplete(), and u.

◆ saveCustomXml()

void RulerAssistant::saveCustomXml ( QXmlStreamWriter * xml)
overridevirtual

Reimplemented from KisPaintingAssistant.

Definition at line 299 of file RulerAssistant.cc.

299 {
300 if (xml) {
301 xml->writeStartElement("subdivisions");
302 xml->writeAttribute("value", KisDomUtils::toString(subdivisions()));
303 xml->writeEndElement();
304 xml->writeStartElement("minorSubdivisions");
305 xml->writeAttribute("value", KisDomUtils::toString(minorSubdivisions()));
306 xml->writeEndElement();
307 xml->writeStartElement("fixedLength");
308 xml->writeAttribute("value", KisDomUtils::toString(fixedLength()));
309 xml->writeAttribute("enabled", KisDomUtils::toString((int)hasFixedLength()));
310 xml->writeAttribute("unit", fixedLengthUnit());
311 xml->writeEndElement();
312 }
313}
QString fixedLengthUnit() const
QString toString(const QString &value)

References fixedLength(), fixedLengthUnit(), hasFixedLength(), minorSubdivisions(), subdivisions(), and KisDomUtils::toString().

◆ setFixedLength()

void RulerAssistant::setFixedLength ( qreal length)

Definition at line 265 of file RulerAssistant.cc.

265 {
266 if (length < 0.0) {
267 m_fixedLength = 0.0;
268 } else {
270 }
271}

References length(), and m_fixedLength.

◆ setFixedLengthUnit()

void RulerAssistant::setFixedLengthUnit ( QString unit)

Definition at line 277 of file RulerAssistant.cc.

277 {
278 if (unit.isEmpty()) {
279 m_fixedLengthUnit = "px";
280 } else {
281 m_fixedLengthUnit = unit;
282 }
283}

References m_fixedLengthUnit.

◆ setMinorSubdivisions()

void RulerAssistant::setMinorSubdivisions ( int subdivisions)

Definition at line 245 of file RulerAssistant.cc.

245 {
246 if (subdivisions < 0) {
248 } else {
250 }
251}

References m_minorSubdivisions, and subdivisions().

◆ setSubdivisions()

void RulerAssistant::setSubdivisions ( int subdivisions)

Definition at line 233 of file RulerAssistant.cc.

233 {
234 if (subdivisions < 0) {
235 m_subdivisions = 0;
236 } else {
238 }
239}

References m_subdivisions, and subdivisions().

◆ subdivisions()

int RulerAssistant::subdivisions ( ) const

Definition at line 229 of file RulerAssistant.cc.

229 {
230 return m_subdivisions;
231}

References m_subdivisions.

Member Data Documentation

◆ m_fixedLength

qreal RulerAssistant::m_fixedLength {0.0}
private

Definition at line 58 of file RulerAssistant.h.

58{0.0};

◆ m_fixedLengthUnit

QString RulerAssistant::m_fixedLengthUnit {"px"}
private

Definition at line 59 of file RulerAssistant.h.

59{"px"};

◆ m_hasFixedLength

bool RulerAssistant::m_hasFixedLength {false}
private

Definition at line 57 of file RulerAssistant.h.

57{false};

◆ m_minorSubdivisions

int RulerAssistant::m_minorSubdivisions {0}
private

Definition at line 56 of file RulerAssistant.h.

56{0};

◆ m_subdivisions

int RulerAssistant::m_subdivisions {0}
private

Definition at line 55 of file RulerAssistant.h.

55{0};

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