equal
deleted
inserted
replaced
53 mainLayout(this), |
53 mainLayout(this), |
54 pMap(0), |
54 pMap(0), |
55 mapgen(MAPGEN_REGULAR), |
55 mapgen(MAPGEN_REGULAR), |
56 m_previewSize(256, 128) |
56 m_previewSize(256, 128) |
57 { |
57 { |
|
58 m_previewDirty = true; |
58 hhSmall.load(":/res/hh_small.png"); |
59 hhSmall.load(":/res/hh_small.png"); |
59 hhLimit = 18; |
60 hhLimit = 18; |
60 templateFilter = 0; |
61 templateFilter = 0; |
61 m_master = true; |
62 m_master = true; |
62 |
63 |
606 emit drawnMapChanged(getDrawnMapData()); |
607 emit drawnMapChanged(getDrawnMapData()); |
607 |
608 |
608 updatePreview(); |
609 updatePreview(); |
609 } |
610 } |
610 |
611 |
|
612 void HWMapContainer::paintEvent(QPaintEvent * event) |
|
613 { |
|
614 if (m_previewDirty) |
|
615 updatePreview(); |
|
616 QWidget::paintEvent(event); |
|
617 } |
|
618 |
611 void HWMapContainer::updatePreview() |
619 void HWMapContainer::updatePreview() |
612 { |
620 { |
|
621 // don't update preview if e.g. widget not being displayed |
|
622 if (this->visibleRegion().isEmpty()) |
|
623 { |
|
624 // but remember to update it later |
|
625 m_previewDirty = true; |
|
626 return; |
|
627 } |
|
628 |
|
629 m_previewDirty = false; |
|
630 |
613 if (pMap) |
631 if (pMap) |
614 { |
632 { |
615 disconnect(pMap, 0, this, SLOT(setImage(const QImage))); |
633 disconnect(pMap, 0, this, SLOT(setImage(const QImage))); |
616 disconnect(pMap, 0, this, SLOT(setHHLimit(int))); |
634 disconnect(pMap, 0, this, SLOT(setHHLimit(int))); |
617 pMap = 0; |
635 pMap = 0; |