QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt3d_label.h
1#ifndef QWT3D_LABEL_H
2#define QWT3D_LABEL_H
3
4#include <qpixmap.h>
5#include <qimage.h>
6#include <qfont.h>
7#include <qpainter.h>
8#include <qfontmetrics.h>
9
10#include "qwt3d_drawable.h"
11#include "qwt3d_io_gl2ps.h"
12
13
14
20class QWT3D_EXPORT Qwt3DLabel : public Qwt3DDrawable
21{
22 QWT_DECLARE_PRIVATE(Qwt3DLabel)
23
24public:
25 Qwt3DLabel();
26 ~Qwt3DLabel() override;
27 Qwt3DLabel(const Qwt3DLabel& other);
28 Qwt3DLabel(Qwt3DLabel&& other) noexcept;
29 Qwt3DLabel& operator=(const Qwt3DLabel& other);
30 Qwt3DLabel& operator=(Qwt3DLabel&& other) noexcept;
31 // Construct label and initialize with font
32 Qwt3DLabel(const QString& family, int pointSize, int weight = QFont::Normal, bool italic = false);
33
34 // Sets the labels font
35 void setFont(QString const& family, int pointSize, int weight = QFont::Normal, bool italic = false);
36
37 // Fine tunes label
38 void adjust(int gap);
39 // Returns the gap caused by adjust()
40 double gap() const;
41 // Sets the labels position
42 void setPosition(Triple pos, ANCHOR a = BottomLeft);
43 // Sets the labels position relative to screen
44 void setRelPosition(Tuple rpos, ANCHOR a, const Qwt3DRenderContext& ctx);
45 // Receives bottom left label position
46 Triple first() const;
47 // Receives top right label position
48 Triple second() const;
49 // Defines an anchor point for the labels surrounding rectangle
50 ANCHOR anchor() const;
51 virtual void setColor(double r, double g, double b, double a = 1) override;
52 virtual void setColor(RGBA rgba) override;
53
54 // Sets the labels string
55 void setString(QString const& s);
56 // Returns the labels string
57 QString string() const;
58 // Actual drawing
59 void draw(const Qwt3DRenderContext& ctx) override;
60
61 // Decides about use of PDF standard fonts for PDF output
62 static void useDeviceFonts(bool val);
63
64private:
65 void init();
66 void init(const QString& family, int pointSize, int weight = QFont::Normal, bool italic = false);
67 void update();
68 void convert2screen(const Qwt3DRenderContext& ctx);
69 double width() const;
70 double height() const;
71};
72
73
74#endif // QWT3D_LABEL_H
Abstract base class for Drawables
Definition qwt3d_drawable.h:18
A Qt string or an output device dependent string
Definition qwt3d_label.h:21
Bundles all widget resources that drawables need during rendering
Definition qwt3d_render_context.h:38
Red-Green-Blue-Alpha value
Definition qwt3d_types.h:395
Triple [x,y,z]
Definition qwt3d_types.h:201
Tuple [x,y]
Definition qwt3d_types.h:182