Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_text_engine.h
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_text_engine.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_text_engine.h
r9383 r11158 1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*-*****************************1 /****************************************************************************** 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen … … 9 9 10 10 #ifndef QWT_TEXT_ENGINE_H 11 #define QWT_TEXT_ENGINE_H 111 #define QWT_TEXT_ENGINE_H 12 12 13 13 #include "qwt_global.h" … … 20 20 21 21 /*! 22 \brief Abstract base class for rendering text strings 22 \brief Abstract base class for rendering text strings 23 23 24 A text engine is responsible for rendering texts for a 25 specific text format. They are used by QwtText to render a text. 24 A text engine is responsible for rendering texts for a 25 specific text format. They are used by QwtText to render a text. 26 26 27 QwtPlainTextEngine and QwtRichTextEngine are part of the Qwt library. 28 The implementation of QwtMathMLTextEngine uses code from the 29 Qt solution package. Because of license implications it is built into 30 a separate library. 31 32 \sa QwtText::setTextEngine() 33 */ 27 \sa QwtText::setTextEngine() 28 */ 34 29 35 30 class QWT_EXPORT QwtTextEngine 36 31 { 37 public: 32 public: 38 33 virtual ~QwtTextEngine(); 39 34 40 35 /*! 41 Find the height for a given width 36 Find the height for a given width 42 37 43 \param font Font of the text 44 \param flags Bitwise OR of the flags used like in QPainter::drawText 45 \param text Text to be rendered 46 \param width Width 38 \param font Font of the text 39 \param flags Bitwise OR of the flags used like in QPainter::drawText 40 \param text Text to be rendered 41 \param width Width 47 42 48 \return Calculated height 43 \return Calculated height 49 44 */ 50 virtual double heightForWidth( const QFont &font, int flags,51 const QString &text, double width ) const = 0;45 virtual double heightForWidth( const QFont& font, int flags, 46 const QString& text, double width ) const = 0; 52 47 53 48 /*! 54 Returns the size, that is needed to render text 49 Returns the size, that is needed to render text 55 50 56 \param font Font of the text 57 \param flags Bitwise OR of the flags like in for QPainter::drawText 58 \param text Text to be rendered 51 \param font Font of the text 52 \param flags Bitwise OR of the flags like in for QPainter::drawText 53 \param text Text to be rendered 59 54 60 \return Calculated size 55 \return Calculated size 61 56 */ 62 virtual QSizeF textSize( const QFont &font, int flags,63 const QString &text ) const = 0;57 virtual QSizeF textSize( const QFont& font, int flags, 58 const QString& text ) const = 0; 64 59 65 60 /*! 66 Test if a string can be rendered by this text engine 61 Test if a string can be rendered by this text engine 67 62 68 \param text Text to be tested 69 \return true, if it can be rendered 63 \param text Text to be tested 64 \return true, if it can be rendered 70 65 */ 71 virtual bool mightRender( const QString &text ) const = 0;66 virtual bool mightRender( const QString& text ) const = 0; 72 67 73 68 /*! 74 Return margins around the texts 69 Return margins around the texts 75 70 76 The textSize might include margins around the 77 text, like QFontMetrics::descent(). In situations 78 where texts need to be aligned in detail, knowing 79 these margins might improve the layout calculations. 71 The textSize might include margins around the 72 text, like QFontMetrics::descent(). In situations 73 where texts need to be aligned in detail, knowing 74 these margins might improve the layout calculations. 80 75 81 \param font Font of the text 82 \param text Text to be rendered 83 \param left Return value for the left margin 84 \param right Return value for the right margin 85 \param top Return value for the top margin 86 \param bottom Return value for the bottom margin 76 \param font Font of the text 77 \param text Text to be rendered 78 \param left Return value for the left margin 79 \param right Return value for the right margin 80 \param top Return value for the top margin 81 \param bottom Return value for the bottom margin 87 82 */ 88 virtual void textMargins( const QFont &font, const QString&text,89 double &left, double&right, double&top, double&bottom ) const = 0;83 virtual void textMargins( const QFont& font, const QString& text, 84 double& left, double& right, double& top, double& bottom ) const = 0; 90 85 91 86 /*! 92 Draw the text in a clipping rectangle 87 Draw the text in a clipping rectangle 93 88 94 \param painter Painter 95 \param rect Clipping rectangle 96 \param flags Bitwise OR of the flags like in for QPainter::drawText() 97 \param text Text to be rendered 89 \param painter Painter 90 \param rect Clipping rectangle 91 \param flags Bitwise OR of the flags like in for QPainter::drawText() 92 \param text Text to be rendered 98 93 */ 99 virtual void draw( QPainter *painter, const QRectF&rect,100 int flags, const QString &text ) const = 0;94 virtual void draw( QPainter* painter, const QRectF& rect, 95 int flags, const QString& text ) const = 0; 101 96 102 protected: 97 protected: 103 98 QwtTextEngine(); 99 100 private: 101 Q_DISABLE_COPY(QwtTextEngine) 104 102 }; 105 103 106 104 107 105 /*! 108 \brief A text engine for plain texts 106 \brief A text engine for plain texts 109 107 110 QwtPlainTextEngine renders texts using the basic Qt classes 111 QPainter and QFontMetrics. 112 */ 113 class QWT_EXPORT QwtPlainTextEngine: public QwtTextEngine 108 QwtPlainTextEngine renders texts using the basic Qt classes 109 QPainter and QFontMetrics. 110 */ 111 class QWT_EXPORT QwtPlainTextEngine : public QwtTextEngine 114 112 { 115 public: 113 public: 116 114 QwtPlainTextEngine(); 117 115 virtual ~QwtPlainTextEngine(); 118 116 119 virtual double heightForWidth( const QFont &font, int flags,120 const QString &text, double width ) const;117 virtual double heightForWidth( const QFont& font, int flags, 118 const QString& text, double width ) const QWT_OVERRIDE; 121 119 122 virtual QSizeF textSize( const QFont &font, int flags,123 const QString &text ) const;120 virtual QSizeF textSize( const QFont& font, int flags, 121 const QString& text ) const QWT_OVERRIDE; 124 122 125 virtual void draw( QPainter *painter, const QRectF&rect,126 int flags, const QString &text ) const;123 virtual void draw( QPainter*, const QRectF& rect, 124 int flags, const QString& text ) const QWT_OVERRIDE; 127 125 128 virtual bool mightRender( const QString & ) const;126 virtual bool mightRender( const QString& ) const QWT_OVERRIDE; 129 127 130 virtual void textMargins( const QFont &, const QString &, 131 double &left, double &right, double &top, double &bottom ) const; 128 virtual void textMargins( 129 const QFont&, const QString&, 130 double& left, double& right, 131 double& top, double& bottom ) const QWT_OVERRIDE; 132 132 133 private: 133 private: 134 134 class PrivateData; 135 PrivateData *d_data;135 PrivateData* m_data; 136 136 }; 137 137 … … 140 140 141 141 /*! 142 \brief A text engine for Qt rich texts 142 \brief A text engine for Qt rich texts 143 143 144 QwtRichTextEngine renders Qt rich texts using the classes 145 of the Scribe framework of Qt. 146 */ 147 class QWT_EXPORT QwtRichTextEngine: public QwtTextEngine 144 QwtRichTextEngine renders Qt rich texts using the classes 145 of the Scribe framework of Qt. 146 */ 147 class QWT_EXPORT QwtRichTextEngine : public QwtTextEngine 148 148 { 149 public: 149 public: 150 150 QwtRichTextEngine(); 151 151 152 virtual double heightForWidth( const QFont &font, int flags,153 const QString &text, double width ) const;152 virtual double heightForWidth( const QFont& font, int flags, 153 const QString& text, double width ) const QWT_OVERRIDE; 154 154 155 virtual QSizeF textSize( const QFont &font, int flags,156 const QString &text ) const;155 virtual QSizeF textSize( const QFont& font, int flags, 156 const QString& text ) const QWT_OVERRIDE; 157 157 158 virtual void draw( QPainter *painter, const QRectF&rect,159 int flags, const QString &text ) const;158 virtual void draw( QPainter*, const QRectF& rect, 159 int flags, const QString& text ) const QWT_OVERRIDE; 160 160 161 virtual bool mightRender( const QString & ) const;161 virtual bool mightRender( const QString& ) const QWT_OVERRIDE; 162 162 163 virtual void textMargins( const QFont &, const QString &, 164 double &left, double &right, double &top, double &bottom ) const; 163 virtual void textMargins( 164 const QFont&, const QString&, 165 double& left, double& right, 166 double& top, double& bottom ) const QWT_OVERRIDE; 165 167 166 private: 167 QString taggedText( const QString &, int flags ) const;168 private: 169 QString taggedText( const QString&, int flags ) const; 168 170 }; 169 171
Note:
See TracChangeset
for help on using the changeset viewer.
