46 QString
stringType()
const override {
return QStringLiteral(
"LayoutSnapper" ); }
53 void setSnapTolerance(
int snapTolerance );
71 void setSnapToGrid(
bool enabled );
83 void setSnapToGuides(
bool enabled );
95 void setSnapToItems(
bool enabled );
113 QPointF snapPoint( QPointF point,
double scaleFactor,
bool &snapped
SIP_OUT, QGraphicsLineItem *horizontalSnapLine =
nullptr,
114 QGraphicsLineItem *verticalSnapLine =
nullptr,
115 const QList< QgsLayoutItem * > *ignoreItems =
nullptr )
const;
136 QRectF snapRect(
const QRectF &rect,
double scaleFactor,
bool &snapped
SIP_OUT, QGraphicsLineItem *horizontalSnapLine =
nullptr,
137 QGraphicsLineItem *verticalSnapLine =
nullptr,
138 const QList< QgsLayoutItem * > *ignoreItems =
nullptr )
const;
154 QPointF snapPointToGrid( QPointF point,
double scaleFactor,
bool &snappedX
SIP_OUT,
bool &snappedY
SIP_OUT )
const;
171 QPointF snapPointsToGrid(
const QList< QPointF > &points,
double scaleFactor,
bool &snappedX
SIP_OUT,
bool &snappedY
SIP_OUT )
const;
186 double snapPointToGuides(
double original, Qt::Orientation orientation,
double scaleFactor,
bool &snapped
SIP_OUT )
const;
203 double snapPointsToGuides(
const QList< double > &points, Qt::Orientation orientation,
double scaleFactor,
bool &snapped
SIP_OUT )
const;
223 double snapPointToItems(
double original, Qt::Orientation orientation,
double scaleFactor,
const QList< QgsLayoutItem * > &ignoreItems,
bool &snapped
SIP_OUT,
224 QGraphicsLineItem *snapLine =
nullptr )
const;
241 double snapPointsToItems(
const QList< double > &points, Qt::Orientation orientation,
double scaleFactor,
const QList< QgsLayoutItem * > &ignoreItems,
bool &snapped
SIP_OUT,
242 QGraphicsLineItem *snapLine =
nullptr )
const;
269 bool mSnapToGrid =
false;
270 bool mSnapToGuides =
true;
271 bool mSnapToItems =
true;
273 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.