mirror of
https://github.com/leozide/leocad
synced 2024-11-17 07:47:55 +01:00
Fixed used parts list not being sorted.
This commit is contained in:
parent
1f441907ee
commit
c7c6a42f78
2 changed files with 19 additions and 5 deletions
|
@ -155,7 +155,7 @@ void lcPartSelectionListModel::SetCategory(int CategoryIndex)
|
|||
mParts.resize(SingleParts.GetSize());
|
||||
|
||||
for (int PartIdx = 0; PartIdx < SingleParts.GetSize(); PartIdx++)
|
||||
mParts[PartIdx] = QPair<PieceInfo*, QPixmap>(SingleParts[PartIdx], QPixmap());
|
||||
mParts[PartIdx] = std::pair<PieceInfo*, QPixmap>(SingleParts[PartIdx], QPixmap());
|
||||
|
||||
endResetModel();
|
||||
|
||||
|
@ -178,9 +178,16 @@ void lcPartSelectionListModel::SetModelsCategory()
|
|||
lcModel* Model = Models[ModelIdx];
|
||||
|
||||
if (!Model->IncludesModel(ActiveModel))
|
||||
mParts.emplace_back(QPair<PieceInfo*, QPixmap>(Model->GetPieceInfo(), QPixmap()));
|
||||
mParts.emplace_back(std::pair<PieceInfo*, QPixmap>(Model->GetPieceInfo(), QPixmap()));
|
||||
}
|
||||
|
||||
auto lcPartSortFunc = [](const std::pair<PieceInfo*, QPixmap>& a, const std::pair<PieceInfo*, QPixmap>& b)
|
||||
{
|
||||
return strcmp(a.first->m_strDescription, b.first->m_strDescription) < 0;
|
||||
};
|
||||
|
||||
std::sort(mParts.begin(), mParts.end(), lcPartSortFunc);
|
||||
|
||||
endResetModel();
|
||||
|
||||
SetFilter(mFilter);
|
||||
|
@ -208,7 +215,7 @@ void lcPartSelectionListModel::SetPaletteCategory(int SetIndex)
|
|||
mParts.reserve(PartsList.size());
|
||||
|
||||
for (PieceInfo* Favorite : PartsList)
|
||||
mParts.emplace_back(QPair<PieceInfo*, QPixmap>(Favorite, QPixmap()));
|
||||
mParts.emplace_back(std::pair<PieceInfo*, QPixmap>(Favorite, QPixmap()));
|
||||
|
||||
endResetModel();
|
||||
|
||||
|
@ -228,7 +235,14 @@ void lcPartSelectionListModel::SetCurrentModelCategory()
|
|||
ActiveModel->GetPartsList(gDefaultColor, true, PartsList);
|
||||
|
||||
for (const auto& PartIt : PartsList)
|
||||
mParts.emplace_back(QPair<PieceInfo*, QPixmap>((PieceInfo*)PartIt.first, QPixmap()));
|
||||
mParts.emplace_back(std::pair<PieceInfo*, QPixmap>((PieceInfo*)PartIt.first, QPixmap()));
|
||||
|
||||
auto lcPartSortFunc = [](const std::pair<PieceInfo*, QPixmap>& a, const std::pair<PieceInfo*, QPixmap>& b)
|
||||
{
|
||||
return strcmp(a.first->m_strDescription, b.first->m_strDescription) < 0;
|
||||
};
|
||||
|
||||
std::sort(mParts.begin(), mParts.end(), lcPartSortFunc);
|
||||
|
||||
endResetModel();
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ protected:
|
|||
void DrawPreview(int InfoIndex);
|
||||
|
||||
lcPartSelectionListView* mListView;
|
||||
std::vector<QPair<PieceInfo*, QPixmap>> mParts;
|
||||
std::vector<std::pair<PieceInfo*, QPixmap>> mParts;
|
||||
std::vector<int> mRequestedPreviews;
|
||||
int mIconSize;
|
||||
bool mColorLocked;
|
||||
|
|
Loading…
Reference in a new issue