qwt_text.h
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_TEXT_H
11 #define QWT_TEXT_H
12 
13 #include "qwt_global.h"
14 #include <qstring.h>
15 #include <qsize.h>
16 #include <qfont.h>
17 #include <qmetatype.h>
18 
19 class QColor;
20 class QPen;
21 class QBrush;
22 class QRectF;
23 class QPainter;
24 class QwtTextEngine;
25 
52 {
53 public:
54 
65  {
72  AutoText = 0,
73 
76 
79 
89 
95 
100  OtherFormat = 100
101  };
102 
110  {
112  PaintUsingTextFont = 0x01,
113 
115  PaintUsingTextColor = 0x02,
116 
118  PaintBackground = 0x04
119  };
120 
122  typedef QFlags<PaintAttribute> PaintAttributes;
123 
129  {
136  MinimumLayout = 0x01
137  };
138 
140  typedef QFlags<LayoutAttribute> LayoutAttributes;
141 
142  QwtText( const QString & = QString(),
143  TextFormat textFormat = AutoText );
144  QwtText( const QwtText & );
145  ~QwtText();
146 
147  QwtText &operator=( const QwtText & );
148 
149  bool operator==( const QwtText & ) const;
150  bool operator!=( const QwtText & ) const;
151 
152  void setText( const QString &,
153  QwtText::TextFormat textFormat = AutoText );
154  QString text() const;
155 
156  bool isNull() const;
157  bool isEmpty() const;
158 
159  void setFont( const QFont & );
160  QFont font() const;
161 
162  QFont usedFont( const QFont & ) const;
163 
164  void setRenderFlags( int flags );
165  int renderFlags() const;
166 
167  void setColor( const QColor & );
168  QColor color() const;
169 
170  QColor usedColor( const QColor & ) const;
171 
172  void setBorderRadius( double );
173  double borderRadius() const;
174 
175  void setBorderPen( const QPen & );
176  QPen borderPen() const;
177 
178  void setBackgroundBrush( const QBrush & );
179  QBrush backgroundBrush() const;
180 
181  void setPaintAttribute( PaintAttribute, bool on = true );
182  bool testPaintAttribute( PaintAttribute ) const;
183 
184  void setLayoutAttribute( LayoutAttribute, bool on = true );
185  bool testLayoutAttribute( LayoutAttribute ) const;
186 
187  double heightForWidth( double width, const QFont & = QFont() ) const;
188  QSizeF textSize( const QFont & = QFont() ) const;
189 
190  void draw( QPainter *painter, const QRectF &rect ) const;
191 
192  static const QwtTextEngine *textEngine(
193  const QString &text, QwtText::TextFormat = AutoText );
194 
195  static const QwtTextEngine *textEngine( QwtText::TextFormat );
196  static void setTextEngine( QwtText::TextFormat, QwtTextEngine * );
197 
198 private:
199  class PrivateData;
201 
202  class LayoutCache;
204 };
205 
207 inline bool QwtText::isNull() const
208 {
209  return text().isNull();
210 }
211 
213 inline bool QwtText::isEmpty() const
214 {
215  return text().isEmpty();
216 }
217 
218 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::PaintAttributes )
219 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::LayoutAttributes )
220 
221 Q_DECLARE_METATYPE( QwtText )
222 
223 #endif
QFlags< LayoutAttribute > LayoutAttributes
Layout attributes.
Definition: qwt_text.h:140
#define QWT_EXPORT
Definition: qwt_global.h:38
bool operator==(optional< T > const &x, optional< T > const &y)
Definition: optional.hpp:854
TextFormat
Text format.
Definition: qwt_text.h:64
Use the Scribe framework (Qt Rich Text) to render the text.
Definition: qwt_text.h:78
QFlags< PaintAttribute > PaintAttributes
Paint attributes.
Definition: qwt_text.h:122
LayoutCache * d_layoutCache
Definition: qwt_text.h:202
PaintAttribute
Paint Attributes.
Definition: qwt_text.h:109
bool isEmpty() const
Definition: qwt_text.h:213
A class representing a text.
Definition: qwt_text.h:51
Abstract base class for rendering text strings.
LayoutAttribute
Layout Attributes The layout attributes affects some aspects of the layout of the text...
Definition: qwt_text.h:128
PrivateData * d_data
Definition: qwt_text.h:199
bool isNull() const
Definition: qwt_text.h:207
bool operator!=(optional< T > const &x, optional< T > const &y)
Definition: optional.hpp:859
Draw the text as it is, using a QwtPlainTextEngine.
Definition: qwt_text.h:75


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:18