~ubuntu-branches/ubuntu/trusty/qgis/trusty

« back to all changes in this revision

Viewing changes to src/plugins/labeling/labelpreview.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "labelpreview.h"
 
2
 
 
3
#include <QPainter>
 
4
 
 
5
#include "pallabeling.h"
 
6
 
 
7
LabelPreview::LabelPreview( QWidget* parent )
 
8
    : QLabel( parent )
 
9
{
 
10
}
 
11
 
 
12
void LabelPreview::setTextColor( QColor color )
 
13
{
 
14
  mTextColor = color;
 
15
  update();
 
16
}
 
17
 
 
18
void LabelPreview::setBuffer( int size, QColor color )
 
19
{
 
20
  mBufferSize = size;
 
21
  mBufferColor = color;
 
22
  update();
 
23
}
 
24
 
 
25
void LabelPreview::paintEvent( QPaintEvent* e )
 
26
{
 
27
  QPainter p( this );
 
28
 
 
29
  p.setRenderHint( QPainter::Antialiasing );
 
30
  p.setFont( font() );
 
31
  p.translate( 10, 20 ); // uhm...
 
32
 
 
33
  if ( mBufferSize != 0 )
 
34
    PalLabeling::drawLabelBuffer( &p, text(), font(), mBufferSize, mBufferColor );
 
35
 
 
36
  p.setPen( mTextColor );
 
37
  p.drawText( 0, 0, text() );
 
38
}