equal
deleted
inserted
replaced
334 |
334 |
335 void DrawMapScene::decode(QByteArray data) |
335 void DrawMapScene::decode(QByteArray data) |
336 { |
336 { |
337 hideCursor(); |
337 hideCursor(); |
338 |
338 |
|
339 // Remember erasing mode |
339 bool erasing = m_isErasing; |
340 bool erasing = m_isErasing; |
|
341 |
|
342 // Use seperate for decoding the map, don't mess with the user pen |
|
343 QPen load_pen = QPen(m_pen); |
340 |
344 |
341 oldItems.clear(); |
345 oldItems.clear(); |
342 oldPaths.clear(); |
346 oldPaths.clear(); |
343 clear(); |
347 clear(); |
344 paths.clear(); |
348 paths.clear(); |
361 { |
365 { |
362 isSpecial = false; |
366 isSpecial = false; |
363 |
367 |
364 if(params.points.size()) |
368 if(params.points.size()) |
365 { |
369 { |
366 addPath(pointsToPath(params.points), m_pen); |
370 addPath(pointsToPath(params.points), load_pen); |
367 |
371 |
368 paths.prepend(params); |
372 paths.prepend(params); |
369 |
373 |
370 params.points.clear(); |
374 params.points.clear(); |
371 } |
375 } |
372 |
376 |
373 quint8 penWidth = flags & 0x3f; |
377 quint8 penWidth = flags & 0x3f; |
374 m_pen.setWidth(deserializePenWidth(penWidth)); |
378 load_pen.setWidth(deserializePenWidth(penWidth)); |
375 params.erasing = flags & 0x40; |
379 params.erasing = flags & 0x40; |
376 if(params.erasing) |
380 if(params.erasing) |
377 m_pen.setBrush(m_eraser); |
381 load_pen.setBrush(m_eraser); |
378 else |
382 else |
379 m_pen.setBrush(m_brush); |
383 load_pen.setBrush(m_brush); |
380 params.width = penWidth; |
384 params.width = penWidth; |
381 } else |
385 } else |
382 if(isSpecial) |
386 if(isSpecial) |
383 { |
387 { |
384 QPainterPath path; |
388 QPainterPath path; |
397 params.points.append(QPoint(px, py)); |
401 params.points.append(QPoint(px, py)); |
398 } |
402 } |
399 |
403 |
400 if(params.points.size()) |
404 if(params.points.size()) |
401 { |
405 { |
402 addPath(pointsToPath(params.points), m_pen); |
406 addPath(pointsToPath(params.points), load_pen); |
403 paths.prepend(params); |
407 paths.prepend(params); |
404 } |
408 } |
405 |
409 |
406 emit pathChanged(); |
410 emit pathChanged(); |
407 |
411 |
|
412 // Restore erasing mode |
408 setErasing(erasing); |
413 setErasing(erasing); |
409 } |
414 } |
410 |
415 |
411 void DrawMapScene::simplifyLast() |
416 void DrawMapScene::simplifyLast() |
412 { |
417 { |