qwt_text.h
Go to the documentation of this file.
1 /******************************************************************************
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 
126  Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
127 
128 
133  {
140  MinimumLayout = 0x01
141  };
142 
143  Q_DECLARE_FLAGS( LayoutAttributes, LayoutAttribute )
144 
145  QwtText();
146  QwtText( const QString&, TextFormat textFormat = AutoText );
147  QwtText( const QwtText& );
148 
149  ~QwtText();
150 
151  QwtText& operator=( const QwtText& );
152 
153  bool operator==( const QwtText& ) const;
154  bool operator!=( const QwtText& ) const;
155 
156  void setText( const QString&,
157  QwtText::TextFormat textFormat = AutoText );
158  QString text() const;
159 
160  bool isNull() const;
161  bool isEmpty() const;
162 
163  void setFont( const QFont& );
164  QFont font() const;
165 
166  QFont usedFont( const QFont& ) const;
167 
168  void setRenderFlags( int );
169  int renderFlags() const;
170 
171  void setColor( const QColor& );
172  QColor color() const;
173 
174  QColor usedColor( const QColor& ) const;
175 
176  void setBorderRadius( double );
177  double borderRadius() const;
178 
179  void setBorderPen( const QPen& );
180  QPen borderPen() const;
181 
182  void setBackgroundBrush( const QBrush& );
183  QBrush backgroundBrush() const;
184 
185  void setPaintAttribute( PaintAttribute, bool on = true );
186  bool testPaintAttribute( PaintAttribute ) const;
187 
188  void setLayoutAttribute( LayoutAttribute, bool on = true );
189  bool testLayoutAttribute( LayoutAttribute ) const;
190 
191  double heightForWidth( double width ) const;
192  double heightForWidth( double width, const QFont& ) const;
193 
194  QSizeF textSize() const;
195  QSizeF textSize( const QFont& ) const;
196 
197  void draw( QPainter* painter, const QRectF& rect ) const;
198 
199  static const QwtTextEngine* textEngine(
200  const QString& text, QwtText::TextFormat = AutoText );
201 
202  static const QwtTextEngine* textEngine( QwtText::TextFormat );
203  static void setTextEngine( QwtText::TextFormat, QwtTextEngine* );
204 
205  private:
206  class PrivateData;
208 
209  class LayoutCache;
211 };
212 
213 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::PaintAttributes )
214 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::LayoutAttributes )
215 
216 Q_DECLARE_METATYPE( QwtText )
217 
218 #endif
QwtTextEngine
Abstract base class for rendering text strings.
Definition: qwt_text_engine.h:30
color
color
Definition: color.h:16
QwtText::m_layoutCache
LayoutCache * m_layoutCache
Definition: qwt_text.h:209
QwtText::TextFormat
TextFormat
Text format.
Definition: qwt_text.h:64
qwt_global.h
QwtText::RichText
@ RichText
Use the Scribe framework (Qt Rich Text) to render the text.
Definition: qwt_text.h:78
QwtText::PaintAttribute
PaintAttribute
Paint Attributes.
Definition: qwt_text.h:114
QwtText::m_data
PrivateData * m_data
Definition: qwt_text.h:206
QwtText
A class representing a text.
Definition: qwt_text.h:51
QwtText::PlainText
@ PlainText
Draw the text as it is, using a QwtPlainTextEngine.
Definition: qwt_text.h:75
QwtText::MathMLText
@ MathMLText
Definition: qwt_text.h:93
operator==
bool operator==(QwtEventPattern::MousePattern b1, QwtEventPattern::MousePattern b2)
Compare operator.
Definition: qwt_event_pattern.h:228
sol::operator!=
constexpr bool operator!=(const optional< T > &lhs, const optional< U > &rhs)
\group relop
Definition: sol.hpp:6020
QwtText::LayoutAttribute
LayoutAttribute
Layout Attributes The layout attributes affects some aspects of the layout of the text.
Definition: qwt_text.h:132
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38
QwtText::TeXText
@ TeXText
Definition: qwt_text.h:99
QwtText::PrivateData
Definition: qwt_text.cpp:160
QwtText::LayoutCache
Definition: qwt_text.cpp:186


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:46