diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index fc06d669..6d41bdd7 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -2297,6 +2297,11 @@ void lcMainWindow::UpdateModels() SetCurrentPieceInfo(nullptr); } +void lcMainWindow::UpdateInUseCategory() +{ + mPartSelectionWidget->UpdateInUseCategory(); +} + void lcMainWindow::UpdateCategories() { mPartSelectionWidget->UpdateCategories(); diff --git a/common/lc_mainwindow.h b/common/lc_mainwindow.h index 520b176b..5de0918c 100644 --- a/common/lc_mainwindow.h +++ b/common/lc_mainwindow.h @@ -272,6 +272,7 @@ class lcMainWindow : public QMainWindow void UpdateShadingMode(); void UpdateSelectionMode(); void UpdateModels(); + void UpdateInUseCategory(); void UpdateCategories(); void UpdateTitle(); void UpdateModified(bool Modified); diff --git a/common/lc_model.cpp b/common/lc_model.cpp index e7487101..e44fa172 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -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& Objects, lcObject { gMainWindow->UpdateTimeline(false, true); } + + // todo: fix hacky category update + if (PropertyId == lcObjectPropertyId::PieceId) + { + gMainWindow->UpdateInUseCategory(); + } } bool lcModel::AnyPiecesSelected() const diff --git a/common/lc_partselectionwidget.cpp b/common/lc_partselectionwidget.cpp index 06dc333f..56db9b74 100644 --- a/common/lc_partselectionwidget.cpp +++ b/common/lc_partselectionwidget.cpp @@ -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(); diff --git a/common/lc_partselectionwidget.h b/common/lc_partselectionwidget.h index c5e901bc..f08deceb 100644 --- a/common/lc_partselectionwidget.h +++ b/common/lc_partselectionwidget.h @@ -177,6 +177,7 @@ class lcPartSelectionListView : public QListView return mContextInfo; } + void UpdateInUseCategory(); void UpdateViewMode(); public slots: @@ -212,6 +213,7 @@ class lcPartSelectionWidget : public QWidget void UpdateThumbnails(); void SetDefaultPart(); void UpdateModels(); + void UpdateInUseCategory(); void UpdateCategories(); void LoadState(QSettings& Settings); void SaveState(QSettings& Settings);