Highlight active sheet.
This commit is contained in:
parent
bc3b144fc3
commit
52c9257bd0
|
@ -76,6 +76,7 @@ void VPCarrousel::Refresh()
|
||||||
{
|
{
|
||||||
VPCarrouselSheet carrouselSheet;
|
VPCarrouselSheet carrouselSheet;
|
||||||
carrouselSheet.unplaced = true;
|
carrouselSheet.unplaced = true;
|
||||||
|
carrouselSheet.active = false;
|
||||||
carrouselSheet.name = tr("Unplaced pieces");
|
carrouselSheet.name = tr("Unplaced pieces");
|
||||||
carrouselSheet.pieces = m_layout->GetUnplacedPieces();
|
carrouselSheet.pieces = m_layout->GetUnplacedPieces();
|
||||||
|
|
||||||
|
@ -87,6 +88,7 @@ void VPCarrousel::Refresh()
|
||||||
{
|
{
|
||||||
VPCarrouselSheet carrouselSheet;
|
VPCarrouselSheet carrouselSheet;
|
||||||
carrouselSheet.unplaced = false;
|
carrouselSheet.unplaced = false;
|
||||||
|
carrouselSheet.active = (sheet == m_layout->GetFocusedSheet());
|
||||||
carrouselSheet.name = sheet->GetName();
|
carrouselSheet.name = sheet->GetName();
|
||||||
carrouselSheet.pieces = sheet->GetPieces();
|
carrouselSheet.pieces = sheet->GetPieces();
|
||||||
|
|
||||||
|
@ -122,6 +124,7 @@ void VPCarrousel::RefreshSheetNames()
|
||||||
for (int i=0; i < sheets.size(); ++i)
|
for (int i=0; i < sheets.size(); ++i)
|
||||||
{
|
{
|
||||||
m_pieceLists[i+1].name = sheets.at(i)->GetName();
|
m_pieceLists[i+1].name = sheets.at(i)->GetName();
|
||||||
|
m_pieceLists[i+1].active = (sheets.at(i) == m_layout->GetFocusedSheet());
|
||||||
ui->comboBoxPieceList->setItemText(i+1, GetSheetName(m_pieceLists.at(i+1)));
|
ui->comboBoxPieceList->setItemText(i+1, GetSheetName(m_pieceLists.at(i+1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,11 +146,24 @@ void VPCarrousel::on_ActivePieceListChanged(int index)
|
||||||
if (not m_pieceLists.isEmpty() && index >= 0 && index < m_pieceLists.size())
|
if (not m_pieceLists.isEmpty() && index >= 0 && index < m_pieceLists.size())
|
||||||
{
|
{
|
||||||
ui->listWidget->SetCurrentPieceList(m_pieceLists.at(index).pieces);
|
ui->listWidget->SetCurrentPieceList(m_pieceLists.at(index).pieces);
|
||||||
|
|
||||||
|
if (index > 0)
|
||||||
|
{
|
||||||
|
QList<VPSheet *> sheets = m_layout->GetSheets();
|
||||||
|
|
||||||
|
if (index <= sheets.size())
|
||||||
|
{
|
||||||
|
m_layout->SetFocusedSheet(sheets.at(index - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->listWidget->SetCurrentPieceList(QList<VPPiece *>());
|
ui->listWidget->SetCurrentPieceList(QList<VPPiece *>());
|
||||||
|
m_layout->SetFocusedSheet(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RefreshSheetNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -202,5 +218,15 @@ void VPCarrousel::changeEvent(QEvent *event)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VPCarrousel::GetSheetName(const VPCarrouselSheet &sheet) -> QString
|
auto VPCarrousel::GetSheetName(const VPCarrouselSheet &sheet) -> QString
|
||||||
{
|
{
|
||||||
return sheet.unplaced ? sheet.name : tr("Pieces of ") + sheet.name;
|
if (sheet.unplaced)
|
||||||
|
{
|
||||||
|
return sheet.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sheet.active)
|
||||||
|
{
|
||||||
|
return QStringLiteral("--> %1 %2 <--").arg(tr("Pieces of"), sheet.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tr("Pieces of ") + sheet.name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ class VPCarrousel;
|
||||||
struct VPCarrouselSheet
|
struct VPCarrouselSheet
|
||||||
{
|
{
|
||||||
bool unplaced{true};
|
bool unplaced{true};
|
||||||
|
bool active{false};
|
||||||
QString name{};
|
QString name{};
|
||||||
QList<VPPiece *> pieces{};
|
QList<VPPiece *> pieces{};
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,7 +51,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void RefreshLayout();
|
void RefreshLayout();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief GetScene Returns the scene of the view
|
* @brief GetScene Returns the scene of the view
|
||||||
* @return scene of the view
|
* @return scene of the view
|
||||||
|
|
Loading…
Reference in New Issue
Block a user