Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/scripting/KReportScriptDraw.cpp
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 49 | if (m_curPage) { | |||
---|---|---|---|---|---|
57 | 57 | | |||
58 | QPen pen(QColor(lc), lw); | 58 | QPen pen(QColor(lc), lw); | ||
59 | QColor c(fc); | 59 | QColor c(fc); | ||
60 | c.setAlpha(a); | 60 | c.setAlpha(a); | ||
61 | QBrush bru(c); | 61 | QBrush bru(c); | ||
62 | 62 | | |||
63 | r->setBrush(bru); | 63 | r->setBrush(bru); | ||
64 | r->setPen(pen); | 64 | r->setPen(pen); | ||
65 | m_curPage->addPrimitive(r); | 65 | m_curPage->insertPrimitive(r); | ||
66 | } | 66 | } | ||
67 | } | 67 | } | ||
68 | 68 | | |||
69 | void KReportScriptDraw::ellipse(qreal x, qreal y, qreal w, qreal h, const QString& lc, const QString& fc, qreal lw, int a) | 69 | void KReportScriptDraw::ellipse(qreal x, qreal y, qreal w, qreal h, const QString& lc, const QString& fc, qreal lw, int a) | ||
70 | { | 70 | { | ||
71 | if (m_curPage) { | 71 | if (m_curPage) { | ||
72 | OROEllipse *e = new OROEllipse(); | 72 | OROEllipse *e = new OROEllipse(); | ||
73 | KReportPosition p; | 73 | KReportPosition p; | ||
74 | KReportSize s; | 74 | KReportSize s; | ||
75 | 75 | | |||
76 | p.setPointPos(QPointF(x, y)); | 76 | p.setPointPos(QPointF(x, y)); | ||
77 | s.setPointSize(QSizeF(w, h)); | 77 | s.setPointSize(QSizeF(w, h)); | ||
78 | e->setRect(QRectF(p.toScene() + m_curOffset, s.toScene())); | 78 | e->setRect(QRectF(p.toScene() + m_curOffset, s.toScene())); | ||
79 | 79 | | |||
80 | QPen pen(QColor(lc), lw); | 80 | QPen pen(QColor(lc), lw); | ||
81 | QColor c(fc); | 81 | QColor c(fc); | ||
82 | c.setAlpha(a); | 82 | c.setAlpha(a); | ||
83 | QBrush bru(c); | 83 | QBrush bru(c); | ||
84 | 84 | | |||
85 | e->setBrush(bru); | 85 | e->setBrush(bru); | ||
86 | e->setPen(pen); | 86 | e->setPen(pen); | ||
87 | m_curPage->addPrimitive(e); | 87 | m_curPage->insertPrimitive(e); | ||
88 | } | 88 | } | ||
89 | } | 89 | } | ||
90 | 90 | | |||
91 | void KReportScriptDraw::line(qreal x1, qreal y1, qreal x2, qreal y2, const QString& lc) | 91 | void KReportScriptDraw::line(qreal x1, qreal y1, qreal x2, qreal y2, const QString& lc) | ||
92 | { | 92 | { | ||
93 | if (m_curPage) { | 93 | if (m_curPage) { | ||
94 | OROLine *ln = new OROLine(); | 94 | OROLine *ln = new OROLine(); | ||
95 | KReportPosition s; | 95 | KReportPosition s; | ||
96 | KReportPosition e; | 96 | KReportPosition e; | ||
97 | 97 | | |||
98 | s.setPointPos(QPointF(x1, y1)); | 98 | s.setPointPos(QPointF(x1, y1)); | ||
99 | e.setPointPos(QPointF(x2, y2)); | 99 | e.setPointPos(QPointF(x2, y2)); | ||
100 | 100 | | |||
101 | ln->setStartPoint(s.toScene() + m_curOffset); | 101 | ln->setStartPoint(s.toScene() + m_curOffset); | ||
102 | ln->setEndPoint(e.toScene() + m_curOffset); | 102 | ln->setEndPoint(e.toScene() + m_curOffset); | ||
103 | 103 | | |||
104 | KReportLineStyle ls; | 104 | KReportLineStyle ls; | ||
105 | ls.setColor(QColor(lc)); | 105 | ls.setColor(QColor(lc)); | ||
106 | ls.setWidth(1); | 106 | ls.setWidth(1); | ||
107 | ls.setPenStyle(Qt::SolidLine); | 107 | ls.setPenStyle(Qt::SolidLine); | ||
108 | 108 | | |||
109 | ln->setLineStyle(ls); | 109 | ln->setLineStyle(ls); | ||
110 | m_curPage->addPrimitive(ln); | 110 | m_curPage->insertPrimitive(ln); | ||
111 | } | 111 | } | ||
112 | } | 112 | } | ||
113 | 113 | | |||
114 | void KReportScriptDraw::text(qreal x, qreal y, const QString &txt, const QString &fnt, int pt, const QString &fc, const QString&bc, const QString &lc, qreal lw, int o) | 114 | void KReportScriptDraw::text(qreal x, qreal y, const QString &txt, const QString &fnt, int pt, const QString &fc, const QString&bc, const QString &lc, qreal lw, int o) | ||
115 | { | 115 | { | ||
116 | if (m_curPage) { | 116 | if (m_curPage) { | ||
117 | QFont f(fnt, pt); | 117 | QFont f(fnt, pt); | ||
118 | QRectF r = QFontMetrics(f).boundingRect(txt); | 118 | QRectF r = QFontMetrics(f).boundingRect(txt); | ||
Show All 16 Lines | |||||
135 | OROTextBox *tb = new OROTextBox(); | 135 | OROTextBox *tb = new OROTextBox(); | ||
136 | tb->setPosition(QPointF(x, y) + m_curOffset); | 136 | tb->setPosition(QPointF(x, y) + m_curOffset); | ||
137 | tb->setSize(r.size()); | 137 | tb->setSize(r.size()); | ||
138 | tb->setTextStyle(ts); | 138 | tb->setTextStyle(ts); | ||
139 | tb->setLineStyle(ls); | 139 | tb->setLineStyle(ls); | ||
140 | 140 | | |||
141 | tb->setText(txt); | 141 | tb->setText(txt); | ||
142 | 142 | | |||
143 | m_curPage->addPrimitive(tb); | 143 | m_curPage->insertPrimitive(tb); | ||
144 | 144 | | |||
145 | } | 145 | } | ||
146 | } | 146 | } | ||
147 | 147 | |