17 #ifndef QGSLAYOUTVIEW_H
18 #define QGSLAYOUTVIEW_H
27 #include <QGraphicsView>
28 #include <QGraphicsRectItem>
38 class QgsLayoutViewSnapMarker;
39 class QgsLayoutReportSectionLabel;
54 if ( qobject_cast<QgsLayoutView *>( sipCpp ) )
55 sipType = sipType_QgsLayoutView;
63 Q_PROPERTY(
QgsLayout *currentLayout READ currentLayout WRITE setCurrentLayout NOTIFY layoutSet )
138 void setPreviewModeEnabled(
bool enabled );
144 bool previewModeEnabled()
const;
166 void scaleSafe(
double scale );
171 void setZoomLevel(
double level );
209 QList< QgsLayoutItemPage * > visiblePages()
const;
215 QList< int > visiblePageNumbers()
const;
243 void copySelectedItems( ClipboardOperation operation );
250 void copyItems(
const QList< QgsLayoutItem * > &items, ClipboardOperation operation );
260 QList< QgsLayoutItem * > pasteItems( PasteMode mode );
271 QList< QgsLayoutItem * > pasteItems( QPointF layoutPoint );
277 bool hasItemsInClipboard()
const;
283 QPointF deltaForKeyEvent( QKeyEvent *event );
290 void setPaintingEnabled(
bool enabled );
SIP_SKIP
296 void setSectionLabel(
const QString &label );
349 void emitZoomLevelChanged();
378 void invertSelection();
386 void selectNextItemAbove();
394 void selectNextItemBelow();
402 void raiseSelectedItems();
410 void lowerSelectedItems();
418 void moveSelectedItemsToTop();
426 void moveSelectedItemsToBottom();
433 void lockSelectedItems();
439 void unlockAllItems();
445 void deleteSelectedItems();
451 void deleteItems(
const QList< QgsLayoutItem * > &items );
457 void groupSelectedItems();
463 void ungroupSelectedItems();
479 void pushStatusMessage(
const QString &message );
536 void mousePressEvent( QMouseEvent *event )
override;
537 void mouseReleaseEvent( QMouseEvent *event )
override;
538 void mouseMoveEvent( QMouseEvent *event )
override;
539 void mouseDoubleClickEvent( QMouseEvent *event )
override;
540 void wheelEvent( QWheelEvent *event )
override;
541 void keyPressEvent( QKeyEvent *event )
override;
542 void keyReleaseEvent( QKeyEvent *event )
override;
543 void resizeEvent( QResizeEvent *event )
override;
544 void scrollContentsBy(
int dx,
int dy )
override;
545 void dragEnterEvent( QDragEnterEvent *e )
override;
546 void paintEvent( QPaintEvent *event )
override;
547 void showEvent( QShowEvent *event )
override;
551 void invalidateCachedRenders();
552 void updateDevicePixelFromScreen();
557 void wheelZoom( QWheelEvent *event );
559 QPointer< QgsLayoutViewTool > mTool;
565 QPoint mMouseCurrentXY;
569 std::unique_ptr< QgsLayoutViewMenuProvider > mMenuProvider;
571 QgsLayoutViewSnapMarker *mSnapMarker =
nullptr;
572 QgsLayoutReportSectionLabel *mSectionLabel =
nullptr;
574 QGraphicsLineItem *mHorizontalSnapLine =
nullptr;
575 QGraphicsLineItem *mVerticalSnapLine =
nullptr;
577 int mCurrentPage = 0;
581 bool mPaintingEnabled =
true;
583 double mScreenDpi = 96.0;
584 QMetaObject::Connection mScreenDpiChangedConnection;
586 friend class TestQgsLayoutView;
587 friend class QgsLayoutMouseHandles;
589 QGraphicsLineItem *createSnapLine()
const;
622 class GUI_EXPORT QgsLayoutViewSnapMarker :
public QGraphicsRectItem
626 QgsLayoutViewSnapMarker();
628 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget =
nullptr )
override;
Alignment
Alignment options.
Distribution
Distribution options.
Base class for graphical items within a QgsLayout.
A custom ruler widget for use with QgsLayoutView, displaying the current zoom and position of the vis...
A graphical widget to display and interact with QgsLayouts.
void cursorPosChanged(QPointF layoutPoint)
Emitted when the mouse cursor coordinates change within the view.
@ PasteModeCenter
Paste items in center of view.
@ PasteModeInPlace
Paste items in place.
@ PasteModeCursor
Paste items at cursor position.
QgsLayout * currentLayout()
Returns the current layout associated with the view.
void zoomLevelChanged()
Emitted whenever the zoom level of the view is changed.
void willBeDeleted()
Emitted in the destructor when the view is about to be deleted, but is still in a perfectly valid sta...
void statusMessage(const QString &message)
Emitted when the view has a message for display in a parent window's status bar.
void itemFocused(QgsLayoutItem *item)
Emitted when an item is "focused" in the view, i.e.
void layoutSet(QgsLayout *layout)
Emitted when a layout is set for the view.
int currentPage() const
Returns the page visible in the view.
ClipboardOperation
Clipboard operations.
@ ClipboardCopy
Copy items.
QgsLayoutViewTool * tool()
Returns the currently active tool for the view.
void toolSet(QgsLayoutViewTool *tool)
Emitted when the current tool is changed.
void pageChanged(int page)
Emitted when the page visible in the view is changed.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
A graphics effect which can be applied to a widget to simulate various printing and color blindness m...
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
#define SIP_KEEPREFERENCE