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 <qmetatype.h>
15 
16 class QFont;
17 class QString;
18 class QColor;
19 class QPen;
20 class QBrush;
21 class QSizeF;
22 class QRectF;
23 class QPainter;
24 class QwtTextEngine;
25 
52 {
53 public:
54 
65  {
72  AutoText = 0,
73 
76 
79 
94 
100 
105  OtherFormat = 100
106  };
107 
115  {
117  PaintUsingTextFont = 0x01,
118 
120  PaintUsingTextColor = 0x02,
121 
123  PaintBackground = 0x04
124  };
125 
127  typedef QFlags<PaintAttribute> PaintAttributes;
128 
134  {
141  MinimumLayout = 0x01
142  };
143 
145  typedef QFlags<LayoutAttribute> LayoutAttributes;
146 
147  QwtText();
148  QwtText( const QString &, TextFormat textFormat = AutoText );
149  QwtText( const QwtText & );
150 
151  ~QwtText();
152 
153  QwtText &operator=( const QwtText & );
154 
155  bool operator==( const QwtText & ) const;
156  bool operator!=( const QwtText & ) const;
157 
158  void setText( const QString &,
159  QwtText::TextFormat textFormat = AutoText );
160  QString text() const;
161 
162  bool isNull() const;
163  bool isEmpty() const;
164 
165  void setFont( const QFont & );
166  QFont font() const;
167 
168  QFont usedFont( const QFont & ) const;
169 
170  void setRenderFlags( int );
171  int renderFlags() const;
172 
173  void setColor( const QColor & );
174  QColor color() const;
175 
176  QColor usedColor( const QColor & ) const;
177 
178  void setBorderRadius( double );
179  double borderRadius() const;
180 
181  void setBorderPen( const QPen & );
182  QPen borderPen() const;
183 
184  void setBackgroundBrush( const QBrush & );
185  QBrush backgroundBrush() const;
186 
187  void setPaintAttribute( PaintAttribute, bool on = true );
188  bool testPaintAttribute( PaintAttribute ) const;
189 
190  void setLayoutAttribute( LayoutAttribute, bool on = true );
191  bool testLayoutAttribute( LayoutAttribute ) const;
192 
193  double heightForWidth( double width ) const;
194  double heightForWidth( double width, const QFont & ) const;
195 
196  QSizeF textSize() const;
197  QSizeF textSize( const QFont & ) const;
198 
199  void draw( QPainter *painter, const QRectF &rect ) const;
200 
201  static const QwtTextEngine *textEngine(
202  const QString &text, QwtText::TextFormat = AutoText );
203 
204  static const QwtTextEngine *textEngine( QwtText::TextFormat );
205  static void setTextEngine( QwtText::TextFormat, QwtTextEngine * );
206 
207 private:
208  class PrivateData;
210 
211  class LayoutCache;
213 };
214 
215 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::PaintAttributes )
216 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::LayoutAttributes )
217 
218 Q_DECLARE_METATYPE( QwtText )
219 
220 #endif
QFlags< LayoutAttribute > LayoutAttributes
Layout attributes.
Definition: qwt_text.h:145
constexpr bool operator!=(const optional< T > &lhs, const optional< U > &rhs)
relop
Definition: sol.hpp:5324
bool operator==(fp x, fp y)
Definition: format-inl.h:1167
#define QWT_EXPORT
Definition: qwt_global.h:38
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:127
LayoutCache * d_layoutCache
Definition: qwt_text.h:211
PaintAttribute
Paint Attributes.
Definition: qwt_text.h:114
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:133
PrivateData * d_data
Definition: qwt_text.h:208
Draw the text as it is, using a QwtPlainTextEngine.
Definition: qwt_text.h:75


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10