6#include "GuidesConfig.h"
11#include "kis_guides_config.h"
13struct GuidesConfig::Private {
15 KisGuidesConfig *guidesConfig;
18GuidesConfig::GuidesConfig(KisGuidesConfig *guidesConfig)
22 d->guidesConfig = guidesConfig;
25GuidesConfig::GuidesConfig(
QObject *parent)
29 d->guidesConfig =
new KisGuidesConfig();
32GuidesConfig::~GuidesConfig()
37bool GuidesConfig::operator==(
const GuidesConfig &other)
const
39 return (d->guidesConfig == other.d->guidesConfig);
42bool GuidesConfig::operator!=(
const GuidesConfig &other)
const
44 return !(operator==(other));
49 return d->guidesConfig->guidesColor();
54 d->guidesConfig->setGuidesColor(
color);
59 KisGuidesConfig::LineTypeInternal
lineType = d->guidesConfig->guidesLineType();
60 if(
lineType == KisGuidesConfig::LineTypeInternal::LINE_DASHED) {
63 else if(
lineType == KisGuidesConfig::LineTypeInternal::LINE_DOTTED) {
71 if (!d->guidesConfig)
return;
74 d->guidesConfig->setGuidesLineType(KisGuidesConfig::LineTypeInternal::LINE_DASHED);
77 d->guidesConfig->setGuidesLineType(KisGuidesConfig::LineTypeInternal::LINE_DOTTED);
80 d->guidesConfig->setGuidesLineType(KisGuidesConfig::LineTypeInternal::LINE_SOLID);
86 return d->guidesConfig->hasGuides();
91 return d->guidesConfig->hasSamePositionAs(guideConfig.guidesConfig());
96 return d->guidesConfig->showGuides();
101 d->guidesConfig->setShowGuides(value);
108 int errorLine {0}, errorColumn {0};
110 if(doc.
setContent(xmlContent, &errorMsg, &errorLine, &errorColumn)) {
120 QDomElement elt = d->guidesConfig->saveToXml(doc,
"guides");
127 d->guidesConfig->removeAllGuides();
132 return d->guidesConfig->lockGuides();
137 d->guidesConfig->setLockGuides(
locked);
142 return d->guidesConfig->snapToGuides();
147 d->guidesConfig->setSnapToGuides(
snap);
152 d->guidesConfig->setHorizontalGuideLines(lines);
157 d->guidesConfig->setVerticalGuideLines(lines);
162 return d->guidesConfig->horizontalGuideLines();
167 return d->guidesConfig->verticalGuideLines();
170KisGuidesConfig GuidesConfig::guidesConfig()
const
172 return *d->guidesConfig;
The GuidesConfig class encapsulates a Krita Guides configuration.
bool hasSamePositionAs(const GuidesConfig &guideConfig) const
indicate if position from current guides configuration match positions from another guides configurat...
QString toXml() const
Save guides definition as an XML document.
void setColor(const QColor &color) const
Define guides color.
QList< qreal > horizontalGuides() const
The horizontal guides.
QColor color() const
Guides color.
bool fromXml(const QString &xmlContent) const
Load guides definition from an XML document.
void removeAllGuides()
Remove all guides.
void setVerticalGuides(const QList< qreal > &lines)
Set the vertical guides.
void setLocked(const bool value)
Set guides lock status.
bool hasGuides() const
indicate if there's guides defined
void setVisible(const bool value)
Set guides visibility status.
QString lineType() const
Guides line type.
bool visible() const
Returns guides visibility status.
bool snap() const
Returns guide snap status.
void setHorizontalGuides(const QList< qreal > &lines)
Set the horizontal guides.
QList< qreal > verticalGuides() const
The vertical guides.
bool locked() const
Returns guide lock status.
void setSnap(const bool value)
Set guides snap status.
void setLineType(const QString &lineType)
Define guides lines type.
QDomElement documentElement() const const
ParseResult setContent(QAnyStringView text, ParseOptions options)
QString toString(int indent) const const
QDomNode appendChild(const QDomNode &newChild)