Selected piece on top

This commit is contained in:
Ronan Le Tiec 2020-11-19 15:08:45 +01:00
parent 9f8f0e8341
commit a0cd4e9a31
2 changed files with 20 additions and 6 deletions

View File

@ -232,9 +232,22 @@ void VPMainGraphicsView::on_PieceMovedToPieceList(VPPiece *piece, VPPieceList *p
//---------------------------------------------------------------------------------------------------------------------
void VPMainGraphicsView::on_SceneSelectionChanged()
{
// most of the selection behaviour taks place automatically
// most of the selection behaviour takes place automatically
// but we need to make sure that the unplaced pieces are unselected when the scene selection has changed
// because as they are not part of the scene, they are not updated
m_layout->GetUnplacedPieceList()->ClearSelection();
// make sure, that the selected items are on top
// FIXME: maybe there is a more proper way to do it
for(auto graphicPiece : m_graphicsPieces)
{
if(!graphicPiece->GetPiece()->GetIsSelected())
{
if(!m_scene->selectedItems().isEmpty())
{
graphicPiece->stackBefore(m_scene->selectedItems().first());
}
}
}
}

View File

@ -71,6 +71,7 @@ void VPTileFactory::drawTile(QPainter *painter, VPMainGraphicsView *graphicsView
QSvgRenderer* svgRenderer = new QSvgRenderer();
// FIXME here instead of creating 4 triangle, maybe create one and rotate it
// ------------- prepare triangles for positioning
@ -263,10 +264,10 @@ void VPTileFactory::drawTile(QPainter *painter, VPMainGraphicsView *graphicsView
// prepare the painting for the text information
QTextDocument td;
// td.documentLayout()->setPaintDevice(printer); ??
td.setPageSize(QSizeF(m_drawingAreaWidth - UnitConvertor(2, Unit::Cm, Unit::Px), m_drawingAreaHeight));
td.setPageSize(QSizeF(
m_drawingAreaWidth - UnitConvertor(2, Unit::Cm, Unit::Px),
m_drawingAreaHeight
));
// paint the grid information
const QString grid = tr("Grid ( %1 , %2 )").arg(row+1).arg(col+1);