Skip to content

Commit 701e35d

Browse files
committed
Emit signal when showing / hiding composer
1 parent b6fa94f commit 701e35d

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

python/gui/qgscomposerview.sip

+5
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,9 @@ class QgsComposerView: QGraphicsView
107107
/**Current action (e.g. adding composer map) has been finished. The purpose of this signal is that
108108
QgsComposer may set the selection tool again*/
109109
void actionFinished();
110+
111+
/**Emitted before composerview is shown*/
112+
void composerViewShow( QgsComposerView* );
113+
/**Emitted before composerview is hidden*/
114+
void composerViewHide( QgsComposerView* );
110115
};

src/gui/qgscomposerview.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "qgscomposerscalebar.h"
3030
#include "qgscomposershape.h"
3131
#include "qgscomposerattributetable.h"
32+
#include "qgslogger.h"
3233

3334
QgsComposerView::QgsComposerView( QWidget* parent, const char* name, Qt::WFlags f )
3435
: QGraphicsView( parent )
@@ -499,6 +500,18 @@ void QgsComposerView::paintEvent( QPaintEvent* event )
499500
}
500501
}
501502

503+
void QgsComposerView::hideEvent( QHideEvent* e )
504+
{
505+
emit( composerViewShow( this ) );
506+
e->ignore();
507+
}
508+
509+
void QgsComposerView::showEvent( QShowEvent* e )
510+
{
511+
emit( composerViewHide( this ) );
512+
e->ignore();
513+
}
514+
502515
void QgsComposerView::setComposition( QgsComposition* c )
503516
{
504517
setScene( c );

src/gui/qgscomposerview.h

+7
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView
117117

118118
void paintEvent( QPaintEvent* event );
119119

120+
void hideEvent( QHideEvent* e );
121+
void showEvent( QShowEvent* e );
120122

121123
private:
122124
/**Status of shift key (used for multiple selection)*/
@@ -167,6 +169,11 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView
167169
/**Current action (e.g. adding composer map) has been finished. The purpose of this signal is that
168170
QgsComposer may set the selection tool again*/
169171
void actionFinished();
172+
173+
/**Emitted before composerview is shown*/
174+
void composerViewShow( QgsComposerView* );
175+
/**Emitted before composerview is hidden*/
176+
void composerViewHide( QgsComposerView* );
170177
};
171178

172179
#endif

0 commit comments

Comments
 (0)