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
12namespace Qwt3D
13{
14
20class QWT3D_EXPORT Label : public Drawable
21{
22 QWT_DECLARE_PRIVATE(Label)
23
24public:
25 Label();
26 ~Label() override;
27 Label(const Label& other);
28 Label(Label&& other) noexcept;
29 Label& operator=(const Label& other);
30 Label& operator=(Label&& other) noexcept;
31 // Construct label and initialize with font
32 Label(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(Qwt3D::Triple pos, ANCHOR a = BottomLeft);
43 // Sets the labels position relative to screen
44 void setRelPosition(Tuple rpos, ANCHOR a);
45 // Receives bottom left label position
46 Qwt3D::Triple first() const;
47 // Receives top right label position
48 Qwt3D::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(Qwt3D::RGBA rgba) override;
53
54 // Sets the labels string
55 void setString(QString const& s);
56 // Actual drawing
57 virtual void draw() override;
58
59 // Decides about use of PDF standard fonts for PDF output
60 static void useDeviceFonts(bool val);
61
62private:
63 void init();
64 void init(const QString& family, int pointSize, int weight = QFont::Normal, bool italic = false);
65 void update();
66 void convert2screen();
67 double width() const;
68 double height() const;
69};
70
71} // ns
72
73#endif // QWT3D_LABEL_H
Abstract base class for Drawables
Definition qwt3d_drawable.h:15
A Qt string or an output device dependent string
Definition qwt3d_label.h:21
Red-Green-Blue-Alpha value
Definition qwt3d_types.h:364
Triple [x,y,z]
Definition qwt3d_types.h:170
Tuple [x,y]
Definition qwt3d_types.h:151