Changeset View
Changeset View
Standalone View
Standalone View
src/wrtembed/KReportDesignerSectionScene.cpp
Show All 30 Lines | |||||
31 | KReportDesignerSectionScene::KReportDesignerSectionScene(qreal w, qreal h, KReportDesigner *rd) | 31 | KReportDesignerSectionScene::KReportDesignerSectionScene(qreal w, qreal h, KReportDesigner *rd) | ||
32 | : QGraphicsScene(0, 0, w, h, rd), m_rd(rd) | 32 | : QGraphicsScene(0, 0, w, h, rd), m_rd(rd) | ||
33 | { | 33 | { | ||
34 | m_dpiX = KReportPrivate::dpiX(); | 34 | m_dpiX = KReportPrivate::dpiX(); | ||
35 | m_dpiY = KReportPrivate::dpiY(); | 35 | m_dpiY = KReportPrivate::dpiY(); | ||
36 | 36 | | |||
37 | if (m_unit.type() != m_rd->pageUnit().type()) { | 37 | if (m_unit.type() != m_rd->pageUnit().type()) { | ||
38 | m_unit = m_rd->pageUnit(); | 38 | m_unit = m_rd->pageUnit(); | ||
39 | if (m_unit.type() == KReportUnit::Cicero || | 39 | if (m_unit.type() == KReportUnit::Type::Cicero || | ||
40 | m_unit.type() == KReportUnit::Pica || | 40 | m_unit.type() == KReportUnit::Type::Pica || | ||
41 | m_unit.type() == KReportUnit::Millimeter) { | 41 | m_unit.type() == KReportUnit::Type::Millimeter) { | ||
42 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiX; | 42 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiX; | ||
43 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiY; | 43 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiY; | ||
44 | } else if (m_unit.type() == KReportUnit::Point) { | 44 | } else if (m_unit.type() == KReportUnit::Type::Point) { | ||
45 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiX; | 45 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiX; | ||
46 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiY; | 46 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiY; | ||
47 | } else { | 47 | } else { | ||
48 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiX; | 48 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiX; | ||
49 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiY; | 49 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiY; | ||
50 | } | 50 | } | ||
51 | } | 51 | } | ||
52 | } | 52 | } | ||
53 | KReportDesignerSectionScene::~KReportDesignerSectionScene() | 53 | KReportDesignerSectionScene::~KReportDesignerSectionScene() | ||
54 | { | 54 | { | ||
55 | // Qt should be handling everything for us | 55 | // Qt should be handling everything for us | ||
56 | } | 56 | } | ||
57 | 57 | | |||
58 | void KReportDesignerSectionScene::drawBackground(QPainter* painter, const QRectF & clip) | 58 | void KReportDesignerSectionScene::drawBackground(QPainter* painter, const QRectF & clip) | ||
59 | { | 59 | { | ||
60 | //Draw the default background colour | 60 | //Draw the default background colour | ||
61 | QGraphicsScene::drawBackground(painter, clip); | 61 | QGraphicsScene::drawBackground(painter, clip); | ||
62 | painter->setRenderHint(QPainter::Antialiasing, false); | 62 | painter->setRenderHint(QPainter::Antialiasing, false); | ||
63 | 63 | | |||
64 | if (m_rd->propertySet()->property("grid-visible").value().toBool()) { | 64 | if (m_rd->propertySet()->property("grid-visible").value().toBool()) { | ||
65 | if (m_unit.type() != m_rd->pageUnit().type()) { | 65 | if (m_unit.type() != m_rd->pageUnit().type()) { | ||
66 | m_unit = m_rd->pageUnit(); | 66 | m_unit = m_rd->pageUnit(); | ||
67 | if (m_unit.type() == KReportUnit::Cicero || | 67 | if (m_unit.type() == KReportUnit::Type::Cicero || | ||
68 | m_unit.type() == KReportUnit::Pica || | 68 | m_unit.type() == KReportUnit::Type::Pica || | ||
69 | m_unit.type() == KReportUnit::Millimeter) { | 69 | m_unit.type() == KReportUnit::Type::Millimeter) { | ||
70 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiX; | 70 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiX; | ||
71 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiY; | 71 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiY; | ||
72 | } else if (m_unit.type() == KReportUnit::Point) { | 72 | } else if (m_unit.type() == KReportUnit::Type::Point) { | ||
73 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiX; | 73 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiX; | ||
74 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiY; | 74 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiY; | ||
75 | } else { | 75 | } else { | ||
76 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiX; | 76 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiX; | ||
77 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiY; | 77 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiY; | ||
78 | } | 78 | } | ||
79 | 79 | | |||
80 | } | 80 | } | ||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | 149 | if (!m_rd->propertySet()->property("grid-snap").value().toBool()) { | |||
150 | return p; | 150 | return p; | ||
151 | } | 151 | } | ||
152 | 152 | | |||
153 | if (m_unit.type() != m_rd->pageUnit().type()) { | 153 | if (m_unit.type() != m_rd->pageUnit().type()) { | ||
154 | m_unit = m_rd->pageUnit(); | 154 | m_unit = m_rd->pageUnit(); | ||
155 | //! @todo Again? Copy&Paste error? | 155 | //! @todo Again? Copy&Paste error? | ||
156 | if (m_unit.type() != m_rd->pageUnit().type()) { | 156 | if (m_unit.type() != m_rd->pageUnit().type()) { | ||
157 | m_unit = m_rd->pageUnit(); | 157 | m_unit = m_rd->pageUnit(); | ||
158 | if (m_unit.type() == KReportUnit::Cicero || | 158 | if (m_unit.type() == KReportUnit::Type::Cicero || | ||
159 | m_unit.type() == KReportUnit::Pica || | 159 | m_unit.type() == KReportUnit::Type::Pica || | ||
160 | m_unit.type() == KReportUnit::Millimeter) { | 160 | m_unit.type() == KReportUnit::Type::Millimeter) { | ||
161 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiX; | 161 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiX; | ||
162 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiY; | 162 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(10)) * m_dpiY; | ||
163 | } else if (m_unit.type() == KReportUnit::Point) { | 163 | } else if (m_unit.type() == KReportUnit::Type::Point) { | ||
164 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiX; | 164 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiX; | ||
165 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiY; | 165 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(100)) * m_dpiY; | ||
166 | } else { | 166 | } else { | ||
167 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiX; | 167 | m_majorX = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiX; | ||
168 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiY; | 168 | m_majorY = POINT_TO_INCH(m_unit.fromUserValue(1)) * m_dpiY; | ||
169 | } | 169 | } | ||
170 | 170 | | |||
171 | } | 171 | } | ||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |