Skip to content
Permalink
Browse files

sync QgsRubberBand and QgsMpaCanvasMap antialiasing, this also fixes …

…1px QgsRubberBand shift with x11 rendering engine if rendered without antialiasing
  • Loading branch information
blazek committed May 11, 2011
1 parent a1a0b35 commit aadb7d23e52b0c246f5cdc6c3800379b133c7482
Showing with 12 additions and 1 deletion.
  1. +3 −1 src/gui/qgsmapcanvas.cpp
  2. +5 −0 src/gui/qgsmapcanvas.h
  3. +4 −0 src/gui/qgsmapcanvasitem.cpp
@@ -82,9 +82,10 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name )
, mCanvasProperties( new CanvasProperties )
, mNewSize( QSize() )
, mPainting( false )
, mAntiAliasing( false )
{
//disable the update that leads to the resize crash
if( viewport() )
if ( viewport() )
{
viewport()->setAttribute( Qt::WA_PaintOnScreen, true );
}
@@ -163,6 +164,7 @@ QgsMapCanvas::~QgsMapCanvas()

void QgsMapCanvas::enableAntiAliasing( bool theFlag )
{
mAntiAliasing = theFlag;
mMap->enableAntiAliasing( theFlag );
if ( mMapOverview )
mMapOverview->enableAntiAliasing( theFlag );
@@ -244,6 +244,9 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! used to determine if anti-aliasing is enabled or not
void enableAntiAliasing( bool theFlag );

//! true if antialising is enabled
bool antiAliasingEnabled() const { return mAntiAliasing; }

//! Select which Qt class to render with
void useImageToRender( bool theFlag );

@@ -463,6 +466,8 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! currently in paint event
bool mPainting;

//! indicates whether antialiasing will be used for rendering
bool mAntiAliasing;
}; // class QgsMapCanvas


@@ -42,6 +42,10 @@ void QgsMapCanvasItem::paint( QPainter * painter,
const QStyleOptionGraphicsItem * option,
QWidget * widget )
{
if ( mMapCanvas->antiAliasingEnabled() )
{
painter->setRenderHint( QPainter::Antialiasing );
}
paint( painter ); // call the derived item's drawing routines
}

0 comments on commit aadb7d2

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