Quantum GIS API Documentation  1.7.4
src/core/composer/qgscomposerlabel.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                          qgscomposerlabel.h
00003                              -------------------
00004     begin                : January 2005
00005     copyright            : (C) 2005 by Radim Blazek
00006     email                : blazek@itc.it
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 #ifndef QGSCOMPOSERLABEL_H
00018 #define QGSCOMPOSERLABEL_H
00019 
00020 #include "qgscomposeritem.h"
00021 
00025 class CORE_EXPORT QgsComposerLabel: public QgsComposerItem
00026 {
00027   public:
00028     QgsComposerLabel( QgsComposition *composition );
00029     ~QgsComposerLabel();
00030 
00032     virtual int type() const { return ComposerLabel; }
00033 
00035     void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
00036 
00038     void adjustSizeToText();
00039 
00040     QString text() {return mText;}
00041     void setText( const QString& text );
00042 
00045     QString displayText() const;
00046 
00047     QFont font() const;
00048     void setFont( const QFont& f );
00049     Qt::AlignmentFlag vAlign() const { return mVAlignment; }
00050     Qt::AlignmentFlag hAlign() const { return mHAlignment; }
00051     void setHAlign( Qt::AlignmentFlag a ) {mHAlignment = a;}
00052     void setVAlign( Qt::AlignmentFlag a ) {mVAlignment = a;}
00053     double margin() {return mMargin;}
00054     void setMargin( double m ) {mMargin = m;}
00055 
00058     void setFontColor( const QColor& c ) {mFontColor = c;}
00061     QColor fontColor() const {return mFontColor;}
00062 
00067     bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
00068 
00073     bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
00074 
00077     QString id() const { return mId; }
00078 
00081     void setId( const QString& id ) { mId = id; }
00082 
00083   private:
00084     // Text
00085     QString mText;
00086 
00087     // Font
00088     QFont mFont;
00089 
00090     // Border between text and fram (in mm)
00091     double mMargin;
00092 
00093     // Font color
00094     QColor mFontColor;
00095 
00096     // Horizontal Alignment
00097     Qt::AlignmentFlag mHAlignment;
00098 
00099     // Vertical Alignment
00100     Qt::AlignmentFlag mVAlignment;
00101 
00102     // Label id (unique within the same composition)
00103     QString mId;
00104 
00106     void replaceDateText( QString& text ) const;
00107 };
00108 
00109 #endif
00110 
00111 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines