Update parts in use category after changes. Fixes #890.

This commit is contained in:
Leonardo Zide
2024-11-14 17:28:51 -08:00
parent dd3ab8990e
commit 72c8e7a6c2
5 changed files with 29 additions and 1 deletions
+5
View File
@@ -2297,6 +2297,11 @@ void lcMainWindow::UpdateModels()
SetCurrentPieceInfo(nullptr);
}
void lcMainWindow::UpdateInUseCategory()
{
mPartSelectionWidget->UpdateInUseCategory();
}
void lcMainWindow::UpdateCategories()
{
mPartSelectionWidget->UpdateCategories();
+1
View File
@@ -272,6 +272,7 @@ public:
void UpdateShadingMode();
void UpdateSelectionMode();
void UpdateModels();
void UpdateInUseCategory();
void UpdateCategories();
void UpdateTitle();
void UpdateModified(bool Modified);
+10 -1
View File
@@ -2355,9 +2355,12 @@ void lcModel::DeleteSelectedObjects()
{
if (RemoveSelectedObjects())
{
if (!mIsPreview) {
if (!mIsPreview)
{
gMainWindow->UpdateTimeline(false, false);
gMainWindow->UpdateSelectedObjects(true);
gMainWindow->UpdateInUseCategory();
UpdateAllViews();
SaveCheckpoint(tr("Deleting"));
}
@@ -3182,6 +3185,12 @@ void lcModel::SetObjectsProperty(const std::vector<lcObject*>& Objects, lcObject
{
gMainWindow->UpdateTimeline(false, true);
}
// todo: fix hacky category update
if (PropertyId == lcObjectPropertyId::PieceId)
{
gMainWindow->UpdateInUseCategory();
}
}
bool lcModel::AnyPiecesSelected() const
+11
View File
@@ -581,6 +581,12 @@ void lcPartSelectionListView::ToggleFixedColor()
mListModel->ToggleColorLocked();
}
void lcPartSelectionListView::UpdateInUseCategory()
{
if (mCategoryType == lcPartCategoryType::PartsInUse)
mListModel->SetCurrentModelCategory();
}
void lcPartSelectionListView::UpdateViewMode()
{
setViewMode(mListModel->GetIconSize() && !mListModel->IsListMode() ? QListView::IconMode : QListView::ListMode);
@@ -1112,6 +1118,11 @@ void lcPartSelectionWidget::RemoveFromPalette()
}
}
void lcPartSelectionWidget::UpdateInUseCategory()
{
mPartsWidget->UpdateInUseCategory();
}
void lcPartSelectionWidget::UpdateCategories()
{
QTreeWidgetItem* CurrentItem = mCategoriesWidget->currentItem();
+2
View File
@@ -177,6 +177,7 @@ public:
return mContextInfo;
}
void UpdateInUseCategory();
void UpdateViewMode();
public slots:
@@ -212,6 +213,7 @@ public:
void UpdateThumbnails();
void SetDefaultPart();
void UpdateModels();
void UpdateInUseCategory();
void UpdateCategories();
void LoadState(QSettings& Settings);
void SaveState(QSettings& Settings);