File: qgslayoutview.sip.in

package info (click to toggle)
qgis 3.22.16%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,186,020 kB
  • sloc: cpp: 1,275,562; python: 194,091; xml: 15,597; perl: 3,471; sh: 3,368; sql: 2,485; ansic: 2,219; yacc: 1,056; lex: 574; javascript: 504; lisp: 411; makefile: 227
file content (622 lines) | stat: -rw-r--r-- 15,033 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/layout/qgslayoutview.h                                       *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 ************************************************************************/




class QgsLayoutView: QGraphicsView
{
%Docstring(signature="appended")
A graphical widget to display and interact with :py:class:`QgsLayouts`.

:py:class:`QgsLayoutView` manages the layout interaction tools and mouse/key events.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgslayoutview.h"
%End
%ConvertToSubClassCode
    if ( qobject_cast<QgsLayoutView *>( sipCpp ) )
      sipType = sipType_QgsLayoutView;
    else
      sipType = NULL;
%End
  public:

    enum ClipboardOperation
    {
      ClipboardCut,
      ClipboardCopy,
    };

    enum PasteMode
    {
      PasteModeCursor,
      PasteModeCenter,
      PasteModeInPlace,
    };

    QgsLayoutView( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsLayoutView.
%End

    ~QgsLayoutView();

    QgsLayout *currentLayout();
%Docstring
Returns the current layout associated with the view.

.. seealso:: :py:func:`setCurrentLayout`

.. seealso:: :py:func:`layoutSet`
%End


    void setCurrentLayout( QgsLayout *layout /KeepReference/ );
%Docstring
Sets the current ``layout`` to edit in the view.

.. seealso:: :py:func:`currentLayout`

.. seealso:: :py:func:`layoutSet`
%End

    QgsLayoutViewTool *tool();
%Docstring
Returns the currently active tool for the view.

.. seealso:: :py:func:`setTool`
%End

    void setTool( QgsLayoutViewTool *tool );
%Docstring
Sets the ``tool`` currently being used in the view.

.. seealso:: :py:func:`unsetTool`

.. seealso:: :py:func:`tool`
%End

    void unsetTool( QgsLayoutViewTool *tool );
%Docstring
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, :py:class:`QgsLayoutViewTool` takes care of it.
%End

    void setPreviewModeEnabled( bool enabled );
%Docstring
Sets whether a preview effect should be used to alter the view's appearance.

:param enabled: Set to ``True`` to enable the preview effect on the view.

.. seealso:: :py:func:`setPreviewMode`
%End

    bool previewModeEnabled() const;
%Docstring
Returns ``True`` if a preview effect is being used to alter the view's appearance.

.. seealso:: :py:func:`setPreviewModeEnabled`
%End

    void setPreviewMode( QgsPreviewEffect::PreviewMode mode );
%Docstring
Sets the preview ``mode`` which should be used to modify the view's appearance. Preview modes are only used
if :py:func:`~QgsLayoutView.previewModeEnabled` is ``True``.

.. seealso:: :py:func:`setPreviewModeEnabled`

.. seealso:: :py:func:`previewMode`
%End

    QgsPreviewEffect::PreviewMode previewMode() const;
%Docstring
Returns the preview mode which may be used to modify the view's appearance. Preview modes are only used
if :py:func:`~QgsLayoutView.previewModeEnabled` is ``True``.

.. seealso:: :py:func:`setPreviewMode`

.. seealso:: :py:func:`previewModeEnabled`
%End

    void scaleSafe( double scale );
%Docstring
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.
%End

    void setZoomLevel( double level );
%Docstring
Sets the zoom ``level`` for the view, where a zoom level of 1.0 corresponds to 100%.
%End

    void setHorizontalRuler( QgsLayoutRuler *ruler );
%Docstring
Sets a horizontal ``ruler`` to synchronize with the view state.

.. seealso:: :py:func:`setVerticalRuler`
%End

    void setVerticalRuler( QgsLayoutRuler *ruler );
%Docstring
Sets a vertical ``ruler`` to synchronize with the view state.

.. seealso:: :py:func:`setHorizontalRuler`
%End

    void setMenuProvider( QgsLayoutViewMenuProvider *provider /Transfer/ );
%Docstring
Sets a ``provider`` for context menus. Ownership of the provider is transferred to the view.

.. seealso:: :py:func:`menuProvider`
%End

    QgsLayoutViewMenuProvider *menuProvider() const;
%Docstring
Returns the provider for context menus. Returned value may be ``None`` if no provider is set.

.. seealso:: :py:func:`setMenuProvider`
%End

    int currentPage() const;
%Docstring
Returns the page visible in the view. This method
considers the page at the center of the view as the current visible
page.

.. seealso:: :py:func:`pageChanged`
%End

    QList< QgsLayoutItemPage * > visiblePages() const;
%Docstring
Returns a list of page items which are currently visible in the view.

.. seealso:: :py:func:`visiblePageNumbers`
%End

    QList< int > visiblePageNumbers() const;
%Docstring
Returns a list of page numbers for pages which are currently visible in the view.

.. seealso:: :py:func:`visiblePages`
%End

    void alignSelectedItems( QgsLayoutAligner::Alignment alignment );
%Docstring
Aligns all selected items using the specified ``alignment``.

.. seealso:: :py:func:`distributeSelectedItems`

.. seealso:: :py:func:`resizeSelectedItems`
%End

    void distributeSelectedItems( QgsLayoutAligner::Distribution distribution );
%Docstring
Distributes all selected items using the specified ``distribution``.

.. seealso:: :py:func:`alignSelectedItems`

.. seealso:: :py:func:`resizeSelectedItems`
%End

    void resizeSelectedItems( QgsLayoutAligner::Resize resize );
%Docstring
Resizes all selected items using the specified ``resize`` mode.

.. seealso:: :py:func:`alignSelectedItems`

.. seealso:: :py:func:`distributeSelectedItems`
%End

    void copySelectedItems( ClipboardOperation operation );
%Docstring
Cuts or copies the selected items, respecting the specified ``operation``.

.. seealso:: :py:func:`copyItems`

.. seealso:: :py:func:`pasteItems`
%End

    void copyItems( const QList< QgsLayoutItem * > &items, ClipboardOperation operation );
%Docstring
Cuts or copies the a list of ``items``, respecting the specified ``operation``.

.. seealso:: :py:func:`copySelectedItems`

.. seealso:: :py:func:`pasteItems`
%End

    QList< QgsLayoutItem * > pasteItems( PasteMode mode );
%Docstring
Pastes items from clipboard, using the specified ``mode``.

A list of pasted items is returned.

.. seealso:: :py:func:`copySelectedItems`

.. seealso:: :py:func:`hasItemsInClipboard`
%End

    QList< QgsLayoutItem * > pasteItems( QPointF layoutPoint );
%Docstring
Pastes items from clipboard, at the specified ``layoutPoint``,
in layout units.

A list of pasted items is returned.

.. seealso:: :py:func:`copySelectedItems`

.. seealso:: :py:func:`hasItemsInClipboard`
%End

    bool hasItemsInClipboard() const;
%Docstring
Returns ``True`` if the current clipboard contains layout items.

.. seealso:: :py:func:`pasteItems`
%End

    QPointF deltaForKeyEvent( QKeyEvent *event );
%Docstring
Returns the delta (in layout coordinates) by which to move items
for the given key ``event``.
%End

    void setSectionLabel( const QString &label );
%Docstring
Sets a section ``label``, to display above the first page shown in the
view.
%End

  public slots:

    void zoomFull();
%Docstring
Zooms the view to the full extent of the layout.

.. seealso:: :py:func:`zoomIn`

.. seealso:: :py:func:`zoomOut`

.. seealso:: :py:func:`zoomActual`
%End

    void zoomWidth();
%Docstring
Zooms the view to the full width of the layout.

.. seealso:: :py:func:`zoomIn`

.. seealso:: :py:func:`zoomOut`

.. seealso:: :py:func:`zoomActual`
%End

    void zoomIn();
%Docstring
Zooms in to the view by a preset amount.

.. seealso:: :py:func:`zoomFull`

.. seealso:: :py:func:`zoomOut`

.. seealso:: :py:func:`zoomActual`
%End

    void zoomOut();
%Docstring
Zooms out of the view by a preset amount.

.. seealso:: :py:func:`zoomFull`

.. seealso:: :py:func:`zoomIn`

.. seealso:: :py:func:`zoomActual`
%End

    void zoomActual();
%Docstring
Zooms to the actual size of the layout.

.. seealso:: :py:func:`zoomFull`

.. seealso:: :py:func:`zoomIn`

.. seealso:: :py:func:`zoomOut`
%End

    void emitZoomLevelChanged();


    void selectAll();
%Docstring
Selects all items in the view.

.. seealso:: :py:func:`deselectAll`

.. seealso:: :py:func:`invertSelection`

.. seealso:: :py:func:`selectNextItemAbove`

.. seealso:: :py:func:`selectNextItemBelow`
%End

    void deselectAll();
%Docstring
Deselects all items in the view.

.. seealso:: :py:func:`selectAll`

.. seealso:: :py:func:`invertSelection`
%End

    void invertSelection();
%Docstring
Inverts the current selection, selecting deselected items
and deselecting and selected items.

.. seealso:: :py:func:`selectAll`

.. seealso:: :py:func:`deselectAll`
%End

    void selectNextItemAbove();
%Docstring
Selects the next item above the existing selection, by item z order.

.. seealso:: :py:func:`selectNextItemBelow`

.. seealso:: :py:func:`selectAll`

.. seealso:: :py:func:`deselectAll`
%End

    void selectNextItemBelow();
%Docstring
Selects the next item below the existing selection, by item z order.

.. seealso:: :py:func:`selectNextItemAbove`

.. seealso:: :py:func:`selectAll`

.. seealso:: :py:func:`deselectAll`
%End

    void raiseSelectedItems();
%Docstring
Raises the selected items up the z-order.

.. seealso:: :py:func:`lowerSelectedItems`

.. seealso:: :py:func:`moveSelectedItemsToTop`

.. seealso:: :py:func:`moveSelectedItemsToBottom`
%End

    void lowerSelectedItems();
%Docstring
Lowers the selected items down the z-order.

.. seealso:: :py:func:`raiseSelectedItems`

.. seealso:: :py:func:`moveSelectedItemsToTop`

.. seealso:: :py:func:`moveSelectedItemsToBottom`
%End

    void moveSelectedItemsToTop();
%Docstring
Raises the selected items to the top of the z-order.

.. seealso:: :py:func:`raiseSelectedItems`

.. seealso:: :py:func:`lowerSelectedItems`

.. seealso:: :py:func:`moveSelectedItemsToBottom`
%End

    void moveSelectedItemsToBottom();
%Docstring
Lowers the selected items to the bottom of the z-order.

.. seealso:: :py:func:`raiseSelectedItems`

.. seealso:: :py:func:`lowerSelectedItems`

.. seealso:: :py:func:`moveSelectedItemsToTop`
%End

    void lockSelectedItems();
%Docstring
Locks any selected items, preventing them from being interacted with
by mouse interactions.

.. seealso:: :py:func:`unlockAllItems`
%End

    void unlockAllItems();
%Docstring
Unlocks all locked items in the layout.

.. seealso:: :py:func:`lockSelectedItems`
%End

    void deleteSelectedItems();
%Docstring
Deletes all selected items.

.. seealso:: :py:func:`deleteItems`
%End

    void deleteItems( const QList< QgsLayoutItem * > &items );
%Docstring
Delete the specified ``items``.

.. seealso:: :py:func:`deleteSelectedItems`
%End

    void groupSelectedItems();
%Docstring
Groups all selected items.

.. seealso:: :py:func:`ungroupSelectedItems`
%End

    void ungroupSelectedItems();
%Docstring
Ungroups all selected items.

.. seealso:: :py:func:`groupSelectedItems`
%End

    void viewChanged();
%Docstring
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().
%End

    void pushStatusMessage( const QString &message );
%Docstring
Pushes a new status bar ``message`` to the view. This causes :py:func:`~QgsLayoutView.statusMessage`
to be emitted, which should cause the message to appear in the status bar
for the parent window.

.. seealso:: :py:func:`statusMessage`
%End

  signals:

    void layoutSet( QgsLayout *layout );
%Docstring
Emitted when a ``layout`` is set for the view.

.. seealso:: :py:func:`currentLayout`

.. seealso:: :py:func:`setCurrentLayout`
%End

    void toolSet( QgsLayoutViewTool *tool );
%Docstring
Emitted when the current ``tool`` is changed.

.. seealso:: :py:func:`setTool`
%End

    void zoomLevelChanged();
%Docstring
Emitted whenever the zoom level of the view is changed.
%End

    void cursorPosChanged( QPointF layoutPoint );
%Docstring
Emitted when the mouse cursor coordinates change within the view.
The ``layoutPoint`` argument indicates the cursor position within
the layout coordinate system.
%End

    void pageChanged( int page );
%Docstring
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.

.. seealso:: :py:func:`currentPage`
%End

    void statusMessage( const QString &message );
%Docstring
Emitted when the view has a ``message`` for display in a parent window's
status bar.

.. seealso:: :py:func:`pushStatusMessage`
%End

    void itemFocused( QgsLayoutItem *item );
%Docstring
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.
%End

    void willBeDeleted();
%Docstring
Emitted in the destructor when the view is about to be deleted,
but is still in a perfectly valid state.
%End

  protected:
    virtual void mousePressEvent( QMouseEvent *event );

    virtual void mouseReleaseEvent( QMouseEvent *event );

    virtual void mouseMoveEvent( QMouseEvent *event );

    virtual void mouseDoubleClickEvent( QMouseEvent *event );

    virtual void wheelEvent( QWheelEvent *event );

    virtual void keyPressEvent( QKeyEvent *event );

    virtual void keyReleaseEvent( QKeyEvent *event );

    virtual void resizeEvent( QResizeEvent *event );

    virtual void scrollContentsBy( int dx, int dy );

    virtual void dragEnterEvent( QDragEnterEvent *e );

    virtual void paintEvent( QPaintEvent *event );

    virtual void showEvent( QShowEvent *event );


};


class QgsLayoutViewMenuProvider
{
%Docstring(signature="appended")

Interface for a QgsLayoutView context menu.

Implementations of this interface can be made to allow QgsLayoutView
instances to provide custom context menus (opened upon right-click).

.. seealso:: :py:class:`QgsLayoutView`

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgslayoutview.h"
%End
  public:
    virtual ~QgsLayoutViewMenuProvider();

    virtual QMenu *createContextMenu( QWidget *parent /Transfer/, QgsLayout *layout, QPointF layoutPoint ) const = 0 /Factory/;
%Docstring
Returns a newly created menu instance (or ``None`` on error)
%End
};



/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/layout/qgslayoutview.h                                       *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 ************************************************************************/