source: ntrip/trunk/BNC/qwt/qwt_plot_textlabel.h@ 10265

Last change on this file since 10265 was 9383, checked in by stoecker, 4 years ago

update to qwt verion 6.1.1 to fix build with newer Qt5

File size: 1.8 KB
RevLine 
[8127]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_PLOT_TEXT_LABEL_H
11#define QWT_PLOT_TEXT_LABEL_H 1
12
13#include "qwt_global.h"
14#include "qwt_plot_item.h"
15#include "qwt_text.h"
16
17/*!
18 \brief A plot item, which displays a text label
19
20 QwtPlotTextLabel displays a text label aligned to the plot canvas.
21
22 In opposite to QwtPlotMarker the position of the label is unrelated to
23 plot coordinates.
[9383]24
[8127]25 As drawing a text is an expensive operation the label is cached
26 in a pixmap to speed up replots.
27
28 \par Example
[9383]29 The following code shows how to add a title.
30 \code
31 QwtText title( "Plot Title" );
32 title.setRenderFlags( Qt::AlignHCenter | Qt::AlignTop );
[8127]33
[9383]34 QFont font;
35 font.setBold( true );
36 title.setFont( font );
[8127]37
[9383]38 QwtPlotTextLabel *titleItem = new QwtPlotTextLabel();
39 titleItem->setText( title );
40 titleItem->attach( plot );
41 \endcode
42 \endpar
[8127]43
44 \sa QwtPlotMarker
[9383]45*/
[8127]46
47class QWT_EXPORT QwtPlotTextLabel: public QwtPlotItem
48{
49public:
50 QwtPlotTextLabel();
51 virtual ~QwtPlotTextLabel();
52
53 virtual int rtti() const;
54
55 void setText( const QwtText & );
56 QwtText text() const;
57
58 void setMargin( int margin );
59 int margin() const;
60
61 virtual QRectF textRect( const QRectF &, const QSizeF & ) const;
62
63protected:
64 virtual void draw( QPainter *,
65 const QwtScaleMap &, const QwtScaleMap &,
66 const QRectF &) const;
67
68 void invalidateCache();
69
70private:
71 class PrivateData;
72 PrivateData *d_data;
73};
74
75#endif
Note: See TracBrowser for help on using the repository browser.