qwt_text_engine.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_ENGINE_H
11 #define QWT_TEXT_ENGINE_H 1
12 
13 #include "qwt_global.h"
14 #include <qsize.h>
15 
16 class QFont;
17 class QRectF;
18 class QString;
19 class QPainter;
20 
36 {
37 public:
38  virtual ~QwtTextEngine();
39 
50  virtual double heightForWidth( const QFont &font, int flags,
51  const QString &text, double width ) const = 0;
52 
62  virtual QSizeF textSize( const QFont &font, int flags,
63  const QString &text ) const = 0;
64 
71  virtual bool mightRender( const QString &text ) const = 0;
72 
88  virtual void textMargins( const QFont &font, const QString &text,
89  double &left, double &right, double &top, double &bottom ) const = 0;
90 
99  virtual void draw( QPainter *painter, const QRectF &rect,
100  int flags, const QString &text ) const = 0;
101 
102 protected:
103  QwtTextEngine();
104 
105 private:
106  Q_DISABLE_COPY(QwtTextEngine)
107 };
108 
109 
117 {
118 public:
120  virtual ~QwtPlainTextEngine();
121 
122  virtual double heightForWidth( const QFont &font, int flags,
123  const QString &text, double width ) const;
124 
125  virtual QSizeF textSize( const QFont &font, int flags,
126  const QString &text ) const;
127 
128  virtual void draw( QPainter *painter, const QRectF &rect,
129  int flags, const QString &text ) const;
130 
131  virtual bool mightRender( const QString & ) const;
132 
133  virtual void textMargins( const QFont &, const QString &,
134  double &left, double &right, double &top, double &bottom ) const;
135 
136 private:
137  class PrivateData;
139 };
140 
141 
142 #ifndef QT_NO_RICHTEXT
143 
151 {
152 public:
154 
155  virtual double heightForWidth( const QFont &font, int flags,
156  const QString &text, double width ) const;
157 
158  virtual QSizeF textSize( const QFont &font, int flags,
159  const QString &text ) const;
160 
161  virtual void draw( QPainter *painter, const QRectF &rect,
162  int flags, const QString &text ) const;
163 
164  virtual bool mightRender( const QString & ) const;
165 
166  virtual void textMargins( const QFont &, const QString &,
167  double &left, double &right, double &top, double &bottom ) const;
168 
169 private:
170  QString taggedText( const QString &, int flags ) const;
171 };
172 
173 #endif // !QT_NO_RICHTEXT
174 
175 #endif
virtual bool mightRender(const QString &text) const =0
virtual QSizeF textSize(const QFont &font, int flags, const QString &text) const =0
virtual double heightForWidth(const QFont &font, int flags, const QString &text, double width) const =0
#define QWT_EXPORT
Definition: qwt_global.h:38
PrivateData * d_data
virtual void textMargins(const QFont &font, const QString &text, double &left, double &right, double &top, double &bottom) const =0
A text engine for Qt rich texts.
Abstract base class for rendering text strings.
int flags
virtual void draw(QPainter *painter, const QRectF &rect, int flags, const QString &text) const =0
A text engine for plain texts.


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