mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Fixed compiler warnings.
This commit is contained in:
parent
7d43f54e6e
commit
cf135bcbc5
4 changed files with 17 additions and 11 deletions
|
@ -111,7 +111,7 @@ public:
|
||||||
if (NewSize > mAlloc)
|
if (NewSize > mAlloc)
|
||||||
AllocGrow(NewSize - mLength);
|
AllocGrow(NewSize - mLength);
|
||||||
|
|
||||||
mLength = NewSize;
|
mLength = (int)NewSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetGrow(int Grow)
|
void SetGrow(int Grow)
|
||||||
|
|
|
@ -175,7 +175,7 @@ void lcPartSelectionListModel::SetModelsCategory()
|
||||||
lcModel* Model = Models[ModelIdx];
|
lcModel* Model = Models[ModelIdx];
|
||||||
|
|
||||||
if (!Model->IncludesModel(ActiveModel))
|
if (!Model->IncludesModel(ActiveModel))
|
||||||
mParts.append(QPair<PieceInfo*, QPixmap>(Model->GetPieceInfo(), QPixmap()));
|
mParts.emplace_back(QPair<PieceInfo*, QPixmap>(Model->GetPieceInfo(), QPixmap()));
|
||||||
}
|
}
|
||||||
|
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
@ -196,7 +196,7 @@ void lcPartSelectionListModel::SetCurrentModelCategory()
|
||||||
ActiveModel->GetPartsList(gDefaultColor, true, PartsList);
|
ActiveModel->GetPartsList(gDefaultColor, true, PartsList);
|
||||||
|
|
||||||
for (const auto& PartIt : PartsList)
|
for (const auto& PartIt : PartsList)
|
||||||
mParts.append(QPair<PieceInfo*, QPixmap>((PieceInfo*)PartIt.first, QPixmap()));
|
mParts.emplace_back(QPair<PieceInfo*, QPixmap>((PieceInfo*)PartIt.first, QPixmap()));
|
||||||
|
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ int lcPartSelectionListModel::rowCount(const QModelIndex& Parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(Parent);
|
Q_UNUSED(Parent);
|
||||||
|
|
||||||
return mParts.size();
|
return (int)mParts.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant lcPartSelectionListModel::data(const QModelIndex& Index, int Role) const
|
QVariant lcPartSelectionListModel::data(const QModelIndex& Index, int Role) const
|
||||||
|
@ -304,7 +304,7 @@ void lcPartSelectionListModel::RequestPreview(int InfoIndex)
|
||||||
if (!mIconSize || !mParts[InfoIndex].second.isNull())
|
if (!mIconSize || !mParts[InfoIndex].second.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mRequestedPreviews.indexOf(InfoIndex) != -1)
|
if (std::find(mRequestedPreviews.begin(), mRequestedPreviews.end(), InfoIndex) != mRequestedPreviews.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PieceInfo* Info = mParts[InfoIndex].first;
|
PieceInfo* Info = mParts[InfoIndex].first;
|
||||||
|
@ -313,7 +313,7 @@ void lcPartSelectionListModel::RequestPreview(int InfoIndex)
|
||||||
if (Info->mState == LC_PIECEINFO_LOADED)
|
if (Info->mState == LC_PIECEINFO_LOADED)
|
||||||
DrawPreview(InfoIndex);
|
DrawPreview(InfoIndex);
|
||||||
else
|
else
|
||||||
mRequestedPreviews.append(InfoIndex);
|
mRequestedPreviews.push_back(InfoIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPartSelectionListModel::PartLoaded(PieceInfo* Info)
|
void lcPartSelectionListModel::PartLoaded(PieceInfo* Info)
|
||||||
|
@ -322,8 +322,12 @@ void lcPartSelectionListModel::PartLoaded(PieceInfo* Info)
|
||||||
{
|
{
|
||||||
if (mParts[PartIdx].first == Info)
|
if (mParts[PartIdx].first == Info)
|
||||||
{
|
{
|
||||||
if (mRequestedPreviews.removeOne(PartIdx))
|
auto PreviewIt = std::find(mRequestedPreviews.begin(), mRequestedPreviews.end(), PartIdx);
|
||||||
|
if (PreviewIt != mRequestedPreviews.end())
|
||||||
|
{
|
||||||
|
mRequestedPreviews.erase(PreviewIt);
|
||||||
DrawPreview(PartIdx);
|
DrawPreview(PartIdx);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,7 +389,9 @@ void lcPartSelectionListModel::DrawPreview(int InfoIndex)
|
||||||
Context->ClearResources();
|
Context->ClearResources();
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0))
|
||||||
emit dataChanged(index(InfoIndex, 0), index(InfoIndex, 0), QVector<int>() << Qt::DecorationRole);
|
QVector<int> Roles;
|
||||||
|
Roles.append(Qt::DecorationRole);
|
||||||
|
emit dataChanged(index(InfoIndex, 0), index(InfoIndex, 0), Roles);
|
||||||
#else
|
#else
|
||||||
emit dataChanged(index(InfoIndex, 0), index(InfoIndex, 0));
|
emit dataChanged(index(InfoIndex, 0), index(InfoIndex, 0));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -91,8 +91,8 @@ protected:
|
||||||
void DrawPreview(int InfoIndex);
|
void DrawPreview(int InfoIndex);
|
||||||
|
|
||||||
lcPartSelectionListView* mListView;
|
lcPartSelectionListView* mListView;
|
||||||
QVector<QPair<PieceInfo*, QPixmap>> mParts;
|
std::vector<QPair<PieceInfo*, QPixmap>> mParts;
|
||||||
QList<int> mRequestedPreviews;
|
std::vector<int> mRequestedPreviews;
|
||||||
int mIconSize;
|
int mIconSize;
|
||||||
bool mColorLocked;
|
bool mColorLocked;
|
||||||
int mColorIndex;
|
int mColorIndex;
|
||||||
|
|
|
@ -82,7 +82,7 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) :
|
||||||
|
|
||||||
std::vector<int> InfoTotals(PartsList.size());
|
std::vector<int> InfoTotals(PartsList.size());
|
||||||
std::vector<int> ColorTotals(NumColors);
|
std::vector<int> ColorTotals(NumColors);
|
||||||
size_t Row = 0, Total = 0;
|
int Row = 0, Total = 0;
|
||||||
|
|
||||||
for (const auto& PartIt : PartsList)
|
for (const auto& PartIt : PartsList)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue