Quantum GIS API Documentation
1.8
|
00001 /*************************************************************************** 00002 qgscomposerlabel.h 00003 ------------------- 00004 begin : January 2005 00005 copyright : (C) 2005 by Radim Blazek 00006 email : [email protected] 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 ); 00052 Qt::AlignmentFlag vAlign() const { return mVAlignment; } 00056 Qt::AlignmentFlag hAlign() const { return mHAlignment; } 00061 void setHAlign( Qt::AlignmentFlag a ) {mHAlignment = a;} 00066 void setVAlign( Qt::AlignmentFlag a ) {mVAlignment = a;} 00068 double margin() {return mMargin;} 00070 void setMargin( double m ) {mMargin = m;} 00071 00074 void setFontColor( const QColor& c ) {mFontColor = c;} 00077 QColor fontColor() const {return mFontColor;} 00078 00083 bool writeXML( QDomElement& elem, QDomDocument & doc ) const; 00084 00089 bool readXML( const QDomElement& itemElem, const QDomDocument& doc ); 00090 00091 private: 00092 // Text 00093 QString mText; 00094 00095 // Font 00096 QFont mFont; 00097 00098 // Border between text and fram (in mm) 00099 double mMargin; 00100 00101 // Font color 00102 QColor mFontColor; 00103 00104 // Horizontal Alignment 00105 Qt::AlignmentFlag mHAlignment; 00106 00107 // Vertical Alignment 00108 Qt::AlignmentFlag mVAlignment; 00109 00111 void replaceDateText( QString& text ) const; 00112 }; 00113 00114 #endif 00115 00116