Fix redrawing VPGraphicsSheet.
This commit is contained in:
parent
18e52f4a70
commit
54b0ca5ee5
|
@ -280,6 +280,15 @@ void VPSheetSceneData::ClearTilesScheme()
|
||||||
RefreshLayout();
|
RefreshLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSheetSceneData::RefreshSheetSize()
|
||||||
|
{
|
||||||
|
if (m_graphicsSheet != nullptr)
|
||||||
|
{
|
||||||
|
m_graphicsSheet->RefreshBoundingRect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPSheetSceneData::ConnectPiece(VPGraphicsPiece *piece)
|
void VPSheetSceneData::ConnectPiece(VPGraphicsPiece *piece)
|
||||||
{
|
{
|
||||||
|
@ -707,6 +716,11 @@ void VPSheet::SetSheetSize(qreal width, qreal height)
|
||||||
{
|
{
|
||||||
m_size.setWidth(width);
|
m_size.setWidth(width);
|
||||||
m_size.setHeight(height);
|
m_size.setHeight(height);
|
||||||
|
|
||||||
|
if (m_sceneData != nullptr)
|
||||||
|
{
|
||||||
|
m_sceneData->RefreshSheetSize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -715,12 +729,22 @@ void VPSheet::SetSheetSizeConverted(qreal width, qreal height)
|
||||||
Unit unit = SheetUnits();
|
Unit unit = SheetUnits();
|
||||||
m_size.setWidth(UnitConvertor(width, unit, Unit::Px));
|
m_size.setWidth(UnitConvertor(width, unit, Unit::Px));
|
||||||
m_size.setHeight(UnitConvertor(height, unit, Unit::Px));
|
m_size.setHeight(UnitConvertor(height, unit, Unit::Px));
|
||||||
|
|
||||||
|
if (m_sceneData != nullptr)
|
||||||
|
{
|
||||||
|
m_sceneData->RefreshSheetSize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPSheet::SetSheetSize(const QSizeF &size)
|
void VPSheet::SetSheetSize(const QSizeF &size)
|
||||||
{
|
{
|
||||||
m_size = size;
|
m_size = size;
|
||||||
|
|
||||||
|
if (m_sceneData != nullptr)
|
||||||
|
{
|
||||||
|
m_sceneData->RefreshSheetSize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -729,6 +753,11 @@ void VPSheet::SetSheetSizeConverted(const QSizeF &size)
|
||||||
Unit unit = SheetUnits();
|
Unit unit = SheetUnits();
|
||||||
m_size = QSizeF(UnitConvertor(size.width(), unit, Unit::Px),
|
m_size = QSizeF(UnitConvertor(size.width(), unit, Unit::Px),
|
||||||
UnitConvertor(size.height(), unit, Unit::Px));
|
UnitConvertor(size.height(), unit, Unit::Px));
|
||||||
|
|
||||||
|
if (m_sceneData != nullptr)
|
||||||
|
{
|
||||||
|
m_sceneData->RefreshSheetSize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -87,6 +87,8 @@ public:
|
||||||
void PrepareTilesScheme();
|
void PrepareTilesScheme();
|
||||||
void ClearTilesScheme();
|
void ClearTilesScheme();
|
||||||
|
|
||||||
|
void RefreshSheetSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VPSheetSceneData)
|
Q_DISABLE_COPY(VPSheetSceneData)
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,7 @@
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPGraphicsSheet::VPGraphicsSheet(const VPLayoutPtr &layout, QGraphicsItem *parent):
|
VPGraphicsSheet::VPGraphicsSheet(const VPLayoutPtr &layout, QGraphicsItem *parent):
|
||||||
QGraphicsItem(parent),
|
QGraphicsItem(parent),
|
||||||
m_layout(layout),
|
m_layout(layout)
|
||||||
m_boundingRect(GetSheetRect())
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -98,8 +97,6 @@ void VPGraphicsSheet::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_boundingRect = sheetRect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -148,8 +145,14 @@ void VPGraphicsSheet::SetShowBorder(bool value)
|
||||||
m_showBorder = value;
|
m_showBorder = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPGraphicsSheet::RefreshBoundingRect()
|
||||||
|
{
|
||||||
|
prepareGeometryChange();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPGraphicsSheet::boundingRect() const -> QRectF
|
auto VPGraphicsSheet::boundingRect() const -> QRectF
|
||||||
{
|
{
|
||||||
return m_boundingRect;
|
return GetSheetRect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,11 +60,12 @@ public:
|
||||||
*/
|
*/
|
||||||
void SetShowBorder(bool value);
|
void SetShowBorder(bool value);
|
||||||
|
|
||||||
|
void RefreshBoundingRect();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VPGraphicsSheet)
|
Q_DISABLE_COPY(VPGraphicsSheet)
|
||||||
|
|
||||||
VPLayoutWeakPtr m_layout{};
|
VPLayoutWeakPtr m_layout{};
|
||||||
QRectF m_boundingRect;
|
|
||||||
|
|
||||||
bool m_showMargin{true};
|
bool m_showMargin{true};
|
||||||
bool m_showBorder{true};
|
bool m_showBorder{true};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user