16 #ifndef QGSLAYOUTSNAPPER_H
17 #define QGSLAYOUTSNAPPER_H
19 #include "qgis_core.h"
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;
277 #endif //QGSLAYOUTSNAPPER_H