Eneboo - Documentación para desarrolladores
|
00001 /********************************************************************** 00002 ** $Id: qt/qlabel.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Definition of QLabel widget class 00005 ** 00006 ** Created : 941215 00007 ** 00008 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. 00009 ** 00010 ** This file is part of the widgets module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed under the terms of the Q Public License 00013 ** as defined by Trolltech ASA of Norway and appearing in the file 00014 ** LICENSE.QPL included in the packaging of this file. 00015 ** 00016 ** This file may be distributed and/or modified under the terms of the 00017 ** GNU General Public License version 2 as published by the Free Software 00018 ** Foundation and appearing in the file LICENSE.GPL included in the 00019 ** packaging of this file. 00020 ** 00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00022 ** licenses may use this file in accordance with the Qt Commercial License 00023 ** Agreement provided with the Software. 00024 ** 00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00027 ** 00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00029 ** information about Qt Commercial License Agreements. 00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00032 ** 00033 ** Contact info@trolltech.com if any conditions of this licensing are 00034 ** not clear to you. 00035 ** 00036 **********************************************************************/ 00037 00038 #ifndef QLABEL_H 00039 #define QLABEL_H 00040 00041 #ifndef QT_H 00042 #include "qframe.h" 00043 #endif // QT_H 00044 00045 #ifndef QT_NO_LABEL 00046 00047 class QSimpleRichText; 00048 class QLabelPrivate; 00049 00050 class Q_EXPORT QLabel : public QFrame 00051 { 00052 Q_OBJECT 00053 Q_PROPERTY( QString text READ text WRITE setText ) 00054 Q_PROPERTY( TextFormat textFormat READ textFormat WRITE setTextFormat ) 00055 Q_PROPERTY( QPixmap pixmap READ pixmap WRITE setPixmap ) 00056 Q_PROPERTY( bool scaledContents READ hasScaledContents WRITE setScaledContents ) 00057 Q_PROPERTY( Alignment alignment READ alignment WRITE setAlignment ) 00058 Q_PROPERTY( int indent READ indent WRITE setIndent ) 00059 Q_OVERRIDE( BackgroundMode backgroundMode DESIGNABLE true) 00060 00061 public: 00062 QLabel( QWidget *parent, const char* name=0, WFlags f=0 ); 00063 QLabel( const QString &text, QWidget *parent, const char* name=0, 00064 WFlags f=0 ); 00065 QLabel( QWidget *buddy, const QString &, 00066 QWidget *parent, const char* name=0, WFlags f=0 ); 00067 ~QLabel(); 00068 00069 QString text() const { return ltext; } 00070 QPixmap *pixmap() const { return lpixmap; } 00071 #ifndef QT_NO_PICTURE 00072 QPicture *picture() const { return lpicture; } 00073 #endif 00074 #ifndef QT_NO_MOVIE 00075 QMovie *movie() const; 00076 #endif 00077 00078 TextFormat textFormat() const; 00079 void setTextFormat( TextFormat ); 00080 00081 int alignment() const { return align; } 00082 virtual void setAlignment( int ); 00083 int indent() const { return extraMargin; } 00084 void setIndent( int ); 00085 00086 bool autoResize() const { return autoresize; } 00087 virtual void setAutoResize( bool ); 00088 #ifndef QT_NO_IMAGE_SMOOTHSCALE 00089 bool hasScaledContents() const; 00090 void setScaledContents( bool ); 00091 #endif 00092 QSize sizeHint() const; 00093 QSize minimumSizeHint() const; 00094 #ifndef QT_NO_ACCEL 00095 virtual void setBuddy( QWidget * ); 00096 QWidget *buddy() const; 00097 #endif 00098 int heightForWidth(int) const; 00099 00100 void setFont( const QFont &f ); 00101 00102 public slots: 00103 virtual void setText( const QString &); 00104 virtual void setPixmap( const QPixmap & ); 00105 #ifndef QT_NO_PICTURE 00106 virtual void setPicture( const QPicture & ); 00107 #endif 00108 #ifndef QT_NO_MOVIE 00109 virtual void setMovie( const QMovie & ); 00110 #endif 00111 virtual void setNum( int ); 00112 virtual void setNum( double ); 00113 void clear(); 00114 00115 protected: 00116 void drawContents( QPainter * ); 00117 void fontChange( const QFont & ); 00118 void resizeEvent( QResizeEvent* ); 00119 00120 private slots: 00121 #ifndef QT_NO_ACCEL 00122 void acceleratorSlot(); 00123 void buddyDied(); 00124 #endif 00125 #ifndef QT_NO_MOVIE 00126 void movieUpdated(const QRect&); 00127 void movieResized(const QSize&); 00128 #endif 00129 00130 private: 00131 void init(); 00132 void clearContents(); 00133 void updateLabel( QSize oldSizeHint ); 00134 QSize sizeForWidth( int w ) const; 00135 QString ltext; 00136 QPixmap *lpixmap; 00137 #ifndef QT_NO_PICTURE 00138 QPicture *lpicture; 00139 #endif 00140 #ifndef QT_NO_MOVIE 00141 QMovie * lmovie; 00142 #endif 00143 #ifndef QT_NO_ACCEL 00144 QWidget * lbuddy; 00145 #endif 00146 ushort align; 00147 short extraMargin; 00148 uint autoresize:1; 00149 uint scaledcontents :1; 00150 TextFormat textformat; 00151 #ifndef QT_NO_RICHTEXT 00152 QSimpleRichText* doc; 00153 #endif 00154 #ifndef QT_NO_ACCEL 00155 QAccel * accel; 00156 #endif 00157 QLabelPrivate* d; 00158 00159 friend class QTipLabel; 00160 00161 private: // Disabled copy constructor and operator= 00162 #if defined(Q_DISABLE_COPY) 00163 QLabel( const QLabel & ); 00164 QLabel &operator=( const QLabel & ); 00165 #endif 00166 }; 00167 00168 00169 #endif // QT_NO_LABEL 00170 00171 #endif // QLABEL_H