45 QString
stringType()
const override {
return QStringLiteral(
"LayoutSnapper" ); }
52 void setSnapTolerance(
int snapTolerance );
70 void setSnapToGrid(
bool enabled );
82 void setSnapToGuides(
bool enabled );
94 void setSnapToItems(
bool enabled );
112 QPointF snapPoint( QPointF point,
double scaleFactor,
bool &snapped
SIP_OUT, QGraphicsLineItem *horizontalSnapLine =
nullptr,
113 QGraphicsLineItem *verticalSnapLine =
nullptr,
114 const QList< QgsLayoutItem * > *ignoreItems =
nullptr )
const;
135 QRectF snapRect(
const QRectF &rect,
double scaleFactor,
bool &snapped
SIP_OUT, QGraphicsLineItem *horizontalSnapLine =
nullptr,
136 QGraphicsLineItem *verticalSnapLine =
nullptr,
137 const QList< QgsLayoutItem * > *ignoreItems =
nullptr )
const;
153 QPointF snapPointToGrid( QPointF point,
double scaleFactor,
bool &snappedX
SIP_OUT,
bool &snappedY
SIP_OUT )
const;
170 QPointF snapPointsToGrid(
const QList< QPointF > &points,
double scaleFactor,
bool &snappedX
SIP_OUT,
bool &snappedY
SIP_OUT )
const;
185 double snapPointToGuides(
double original, Qt::Orientation orientation,
double scaleFactor,
bool &snapped
SIP_OUT )
const;
202 double snapPointsToGuides(
const QList< double > &points, Qt::Orientation orientation,
double scaleFactor,
bool &snapped
SIP_OUT )
const;
222 double snapPointToItems(
double original, Qt::Orientation orientation,
double scaleFactor,
const QList< QgsLayoutItem * > &ignoreItems,
bool &snapped
SIP_OUT,
223 QGraphicsLineItem *snapLine =
nullptr )
const;
240 double snapPointsToItems(
const QList< double > &points, Qt::Orientation orientation,
double scaleFactor,
const QList< QgsLayoutItem * > &ignoreItems,
bool &snapped
SIP_OUT,
241 QGraphicsLineItem *snapLine =
nullptr )
const;
268 bool mSnapToGrid =
false;
269 bool mSnapToGuides =
true;
270 bool mSnapToItems =
true;
272 friend class QgsLayoutSnapperUndoCommand;
virtual bool writeXml(QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const =0
Stores the objects's state in a DOM element.
virtual bool readXml(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)=0
Sets the objects's state from a DOM element.
The class is used as a container of context for various read/write operations on other objects.