Qwt User's Guide
|
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ***************************** 00002 * Qwt Widget Library 00003 * Copyright (C) 1997 Josef Wilgen 00004 * Copyright (C) 2002 Uwe Rathmann 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the Qwt License, Version 1.0 00008 *****************************************************************************/ 00009 00010 #ifndef QWT_TEXT_LABEL_H 00011 #define QWT_TEXT_LABEL_H 00012 00013 #include "qwt_global.h" 00014 #include "qwt_text.h" 00015 #include <qframe.h> 00016 00017 class QString; 00018 class QPaintEvent; 00019 class QPainter; 00020 00025 class QWT_EXPORT QwtTextLabel : public QFrame 00026 { 00027 Q_OBJECT 00028 00029 Q_PROPERTY( int indent READ indent WRITE setIndent ) 00030 Q_PROPERTY( int margin READ margin WRITE setMargin ) 00031 Q_PROPERTY( QString plainText READ plainText WRITE setPlainText ) 00032 00033 public: 00034 explicit QwtTextLabel( QWidget *parent = NULL ); 00035 explicit QwtTextLabel( const QwtText &, QWidget *parent = NULL ); 00036 virtual ~QwtTextLabel(); 00037 00038 void setPlainText( const QString & ); 00039 QString plainText() const; 00040 00041 public Q_SLOTS: 00042 void setText( const QString &, 00043 QwtText::TextFormat textFormat = QwtText::AutoText ); 00044 virtual void setText( const QwtText & ); 00045 00046 void clear(); 00047 00048 public: 00049 const QwtText &text() const; 00050 00051 int indent() const; 00052 void setIndent( int ); 00053 00054 int margin() const; 00055 void setMargin( int ); 00056 00057 virtual QSize sizeHint() const; 00058 virtual QSize minimumSizeHint() const; 00059 virtual int heightForWidth( int ) const; 00060 00061 QRect textRect() const; 00062 00063 virtual void drawText( QPainter *, const QRectF & ); 00064 00065 protected: 00066 virtual void paintEvent( QPaintEvent *e ); 00067 virtual void drawContents( QPainter * ); 00068 00069 private: 00070 void init(); 00071 int defaultIndent() const; 00072 00073 class PrivateData; 00074 PrivateData *d_data; 00075 }; 00076 00077 #endif