Show preview widget when double clicking. Fixes #589.

This commit is contained in:
Leonardo Zide 2021-01-05 12:32:03 -08:00
parent 176b238faa
commit f9c025f3b9
5 changed files with 9 additions and 6 deletions

View file

@ -785,8 +785,11 @@ lcView* lcMainWindow::CreateView(lcModel* Model)
return NewView;
}
void lcMainWindow::PreviewPiece(const QString& PartId, int ColorCode)
void lcMainWindow::PreviewPiece(const QString& PartId, int ColorCode, bool ShowPreview)
{
if (ShowPreview)
mPreviewToolBar->show();
if (!mPreviewWidget->SetCurrentPiece(PartId, ColorCode))
QMessageBox::information(this, tr("Error"), tr("Part preview for '%1' failed.").arg(PartId));
}

View file

@ -355,7 +355,7 @@ public:
public slots:
void ProjectFileChanged(const QString& Path);
void PreviewPiece(const QString& PartId, int ColorCode);
void PreviewPiece(const QString& PartId, int ColorCode, bool ShowPreview);
void TogglePreviewWidget(bool Visible);
protected slots:

View file

@ -733,7 +733,7 @@ void lcPartSelectionListView::PreviewSelection(int InfoIndex)
quint32 ColorCode = lcGetColorCode(mListModel->GetColorIndex());
gMainWindow->PreviewPiece(Info->mFileName, ColorCode);
gMainWindow->PreviewPiece(Info->mFileName, ColorCode, true);
}
lcPartSelectionWidget::lcPartSelectionWidget(QWidget* Parent)

View file

@ -535,7 +535,7 @@ void lcTimelineWidget::PreviewSelection(QTreeWidgetItem* CurrentItem)
if (!Info)
return;
gMainWindow->PreviewPiece(Info->mFileName, Piece->mColorCode);
gMainWindow->PreviewPiece(Info->mFileName, Piece->mColorCode, false);
}
void lcTimelineWidget::UpdateModel()

View file

@ -771,7 +771,7 @@ void lcQPropertiesTree::slotSetValue(int Value)
if (Focus && Focus->IsPiece())
ColorIndex = ((lcPiece*)Focus)->mColorIndex;
quint32 ColorCode = lcGetColorCode(ColorIndex);
gMainWindow->PreviewPiece(Info->mFileName, ColorCode);
gMainWindow->PreviewPiece(Info->mFileName, ColorCode, false);
}
}
}
@ -947,7 +947,7 @@ void lcQPropertiesTree::SetPiece(const lcArray<lcObject*>& Selection, lcObject*
ColorIndex = Piece->mColorIndex;
Info = Piece->mPieceInfo;
quint32 ColorCode = lcGetColorCode(ColorIndex);
gMainWindow->PreviewPiece(Info->mFileName, ColorCode);
gMainWindow->PreviewPiece(Info->mFileName, ColorCode, false);
}
else
{