Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_text.h


Ignore:
Timestamp:
Nov 3, 2026, 10:53:35 AM (3 weeks ago)
Author:
stuerze
Message:

deprecated functions exchanged libs updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_text.h

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1212
    1313#include "qwt_global.h"
    14 #include <qstring.h>
    15 #include <qsize.h>
    16 #include <qfont.h>
    1714#include <qmetatype.h>
    1815
     16class QFont;
     17class QString;
    1918class QColor;
    2019class QPen;
    2120class QBrush;
     21class QSizeF;
    2222class QRectF;
    2323class QPainter;
    … …  
    2525
    2626/*!
    27   \brief A class representing a text
    28 
    29   A QwtText is a text including a set of attributes how to render it.
    30 
    31   - Format\n
     27   \brief A class representing a text
     28
     29   A QwtText is a text including a set of attributes how to render it.
     30
     31   - Format\n
    3232    A text might include control sequences (f.e tags) describing
    3333    how to render it. Each format (f.e MathML, TeX, Qt Rich Text)
    3434    has its own set of control sequences, that can be handles by
    3535    a special QwtTextEngine for this format.
    36   - Background\n
     36   - Background\n
    3737    A text might have a background, defined by a QPen and QBrush
    3838    to improve its visibility. The corners of the background might
    3939    be rounded.
    40   - Font\n
     40   - Font\n
    4141    A text might have an individual font.
    42   - Color\n
     42   - Color\n
    4343    A text might have an individual color.
    44   - Render Flags\n
     44   - Render Flags\n
    4545    Flags from Qt::AlignmentFlag and Qt::TextFlag used like in
    4646    QPainter::drawText().
    4747
    48   \sa QwtTextEngine, QwtTextLabel
    49 */
     48   \sa QwtTextEngine, QwtTextLabel
     49 */
    5050
    5151class QWT_EXPORT QwtText
    5252{
    53 public:
     53  public:
    5454
    5555    /*!
    56       \brief Text format
    57 
    58       The text format defines the QwtTextEngine, that is used to render
    59       the text.
    60 
    61       \sa QwtTextEngine, setTextEngine()
    62     */
     56       \brief Text format
     57
     58       The text format defines the QwtTextEngine, that is used to render
     59       the text.
     60
     61       \sa QwtTextEngine, setTextEngine()
     62     */
    6363
    6464    enum TextFormat
    6565    {
    6666        /*!
    67           The text format is determined using QwtTextEngine::mightRender() for
    68           all available text engines in increasing order > PlainText.
    69           If none of the text engines can render the text is rendered
    70           like QwtText::PlainText.
     67           The text format is determined using QwtTextEngine::mightRender() for
     68           all available text engines in increasing order > PlainText.
     69           If none of the text engines can render the text is rendered
     70           like QwtText::PlainText.
    7171         */
    7272        AutoText = 0,
    … …  
    7979
    8080        /*!
    81           Use a MathML (http://en.wikipedia.org/wiki/MathML) render engine
    82           to display the text. The Qwt MathML extension offers such an engine
    83           based on the MathML renderer of the former Qt solutions package.
    84           To enable MathML support the following code needs to be added to the
    85           application:
    86 
    87           \code
     81           Use a MathML (http://en.wikipedia.org/wiki/MathML) render engine
     82           to display the text. In earlier versions of Qwt such an engine
     83           was included - since Qwt 6.2 it can be found here:
     84           https://github.com/uwerat/qwt-mml-dev
     85
     86           To enable MathML support the following code needs to be added to the
     87           application:
     88
     89           \code
    8890            QwtText::setTextEngine( QwtText::MathMLText, new QwtMathMLTextEngine() );
    89           \endcode
     91           \endcode
    9092         */
    9193        MathMLText,
    9294
    9395        /*!
    94           Use a TeX (http://en.wikipedia.org/wiki/TeX) render engine
    95           to display the text ( not implemented yet ).
     96           Use a TeX (http://en.wikipedia.org/wiki/TeX) render engine
     97           to display the text ( not implemented yet ).
    9698         */
    9799        TeXText,
    98100
    99101        /*!
    100           The number of text formats can be extended using setTextEngine.
    101           Formats >= QwtText::OtherFormat are not used by Qwt.
     102           The number of text formats can be extended using setTextEngine.
     103           Formats >= QwtText::OtherFormat are not used by Qwt.
    102104         */
    103105        OtherFormat = 100
    … …  
    105107
    106108    /*!
    107       \brief Paint Attributes
    108 
    109       Font and color and background are optional attributes of a QwtText.
    110       The paint attributes hold the information, if they are set.
    111     */
     109       \brief Paint Attributes
     110
     111       Font and color and background are optional attributes of a QwtText.
     112       The paint attributes hold the information, if they are set.
     113     */
    112114    enum PaintAttribute
    113115    {
    … …  
    122124    };
    123125
    124     //! Paint attributes
    125     typedef QFlags<PaintAttribute> PaintAttributes;
     126    Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
    126127
    127128    /*!
    128       \brief Layout Attributes
    129       The layout attributes affects some aspects of the layout of the text.
    130     */
     129       \brief Layout Attributes
     130       The layout attributes affects some aspects of the layout of the text.
     131     */
    131132    enum LayoutAttribute
    132133    {
    133134        /*!
    134           Layout the text without its margins. This mode is useful if a
    135           text needs to be aligned accurately, like the tick labels of a scale.
    136           If QwtTextEngine::textMargins is not implemented for the format
    137           of the text, MinimumLayout has no effect.
     135           Layout the text without its margins. This mode is useful if a
     136           text needs to be aligned accurately, like the tick labels of a scale.
     137           If QwtTextEngine::textMargins is not implemented for the format
     138           of the text, MinimumLayout has no effect.
    138139         */
    139140        MinimumLayout = 0x01
    140141    };
    141142
    142     //! Layout attributes
    143     typedef QFlags<LayoutAttribute> LayoutAttributes;
    144 
    145     QwtText( const QString & = QString(),
    146              TextFormat textFormat = AutoText );
    147     QwtText( const QwtText & );
     143    Q_DECLARE_FLAGS( LayoutAttributes, LayoutAttribute )
     144
     145    QwtText();
     146    QwtText( const QString&, TextFormat textFormat = AutoText );
     147    QwtText( const QwtText& );
     148
    148149    ~QwtText();
    149150
    150     QwtText &operator=( const QwtText & );
    151 
    152     bool operator==( const QwtText & ) const;
    153     bool operator!=( const QwtText & ) const;
    154 
    155     void setText( const QString &,
     151    QwtText& operator=( const QwtText& );
     152
     153    bool operator==( const QwtText& ) const;
     154    bool operator!=( const QwtText& ) const;
     155
     156    void setText( const QString&,
    156157        QwtText::TextFormat textFormat = AutoText );
    157158    QString text() const;
    … …  
    160161    bool isEmpty() const;
    161162
    162     void setFont( const QFont & );
     163    void setFont( const QFont& );
    163164    QFont font() const;
    164165
    165     QFont usedFont( const QFont & ) const;
     166    QFont usedFont( const QFont& ) const;
    166167
    167168    void setRenderFlags( int );
    168169    int renderFlags() const;
    169170
    170     void setColor( const QColor & );
     171    void setColor( const QColor& );
    171172    QColor color() const;
    172173
    173     QColor usedColor( const QColor & ) const;
     174    QColor usedColor( const QColor& ) const;
    174175
    175176    void setBorderRadius( double );
    176177    double borderRadius() const;
    177178
    178     void setBorderPen( const QPen & );
     179    void setBorderPen( const QPen& );
    179180    QPen borderPen() const;
    180181
    181     void setBackgroundBrush( const QBrush & );
     182    void setBackgroundBrush( const QBrush& );
    182183    QBrush backgroundBrush() const;
    183184
    … …  
    188189    bool testLayoutAttribute( LayoutAttribute ) const;
    189190
    190     double heightForWidth( double width, const QFont & = QFont() ) const;
    191     QSizeF textSize( const QFont & = QFont() ) const;
    192 
    193     void draw( QPainter *painter, const QRectF &rect ) const;
    194 
    195     static const QwtTextEngine *textEngine(
    196         const QString &text, QwtText::TextFormat = AutoText );
    197 
    198     static const QwtTextEngine *textEngine( QwtText::TextFormat );
    199     static void setTextEngine( QwtText::TextFormat, QwtTextEngine * );
    200 
    201 private:
     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:
    202206    class PrivateData;
    203     PrivateData *d_data;
     207    PrivateData* m_data;
    204208
    205209    class LayoutCache;
    206     LayoutCache *d_layoutCache;
     210    LayoutCache* m_layoutCache;
    207211};
    208 
    209 //! \return text().isNull()
    210 inline bool QwtText::isNull() const
    211 {
    212     return text().isNull();
    213 }
    214 
    215 //! \return text().isEmpty()
    216 inline bool QwtText::isEmpty() const
    217 {
    218     return text().isEmpty();
    219 }
    220212
    221213Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::PaintAttributes )
Note: See TracChangeset for help on using the changeset viewer.