QGIS API Documentation
3.24.2-Tisler (13c1a02865)
|
A graphical widget to display and interact with QgsLayouts. More...
#include <qgslayoutview.h>
Public Types | |
enum | ClipboardOperation { ClipboardCut , ClipboardCopy } |
Clipboard operations. More... | |
enum | PasteMode { PasteModeCursor , PasteModeCenter , PasteModeInPlace } |
Paste modes. More... | |
Public Slots | |
void | deleteItems (const QList< QgsLayoutItem * > &items) |
Delete the specified items. More... | |
void | deleteSelectedItems () |
Deletes all selected items. More... | |
void | deselectAll () |
Deselects all items in the view. More... | |
void | emitZoomLevelChanged () |
Emits the zoomLevelChanged() signal. More... | |
void | groupSelectedItems () |
Groups all selected items. More... | |
void | invertSelection () |
Inverts the current selection, selecting deselected items and deselecting and selected items. More... | |
void | lockSelectedItems () |
Locks any selected items, preventing them from being interacted with by mouse interactions. More... | |
void | lowerSelectedItems () |
Lowers the selected items down the z-order. More... | |
void | moveSelectedItemsToBottom () |
Lowers the selected items to the bottom of the z-order. More... | |
void | moveSelectedItemsToTop () |
Raises the selected items to the top of the z-order. More... | |
void | pushStatusMessage (const QString &message) |
Pushes a new status bar message to the view. More... | |
void | raiseSelectedItems () |
Raises the selected items up the z-order. More... | |
void | selectAll () |
Selects all items in the view. More... | |
void | selectNextItemAbove () |
Selects the next item above the existing selection, by item z order. More... | |
void | selectNextItemBelow () |
Selects the next item below the existing selection, by item z order. More... | |
void | ungroupSelectedItems () |
Ungroups all selected items. More... | |
void | unlockAllItems () |
Unlocks all locked items in the layout. More... | |
void | viewChanged () |
Updates associated rulers and other widgets after view extent or zoom has changed. More... | |
void | zoomActual () |
Zooms to the actual size of the layout. More... | |
void | zoomFull () |
Zooms the view to the full extent of the layout. More... | |
void | zoomIn () |
Zooms in to the view by a preset amount. More... | |
void | zoomOut () |
Zooms out of the view by a preset amount. More... | |
void | zoomWidth () |
Zooms the view to the full width of the layout. More... | |
Signals | |
void | cursorPosChanged (QPointF layoutPoint) |
Emitted when the mouse cursor coordinates change within the view. More... | |
void | itemFocused (QgsLayoutItem *item) |
Emitted when an item is "focused" in the view, i.e. More... | |
void | layoutSet (QgsLayout *layout) |
Emitted when a layout is set for the view. More... | |
void | pageChanged (int page) |
Emitted when the page visible in the view is changed. More... | |
void | statusMessage (const QString &message) |
Emitted when the view has a message for display in a parent window's status bar. More... | |
void | toolSet (QgsLayoutViewTool *tool) |
Emitted when the current tool is changed. More... | |
void | willBeDeleted () |
Emitted in the destructor when the view is about to be deleted, but is still in a perfectly valid state. More... | |
void | zoomLevelChanged () |
Emitted whenever the zoom level of the view is changed. More... | |
Public Member Functions | |
QgsLayoutView (QWidget *parent=nullptr) | |
Constructor for QgsLayoutView. More... | |
~QgsLayoutView () override | |
void | alignSelectedItems (QgsLayoutAligner::Alignment alignment) |
Aligns all selected items using the specified alignment. More... | |
void | copyItems (const QList< QgsLayoutItem * > &items, ClipboardOperation operation) |
Cuts or copies the a list of items, respecting the specified operation. More... | |
void | copySelectedItems (ClipboardOperation operation) |
Cuts or copies the selected items, respecting the specified operation. More... | |
QgsLayout * | currentLayout () |
Returns the current layout associated with the view. More... | |
const QgsLayout * | currentLayout () const |
Returns the current layout associated with the view. More... | |
int | currentPage () const |
Returns the page visible in the view. More... | |
QPointF | deltaForKeyEvent (QKeyEvent *event) |
Returns the delta (in layout coordinates) by which to move items for the given key event. More... | |
void | distributeSelectedItems (QgsLayoutAligner::Distribution distribution) |
Distributes all selected items using the specified distribution. More... | |
bool | hasItemsInClipboard () const |
Returns true if the current clipboard contains layout items. More... | |
QgsLayoutViewMenuProvider * | menuProvider () const |
Returns the provider for context menus. More... | |
QList< QgsLayoutItem * > | pasteItems (PasteMode mode) |
Pastes items from clipboard, using the specified mode. More... | |
QList< QgsLayoutItem * > | pasteItems (QPointF layoutPoint) |
Pastes items from clipboard, at the specified layoutPoint, in layout units. More... | |
QgsPreviewEffect::PreviewMode | previewMode () const |
Returns the preview mode which may be used to modify the view's appearance. More... | |
bool | previewModeEnabled () const |
Returns true if a preview effect is being used to alter the view's appearance. More... | |
void | resizeSelectedItems (QgsLayoutAligner::Resize resize) |
Resizes all selected items using the specified resize mode. More... | |
void | scaleSafe (double scale) |
Scales the view in a safe way, by limiting the acceptable range of the scale applied. More... | |
void | setCurrentLayout (QgsLayout *layout) |
Sets the current layout to edit in the view. More... | |
void | setHorizontalRuler (QgsLayoutRuler *ruler) |
Sets a horizontal ruler to synchronize with the view state. More... | |
void | setMenuProvider (QgsLayoutViewMenuProvider *provider) |
Sets a provider for context menus. More... | |
void | setPaintingEnabled (bool enabled) |
Sets whether widget repainting should be allowed for the view. More... | |
void | setPreviewMode (QgsPreviewEffect::PreviewMode mode) |
Sets the preview mode which should be used to modify the view's appearance. More... | |
void | setPreviewModeEnabled (bool enabled) |
Sets whether a preview effect should be used to alter the view's appearance. More... | |
void | setSectionLabel (const QString &label) |
Sets a section label, to display above the first page shown in the view. More... | |
void | setTool (QgsLayoutViewTool *tool) |
Sets the tool currently being used in the view. More... | |
void | setVerticalRuler (QgsLayoutRuler *ruler) |
Sets a vertical ruler to synchronize with the view state. More... | |
void | setZoomLevel (double level) |
Sets the zoom level for the view, where a zoom level of 1.0 corresponds to 100%. More... | |
QgsLayoutViewTool * | tool () |
Returns the currently active tool for the view. More... | |
void | unsetTool (QgsLayoutViewTool *tool) |
Unsets the current view tool, if it matches the specified tool. More... | |
QList< int > | visiblePageNumbers () const |
Returns a list of page numbers for pages which are currently visible in the view. More... | |
QList< QgsLayoutItemPage * > | visiblePages () const |
Returns a list of page items which are currently visible in the view. More... | |
Protected Member Functions | |
void | dragEnterEvent (QDragEnterEvent *e) override |
void | keyPressEvent (QKeyEvent *event) override |
void | keyReleaseEvent (QKeyEvent *event) override |
void | mouseDoubleClickEvent (QMouseEvent *event) override |
void | mouseMoveEvent (QMouseEvent *event) override |
void | mousePressEvent (QMouseEvent *event) override |
void | mouseReleaseEvent (QMouseEvent *event) override |
void | paintEvent (QPaintEvent *event) override |
void | resizeEvent (QResizeEvent *event) override |
void | scrollContentsBy (int dx, int dy) override |
void | showEvent (QShowEvent *event) override |
void | wheelEvent (QWheelEvent *event) override |
Properties | |
QgsLayout * | currentLayout |
QgsLayoutViewTool * | tool |
Friends | |
class | QgsLayoutMouseHandles |
class | TestQgsLayoutView |
A graphical widget to display and interact with QgsLayouts.
QgsLayoutView manages the layout interaction tools and mouse/key events.
Definition at line 49 of file qgslayoutview.h.
Clipboard operations.
Enumerator | |
---|---|
ClipboardCut | Cut items. |
ClipboardCopy | Copy items. |
Definition at line 69 of file qgslayoutview.h.
Paste modes.
Enumerator | |
---|---|
PasteModeCursor | Paste items at cursor position. |
PasteModeCenter | Paste items in center of view. |
PasteModeInPlace | Paste items in place. |
Definition at line 76 of file qgslayoutview.h.
QgsLayoutView::QgsLayoutView | ( | QWidget * | parent = nullptr | ) |
Constructor for QgsLayoutView.
Definition at line 50 of file qgslayoutview.cpp.
|
override |
Definition at line 73 of file qgslayoutview.cpp.
void QgsLayoutView::alignSelectedItems | ( | QgsLayoutAligner::Alignment | alignment | ) |
Aligns all selected items using the specified alignment.
Definition at line 285 of file qgslayoutview.cpp.
void QgsLayoutView::copyItems | ( | const QList< QgsLayoutItem * > & | items, |
QgsLayoutView::ClipboardOperation | operation | ||
) |
Cuts or copies the a list of items, respecting the specified operation.
Definition at line 317 of file qgslayoutview.cpp.
void QgsLayoutView::copySelectedItems | ( | QgsLayoutView::ClipboardOperation | operation | ) |
Cuts or copies the selected items, respecting the specified operation.
Definition at line 312 of file qgslayoutview.cpp.
QgsLayout* QgsLayoutView::currentLayout | ( | ) |
Returns the current layout associated with the view.
const QgsLayout * QgsLayoutView::currentLayout | ( | ) | const |
Returns the current layout associated with the view.
Definition at line 83 of file qgslayoutview.cpp.
|
inline |
Returns the page visible in the view.
This method considers the page at the center of the view as the current visible page.
Definition at line 203 of file qgslayoutview.h.
|
signal |
Emitted when the mouse cursor coordinates change within the view.
The layoutPoint argument indicates the cursor position within the layout coordinate system.
|
slot |
Delete the specified items.
Definition at line 858 of file qgslayoutview.cpp.
|
slot |
QPointF QgsLayoutView::deltaForKeyEvent | ( | QKeyEvent * | event | ) |
Returns the delta (in layout coordinates) by which to move items for the given key event.
Definition at line 474 of file qgslayoutview.cpp.
|
slot |
Deselects all items in the view.
Definition at line 625 of file qgslayoutview.cpp.
void QgsLayoutView::distributeSelectedItems | ( | QgsLayoutAligner::Distribution | distribution | ) |
Distributes all selected items using the specified distribution.
Definition at line 294 of file qgslayoutview.cpp.
|
overrideprotected |
Definition at line 1137 of file qgslayoutview.cpp.
|
slot |
Emits the zoomLevelChanged() signal.
This should be called after calling any of the QGraphicsView base class methods which alter the view's zoom level, i.e. QGraphicsView::fitInView().
Definition at line 588 of file qgslayoutview.cpp.
|
slot |
Groups all selected items.
Definition at line 876 of file qgslayoutview.cpp.
bool QgsLayoutView::hasItemsInClipboard | ( | ) | const |
Returns true
if the current clipboard contains layout items.
Definition at line 461 of file qgslayoutview.cpp.
|
slot |
Inverts the current selection, selecting deselected items and deselecting and selected items.
Definition at line 635 of file qgslayoutview.cpp.
|
signal |
Emitted when an item is "focused" in the view, i.e.
it becomes the active item and should have its properties displayed in any designer windows.
|
overrideprotected |
Definition at line 1061 of file qgslayoutview.cpp.
|
overrideprotected |
Definition at line 1110 of file qgslayoutview.cpp.
|
signal |
Emitted when a layout is set for the view.
|
slot |
Locks any selected items, preventing them from being interacted with by mouse interactions.
Definition at line 804 of file qgslayoutview.cpp.
|
slot |
Lowers the selected items down the z-order.
Definition at line 735 of file qgslayoutview.cpp.
QgsLayoutViewMenuProvider * QgsLayoutView::menuProvider | ( | ) | const |
Returns the provider for context menus.
Returned value may be nullptr
if no provider is set.
Definition at line 258 of file qgslayoutview.cpp.
|
overrideprotected |
Definition at line 1028 of file qgslayoutview.cpp.
|
overrideprotected |
Definition at line 985 of file qgslayoutview.cpp.
|
overrideprotected |
Definition at line 930 of file qgslayoutview.cpp.
|
overrideprotected |
Definition at line 969 of file qgslayoutview.cpp.
|
slot |
Lowers the selected items to the bottom of the z-order.
Definition at line 781 of file qgslayoutview.cpp.
|
slot |
Raises the selected items to the top of the z-order.
Definition at line 758 of file qgslayoutview.cpp.
|
signal |
Emitted when the page visible in the view is changed.
This signal considers the page at the center of the view as the current visible page.
|
overrideprotected |
Definition at line 1145 of file qgslayoutview.cpp.
QList< QgsLayoutItem * > QgsLayoutView::pasteItems | ( | QgsLayoutView::PasteMode | mode | ) |
Pastes items from clipboard, using the specified mode.
A list of pasted items is returned.
Definition at line 397 of file qgslayoutview.cpp.
QList< QgsLayoutItem * > QgsLayoutView::pasteItems | ( | QPointF | layoutPoint | ) |
Pastes items from clipboard, at the specified layoutPoint, in layout units.
A list of pasted items is returned.
Definition at line 438 of file qgslayoutview.cpp.
QgsPreviewEffect::PreviewMode QgsLayoutView::previewMode | ( | ) | const |
Returns the preview mode which may be used to modify the view's appearance.
Preview modes are only used if previewModeEnabled() is true
.
Definition at line 185 of file qgslayoutview.cpp.
bool QgsLayoutView::previewModeEnabled | ( | ) | const |
Returns true
if a preview effect is being used to alter the view's appearance.
Definition at line 175 of file qgslayoutview.cpp.
|
slot |
Pushes a new status bar message to the view.
This causes statusMessage() to be emitted, which should cause the message to appear in the status bar for the parent window.
Definition at line 1225 of file qgslayoutview.cpp.
|
slot |
Raises the selected items up the z-order.
Definition at line 712 of file qgslayoutview.cpp.
|
overrideprotected |
Definition at line 1124 of file qgslayoutview.cpp.
void QgsLayoutView::resizeSelectedItems | ( | QgsLayoutAligner::Resize | resize | ) |
Resizes all selected items using the specified resize mode.
Definition at line 303 of file qgslayoutview.cpp.
void QgsLayoutView::scaleSafe | ( | double | scale | ) |
Scales the view in a safe way, by limiting the acceptable range of the scale applied.
The scale parameter specifies the zoom factor to scale the view by.
Definition at line 190 of file qgslayoutview.cpp.
|
overrideprotected |
Definition at line 1131 of file qgslayoutview.cpp.
|
slot |
Selects all items in the view.
Definition at line 593 of file qgslayoutview.cpp.
|
slot |
Selects the next item above the existing selection, by item z order.
Definition at line 702 of file qgslayoutview.cpp.
|
slot |
Selects the next item below the existing selection, by item z order.
Definition at line 707 of file qgslayoutview.cpp.
void QgsLayoutView::setCurrentLayout | ( | QgsLayout * | layout | ) |
Sets the current layout to edit in the view.
Definition at line 88 of file qgslayoutview.cpp.
void QgsLayoutView::setHorizontalRuler | ( | QgsLayoutRuler * | ruler | ) |
Sets a horizontal ruler to synchronize with the view state.
Definition at line 225 of file qgslayoutview.cpp.
void QgsLayoutView::setMenuProvider | ( | QgsLayoutViewMenuProvider * | provider | ) |
Sets a provider for context menus.
Ownership of the provider is transferred to the view.
Definition at line 253 of file qgslayoutview.cpp.
void QgsLayoutView::setPaintingEnabled | ( | bool | enabled | ) |
Sets whether widget repainting should be allowed for the view.
This is used to temporarily halt painting while exporting layouts.
Definition at line 516 of file qgslayoutview.cpp.
void QgsLayoutView::setPreviewMode | ( | QgsPreviewEffect::PreviewMode | mode | ) |
Sets the preview mode which should be used to modify the view's appearance.
Preview modes are only used if previewModeEnabled() is true
.
Definition at line 180 of file qgslayoutview.cpp.
void QgsLayoutView::setPreviewModeEnabled | ( | bool | enabled | ) |
Sets whether a preview effect should be used to alter the view's appearance.
enabled | Set to true to enable the preview effect on the view. |
Definition at line 170 of file qgslayoutview.cpp.
void QgsLayoutView::setSectionLabel | ( | const QString & | label | ) |
Sets a section label, to display above the first page shown in the view.
Definition at line 523 of file qgslayoutview.cpp.
void QgsLayoutView::setTool | ( | QgsLayoutViewTool * | tool | ) |
Sets the tool currently being used in the view.
Definition at line 134 of file qgslayoutview.cpp.
void QgsLayoutView::setVerticalRuler | ( | QgsLayoutRuler * | ruler | ) |
Sets a vertical ruler to synchronize with the view state.
Definition at line 239 of file qgslayoutview.cpp.
void QgsLayoutView::setZoomLevel | ( | double | level | ) |
Sets the zoom level for the view, where a zoom level of 1.0 corresponds to 100%.
Definition at line 200 of file qgslayoutview.cpp.
|
overrideprotected |
Definition at line 1158 of file qgslayoutview.cpp.
|
signal |
Emitted when the view has a message for display in a parent window's status bar.
QgsLayoutViewTool* QgsLayoutView::tool | ( | ) |
Returns the currently active tool for the view.
|
signal |
Emitted when the current tool is changed.
|
slot |
Ungroups all selected items.
Definition at line 901 of file qgslayoutview.cpp.
|
slot |
Unlocks all locked items in the layout.
Definition at line 820 of file qgslayoutview.cpp.
void QgsLayoutView::unsetTool | ( | QgsLayoutViewTool * | tool | ) |
Unsets the current view tool, if it matches the specified tool.
This is called from destructor of view tools to make sure that the tool won't be used any more. You don't have to call it manually, QgsLayoutViewTool takes care of it.
Definition at line 160 of file qgslayoutview.cpp.
|
slot |
Updates associated rulers and other widgets after view extent or zoom has changed.
This should be called after calling any of the QGraphicsView base class methods which alter the view's zoom level or extent, i.e. QGraphicsView::fitInView().
Definition at line 1198 of file qgslayoutview.cpp.
QList< int > QgsLayoutView::visiblePageNumbers | ( | ) | const |
Returns a list of page numbers for pages which are currently visible in the view.
Definition at line 274 of file qgslayoutview.cpp.
QList< QgsLayoutItemPage * > QgsLayoutView::visiblePages | ( | ) | const |
Returns a list of page items which are currently visible in the view.
Definition at line 263 of file qgslayoutview.cpp.
|
overrideprotected |
Definition at line 1044 of file qgslayoutview.cpp.
|
signal |
Emitted in the destructor when the view is about to be deleted, but is still in a perfectly valid state.
|
slot |
Zooms to the actual size of the layout.
Definition at line 583 of file qgslayoutview.cpp.
|
slot |
Zooms the view to the full extent of the layout.
Definition at line 538 of file qgslayoutview.cpp.
|
slot |
Zooms in to the view by a preset amount.
Definition at line 573 of file qgslayoutview.cpp.
|
signal |
Emitted whenever the zoom level of the view is changed.
|
slot |
Zooms out of the view by a preset amount.
Definition at line 578 of file qgslayoutview.cpp.
|
slot |
Zooms the view to the full width of the layout.
Definition at line 548 of file qgslayoutview.cpp.
|
friend |
Definition at line 587 of file qgslayoutview.h.
|
friend |
Definition at line 586 of file qgslayoutview.h.
|
readwrite |
Definition at line 1 of file qgslayoutview.h.
|
readwrite |
Definition at line 1 of file qgslayoutview.h.