equal
deleted
inserted
replaced
54 { |
54 { |
55 m_scene = scene; |
55 m_scene = scene; |
56 |
56 |
57 ui->graphicsView->setScene(scene); |
57 ui->graphicsView->setScene(scene); |
58 connect(scene, SIGNAL(pathChanged()), this, SLOT(pathChanged())); |
58 connect(scene, SIGNAL(pathChanged()), this, SLOT(pathChanged())); |
|
59 connect(scene, SIGNAL(brushSizeChanged(int)), this, SLOT(brushSizeChanged_slot(int))); |
59 } |
60 } |
60 |
61 |
61 void DrawMapWidget::resizeEvent(QResizeEvent * event) |
62 void DrawMapWidget::resizeEvent(QResizeEvent * event) |
62 { |
63 { |
63 Q_UNUSED(event); |
64 Q_UNUSED(event); |
64 |
65 |
|
66 if(!m_scene) |
|
67 return; |
|
68 |
65 int height = this->height(); |
69 int height = this->height(); |
66 int width = this->width(); |
70 int width = this->width(); |
67 |
71 |
68 if ((m_scene->height() > 0) && (m_scene->width() > 0) && (height > 0)) |
72 if ((m_scene->height() > 0) && (m_scene->width() > 0) && (height > 0)) |
69 { |
73 { |
129 } |
133 } |
130 |
134 |
131 void DrawMapWidget::setPathType(DrawMapScene::PathType pathType) |
135 void DrawMapWidget::setPathType(DrawMapScene::PathType pathType) |
132 { |
136 { |
133 if(m_scene) m_scene->setPathType(pathType); |
137 if(m_scene) m_scene->setPathType(pathType); |
|
138 } |
|
139 |
|
140 void DrawMapWidget::setBrushSize(int brushSize) |
|
141 { |
|
142 if(m_scene) m_scene->setBrushSize(brushSize); |
134 } |
143 } |
135 |
144 |
136 void DrawMapWidget::save(const QString & fileName) |
145 void DrawMapWidget::save(const QString & fileName) |
137 { |
146 { |
138 if(m_scene) |
147 if(m_scene) |
177 void DrawMapWidget::pathChanged() |
186 void DrawMapWidget::pathChanged() |
178 { |
187 { |
179 ui->lblPoints->setNum(m_scene->pointsCount()); |
188 ui->lblPoints->setNum(m_scene->pointsCount()); |
180 } |
189 } |
181 |
190 |
182 |
191 void DrawMapWidget::brushSizeChanged_slot(int brushSize) |
|
192 { |
|
193 emit brushSizeChanged(brushSize); |
|
194 } |
183 |
195 |
184 DrawMapView::DrawMapView(QWidget *parent) : |
196 DrawMapView::DrawMapView(QWidget *parent) : |
185 QGraphicsView(parent) |
197 QGraphicsView(parent) |
186 { |
198 { |
187 setMouseTracking(true); |
199 setMouseTracking(true); |