3D Preview - treat object management and add missed call

This commit is contained in:
Trevor SANDY 2020-10-07 16:56:49 +02:00
parent 07d0365167
commit b4e376a90d
4 changed files with 7 additions and 3 deletions

View file

@ -108,6 +108,7 @@ lcMainWindow::lcMainWindow()
mSelectionMode = lcSelectionMode::Single; mSelectionMode = lcSelectionMode::Single;
mModelTabWidget = nullptr; mModelTabWidget = nullptr;
mPreviewToolBar = nullptr; mPreviewToolBar = nullptr;
mPreviewWidget = nullptr;
memset(&mSearchOptions, 0, sizeof(mSearchOptions)); memset(&mSearchOptions, 0, sizeof(mSearchOptions));

View file

@ -718,7 +718,7 @@ void lcPartSelectionListView::PreviewSelection(int InfoIndex)
{ {
if (!Preview->SetCurrentPiece(Info->mFileName, ColorCode)) if (!Preview->SetCurrentPiece(Info->mFileName, ColorCode))
QMessageBox::critical(gMainWindow, tr("Error"), tr("Preview %1 failed.").arg(Info->mFileName)); QMessageBox::critical(gMainWindow, tr("Error"), tr("Preview %1 failed.").arg(Info->mFileName));
ViewWidget->SetPreviewPosition(rect());
} }
else else
{ {

View file

@ -54,7 +54,8 @@ bool lcPreviewDockWidget::SetCurrentPiece(const QString& PartType, int ColorCode
void lcPreviewDockWidget::ClearPreview() void lcPreviewDockWidget::ClearPreview()
{ {
mPreview->ClearPreview(); if (mPreview->GetActiveModel()->GetPieces().GetSize())
mPreview->ClearPreview();
mLabel->setText(QString()); mLabel->setText(QString());
} }
@ -95,6 +96,8 @@ lcPreviewWidget::~lcPreviewWidget()
delete mCamera; delete mCamera;
delete mLoader; delete mLoader;
gPreviewWidget = nullptr;
} }
bool lcPreviewWidget::SetCurrentPiece(const QString& PartType, int ColorCode) bool lcPreviewWidget::SetCurrentPiece(const QString& PartType, int ColorCode)

View file

@ -940,7 +940,7 @@ void lcQPropertiesTree::SetPiece(const lcArray<lcObject*>& Selection, lcObject*
ColorIndex = Piece->mColorIndex; ColorIndex = Piece->mColorIndex;
Info = Piece->mPieceInfo; Info = Piece->mPieceInfo;
lcPreferences& Preferences = lcGetPreferences(); lcPreferences& Preferences = lcGetPreferences();
if (Preferences.mPreviewEnabled) if (Preferences.mPreviewEnabled && Preferences.mPreviewPosition != lcPreviewPosition::Floating)
{ {
quint32 ColorCode = lcGetColorCode(ColorIndex); quint32 ColorCode = lcGetColorCode(ColorIndex);
PreviewSelection(Info->mFileName, ColorCode); PreviewSelection(Info->mFileName, ColorCode);