QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_text_label.h
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_TEXT_LABEL_H
28#define QWT_TEXT_LABEL_H
29
30#include "qwt_global.h"
31#include "qwt_text.h"
32
33#include <qframe.h>
34
35class QString;
36class QPaintEvent;
37class QPainter;
38
54class QWT_EXPORT QwtTextLabel : public QFrame
55{
56 Q_OBJECT
57
58 Q_PROPERTY( int indent READ indent WRITE setIndent )
59 Q_PROPERTY( int margin READ margin WRITE setMargin )
60 Q_PROPERTY( QString plainText READ plainText WRITE setPlainText )
61
62 public:
63 // Constructor with parent
64 explicit QwtTextLabel( QWidget* parent = nullptr );
65 // Constructor with text and parent
66 explicit QwtTextLabel( const QwtText&, QWidget* parent = nullptr );
67 // Destructor
68 virtual ~QwtTextLabel();
69
70 // Set the text as plain text
71 void setPlainText( const QString& );
72 // Return the text as plain text
73 QString plainText() const;
74
75 public Q_SLOTS:
76 // Set the text with auto format detection
77 void setText( const QString&,
79 // Set the text
80 virtual void setText( const QwtText& );
81
82 // Clear the text
83 void clear();
84
85 public:
86 // Return the text
87 const QwtText& text() const;
88
89 // Return the indent
90 int indent() const;
91 // Set the indent
92 void setIndent( int );
93
94 // Return the margin
95 int margin() const;
96 // Set the margin
97 void setMargin( int );
98
99 // Return the size hint
100 virtual QSize sizeHint() const override;
101 // Return the minimum size hint
102 virtual QSize minimumSizeHint() const override;
103 // Return the height for a given width
104 virtual int heightForWidth( int ) const override;
105
106 // Return the rectangle for the text
107 QRect textRect() const;
108
109 // Draw the text
110 virtual void drawText( QPainter*, const QRectF& );
111
112 protected:
114 virtual void paintEvent( QPaintEvent* ) override;
116 virtual void drawContents( QPainter* );
117
118 private:
120 void init();
122 int defaultIndent() const;
123
124 class PrivateData;
125 PrivateData* m_data;
126};
127
128#endif
显示 QwtText 的控件
Definition qwt_text_label.h:55
表示文本的类
Definition qwt_text.h:93
TextFormat
文本格式
Definition qwt_text.h:114
@ AutoText
Definition qwt_text.h:127