Skip to content
Permalink
Browse files

Port method for pausing layout view updates

  • Loading branch information
nyalldawson committed Dec 11, 2017
1 parent 1b8f4a0 commit 113664fe2e3b579365cb5cf08da3964035fd6405
Showing with 26 additions and 0 deletions.
  1. +3 −0 python/gui/layout/qgslayoutview.sip
  2. +13 −0 src/gui/layout/qgslayoutview.cpp
  3. +10 −0 src/gui/layout/qgslayoutview.h
@@ -265,6 +265,7 @@ Returns the delta (in layout coordinates) by which to move items
for the given key ``event``.
%End


public slots:

void zoomFull();
@@ -557,6 +558,8 @@ item and should have its properties displayed in any designer windows.

virtual void dragEnterEvent( QDragEnterEvent *e );

virtual void paintEvent( QPaintEvent *event );


};

@@ -1002,6 +1002,19 @@ void QgsLayoutView::dragEnterEvent( QDragEnterEvent *e )
e->ignore();
}

void QgsLayoutView::paintEvent( QPaintEvent *event )
{
if ( mPaintingEnabled )
{
QGraphicsView::paintEvent( event );
event->accept();
}
else
{
event->ignore();
}
}

void QgsLayoutView::invalidateCachedRenders()
{
if ( !currentLayout() )
@@ -270,6 +270,13 @@ class GUI_EXPORT QgsLayoutView: public QGraphicsView
*/
QPointF deltaForKeyEvent( QKeyEvent *event );

/**
* Sets whether widget repainting should be allowed for the view. This is
* used to temporarily halt painting while exporting layouts.
* \note Not available in Python bindings.
*/
void setPaintingEnabled( bool enabled ) { mPaintingEnabled = enabled; } SIP_SKIP

public slots:

/**
@@ -512,6 +519,7 @@ class GUI_EXPORT QgsLayoutView: public QGraphicsView
void resizeEvent( QResizeEvent *event ) override;
void scrollContentsBy( int dx, int dy ) override;
void dragEnterEvent( QDragEnterEvent *e ) override;
void paintEvent( QPaintEvent *event ) override;

private slots:

@@ -543,6 +551,8 @@ class GUI_EXPORT QgsLayoutView: public QGraphicsView

QgsPreviewEffect *mPreviewEffect = nullptr;

bool mPaintingEnabled = true;

friend class TestQgsLayoutView;
friend class QgsLayoutMouseHandles;

0 comments on commit 113664f

Please sign in to comment.
You can’t perform that action at this time.