Clear selection when switch active sheet.
This commit is contained in:
parent
b71253738c
commit
7b134d8b62
|
@ -203,6 +203,12 @@ void VPCarrousel::on_ActivePieceListChanged(int index)
|
||||||
|
|
||||||
if (not sheet.isNull())
|
if (not sheet.isNull())
|
||||||
{
|
{
|
||||||
|
VPSheetPtr activeSheet = layout->GetFocusedSheet();
|
||||||
|
if (not activeSheet.isNull())
|
||||||
|
{
|
||||||
|
activeSheet->ClearSelection();
|
||||||
|
}
|
||||||
|
|
||||||
m_ignoreActiveSheetChange = true;
|
m_ignoreActiveSheetChange = true;
|
||||||
layout->SetFocusedSheet(sheet);
|
layout->SetFocusedSheet(sheet);
|
||||||
m_ignoreActiveSheetChange = false;
|
m_ignoreActiveSheetChange = false;
|
||||||
|
|
|
@ -595,6 +595,28 @@ auto VPSheet::SceneData() const -> VPSheetSceneData *
|
||||||
return m_sceneData;
|
return m_sceneData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPSheet::ClearSelection() const
|
||||||
|
{
|
||||||
|
QList<VPPiecePtr> selectedPieces = GetSelectedPieces();
|
||||||
|
for (const auto& piece : selectedPieces)
|
||||||
|
{
|
||||||
|
if (piece->IsSelected())
|
||||||
|
{
|
||||||
|
piece->SetSelected(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (not selectedPieces.isEmpty())
|
||||||
|
{
|
||||||
|
VPLayoutPtr layout = GetLayout();
|
||||||
|
if (not layout.isNull())
|
||||||
|
{
|
||||||
|
emit GetLayout()->PieceSelectionChanged(VPPiecePtr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPSheet::SheetUnits() const -> Unit
|
auto VPSheet::SheetUnits() const -> Unit
|
||||||
{
|
{
|
||||||
|
|
|
@ -255,6 +255,8 @@ public:
|
||||||
|
|
||||||
VPSheetSceneData *SceneData() const;
|
VPSheetSceneData *SceneData() const;
|
||||||
|
|
||||||
|
void ClearSelection() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void CheckPiecePositionValidity(const VPPiecePtr &piece) const;
|
void CheckPiecePositionValidity(const VPPiecePtr &piece) const;
|
||||||
|
|
||||||
|
|
|
@ -457,19 +457,7 @@ void VPMainGraphicsView::on_ItemClicked(QGraphicsItem *item)
|
||||||
VPSheetPtr sheet = layout->GetFocusedSheet();
|
VPSheetPtr sheet = layout->GetFocusedSheet();
|
||||||
if (not sheet.isNull())
|
if (not sheet.isNull())
|
||||||
{
|
{
|
||||||
QList<VPPiecePtr> selectedPieces = sheet->GetSelectedPieces();
|
sheet->ClearSelection();
|
||||||
for (const auto& piece : selectedPieces)
|
|
||||||
{
|
|
||||||
if (piece->IsSelected())
|
|
||||||
{
|
|
||||||
piece->SetSelected(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (not selectedPieces.isEmpty())
|
|
||||||
{
|
|
||||||
emit layout->PieceSelectionChanged(VPPiecePtr());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user