Skip to content
Permalink
Browse files
Show cached content of composer maps in screen resolution after loadi…
…ng from project file

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11715 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Sep 26, 2009
1 parent 9e0408c commit 2449f3b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
@@ -65,7 +65,7 @@
#include <QSizeGrip>
#include "qgslogger.h"

QgsComposer::QgsComposer( QgisApp *qgis ): QMainWindow()
QgsComposer::QgsComposer( QgisApp *qgis ): QMainWindow(), mFirstPaint( true )
{
setupUi( this );
setupTheme();
@@ -300,6 +300,27 @@ void QgsComposer::open( void )
}
}

void QgsComposer::paintEvent( QPaintEvent* event )
{
QMainWindow::paintEvent( event );
//The cached content of the composer maps need to be recreated it is the first paint event of the composer after reading from XML file.
//Otherwise the resolution of the composer map is not suitable for screen
if ( mFirstPaint )
{
QMap<QgsComposerItem*, QWidget*>::iterator it = mItemWidgetMap.begin();
for ( ; it != mItemWidgetMap.constEnd(); ++it )
{
QgsComposerMap* cm = dynamic_cast<QgsComposerMap*>( it.key() );
if ( cm )
{
cm->cache();
cm->update();
}
}
mFirstPaint = false;
}
}

void QgsComposer::activate()
{
raise();
@@ -1352,3 +1373,5 @@ void QgsComposer::cleanupAfterTemplateRead()
}
}
}


@@ -224,6 +224,10 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase

void setSelectionTool();

protected:

void paintEvent( QPaintEvent* event );

private slots:

//! Raise, unminimize and activate this window
@@ -283,6 +287,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
QAction *mWindowAction;
#endif

/**False if first paint already happened (used to create cache of composer maps for screen resolution after reading from project files)*/
bool mFirstPaint;

//! Help context id
static const int context_id = 985715179;

0 comments on commit 2449f3b

Please sign in to comment.