Warning fixes.

This commit is contained in:
Leonardo Zide 2020-02-24 14:31:08 -08:00
parent 93ef9e0edc
commit 85a9b19b2c
13 changed files with 34 additions and 25 deletions

View file

@ -278,7 +278,7 @@ bool lcPiecesLibrary::Load(const QString& LibraryPath, bool ShowProgress)
}
else
{
mLibraryDir = LibraryPath;
mLibraryDir.setPath(LibraryPath);
if (OpenDirectory(mLibraryDir, ShowProgress))
{

View file

@ -1478,8 +1478,6 @@ QImage lcModel::GetPartsListImage(int MaxWidth, lcStep Step) const
const PieceInfo* Info = Image.Info;
const lcBoundingBox& BoundingBox = Info->GetBoundingBox();
lcVector3 Center = (BoundingBox.Min + BoundingBox.Max) / 2.0f;
lcVector3 Points[8];
lcGetBoxCorners(BoundingBox.Min, BoundingBox.Max, Points);
@ -4011,6 +4009,7 @@ void lcModel::EndMouseTool(lcTool Tool, bool Accept)
case LC_TOOL_ERASER:
case LC_TOOL_PAINT:
case LC_TOOL_COLOR_PICKER:
break;
case LC_TOOL_ZOOM:

View file

@ -16,7 +16,7 @@ lcPartPaletteDialog::lcPartPaletteDialog(QWidget* Parent, std::vector<lcPartPale
for (const lcPartPalette& Palette : PartPalettes)
{
QListWidgetItem* Item = new QListWidgetItem(Palette.Name);
Item->setData(Qt::UserRole, qVariantFromValue<uintptr_t>(reinterpret_cast<uintptr_t>(&Palette)));
Item->setData(Qt::UserRole, QVariant::fromValue<uintptr_t>(reinterpret_cast<uintptr_t>(&Palette)));
ui->PaletteList->addItem(Item);
}
@ -75,7 +75,7 @@ void lcPartPaletteDialog::on_NewButton_clicked()
return;
QListWidgetItem* Item = new QListWidgetItem(Name);
Item->setData(Qt::UserRole, qVariantFromValue<uintptr_t>(0));
Item->setData(Qt::UserRole, QVariant::fromValue<uintptr_t>(0));
ui->PaletteList->addItem(Item);
ui->PaletteList->setCurrentRow(ui->PaletteList->count() - 1);
UpdateButtons();
@ -147,7 +147,7 @@ void lcPartPaletteDialog::on_ImportButton_clicked()
#endif
QListWidgetItem* Item = new QListWidgetItem(Palette->Name);
Item->setData(Qt::UserRole, qVariantFromValue<uintptr_t>(reinterpret_cast<uintptr_t>(Palette)));
Item->setData(Qt::UserRole, QVariant::fromValue<uintptr_t>(reinterpret_cast<uintptr_t>(Palette)));
ui->PaletteList->addItem(Item);
ui->PaletteList->setCurrentRow(ui->PaletteList->count() - 1);
UpdateButtons();

View file

@ -46,7 +46,7 @@ void lcScene::End()
std::sort(mOpaqueMeshes.begin(), mOpaqueMeshes.end(), OpaqueMeshCompare);
auto TranslucentMeshCompare = [this](const lcTranslucentMeshInstance& Mesh1, const lcTranslucentMeshInstance& Mesh2)
auto TranslucentMeshCompare = [](const lcTranslucentMeshInstance& Mesh1, const lcTranslucentMeshInstance& Mesh2)
{
return Mesh1.Distance > Mesh2.Distance;
};

View file

@ -164,7 +164,7 @@ void lcTimelineWidget::Update(bool Clear, bool UpdateItems)
{
PieceItem = new QTreeWidgetItem();
PieceItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
PieceItem->setData(0, Qt::UserRole, qVariantFromValue<uintptr_t>((uintptr_t)Piece));
PieceItem->setData(0, Qt::UserRole, QVariant::fromValue<uintptr_t>((uintptr_t)Piece));
StepItem->insertChild(PieceItemIndex, PieceItem);
mItems[Piece] = PieceItem;

View file

@ -1508,7 +1508,7 @@ void Project::ExportHTML(const lcHTMLExportOptions& Options)
QString ProjectTitle = GetTitle();
auto AddPartsListImage = [this, &Dir](QTextStream& Stream, lcModel* Model, lcStep Step, const QString& BaseName)
auto AddPartsListImage = [&Dir](QTextStream& Stream, lcModel* Model, lcStep Step, const QString& BaseName)
{
QImage Image = Model->GetPartsListImage(1024, Step);

View file

@ -2556,6 +2556,7 @@ bool View::IsTrackToolAllowed(lcTrackTool TrackTool, quint32 AllowedTransforms)
case LC_TRACKTOOL_ERASER:
case LC_TRACKTOOL_PAINT:
case LC_TRACKTOOL_COLOR_PICKER:
case LC_TRACKTOOL_ZOOM:
case LC_TRACKTOOL_PAN:
case LC_TRACKTOOL_ORBIT_X:
@ -2564,6 +2565,9 @@ bool View::IsTrackToolAllowed(lcTrackTool TrackTool, quint32 AllowedTransforms)
case LC_TRACKTOOL_ROLL:
case LC_TRACKTOOL_ZOOM_REGION:
return true;
case LC_TRACKTOOL_COUNT:
return false;
}
return false;
@ -2842,6 +2846,9 @@ void View::OnButtonDown(lcTrackButton TrackButton)
case LC_TRACKTOOL_ZOOM_REGION:
StartTracking(TrackButton);
break;
case LC_TRACKTOOL_COUNT:
break;
}
}
@ -3292,6 +3299,9 @@ void View::OnMouseMove()
case LC_TRACKTOOL_ZOOM_REGION:
Redraw();
break;
case LC_TRACKTOOL_COUNT:
break;
}
}

View file

@ -63,7 +63,7 @@ void lcQEditGroupsDialog::on_newGroup_clicked()
QTreeWidgetItem* GroupItem = new QTreeWidgetItem(CurrentItem, QStringList(NewGroup->mName));
GroupItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable);
GroupItem->setData(0, GroupRole, qVariantFromValue<uintptr_t>((uintptr_t)NewGroup));
GroupItem->setData(0, GroupRole, QVariant::fromValue<uintptr_t>((uintptr_t)NewGroup));
}
void lcQEditGroupsDialog::onItemClicked(QTreeWidgetItem *item, int column)
@ -148,7 +148,7 @@ void lcQEditGroupsDialog::AddChildren(QTreeWidgetItem* ParentItem, lcGroup* Pare
QTreeWidgetItem* GroupItem = new QTreeWidgetItem(ParentItem, QStringList(Group->mName));
GroupItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable);
GroupItem->setData(0, GroupRole, qVariantFromValue<uintptr_t>((uintptr_t)Group));
GroupItem->setData(0, GroupRole, QVariant::fromValue<uintptr_t>((uintptr_t)Group));
AddChildren(GroupItem, Group);
}
@ -163,6 +163,6 @@ void lcQEditGroupsDialog::AddChildren(QTreeWidgetItem* ParentItem, lcGroup* Pare
QTreeWidgetItem* PieceItem = new QTreeWidgetItem(ParentItem, QStringList(Piece->GetName()));
PieceItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
PieceItem->setData(0, PieceRole, qVariantFromValue<uintptr_t>((uintptr_t)Piece));
PieceItem->setData(0, PieceRole, QVariant::fromValue<uintptr_t>((uintptr_t)Piece));
}
}

View file

@ -19,7 +19,7 @@ lcQFindDialog::lcQFindDialog(QWidget* Parent, lcSearchOptions* SearchOptions, lc
Model->GetPartsList(gDefaultColor, false, true, PartsList);
for (const auto& PartIt : PartsList)
parts->addItem(PartIt.first->m_strDescription, qVariantFromValue((void*)PartIt.first));
parts->addItem(PartIt.first->m_strDescription, QVariant::fromValue((void*)PartIt.first));
parts->model()->sort(0);
mSearchOptions = SearchOptions;
@ -27,7 +27,7 @@ lcQFindDialog::lcQFindDialog(QWidget* Parent, lcSearchOptions* SearchOptions, lc
ui->findColor->setChecked(mSearchOptions->MatchColor);
ui->color->setCurrentColor(mSearchOptions->ColorIndex);
ui->findID->setChecked(mSearchOptions->MatchInfo);
parts->setCurrentIndex(parts->findData(qVariantFromValue((void*)mSearchOptions->Info)));
parts->setCurrentIndex(parts->findData(QVariant::fromValue((void*)mSearchOptions->Info)));
ui->findName->setChecked(mSearchOptions->MatchName);
ui->name->setText(mSearchOptions->Name);
}

View file

@ -14,7 +14,7 @@ lcQModelListDialog::lcQModelListDialog(QWidget* Parent, QList<QPair<QString, lcM
for (QList<QPair<QString, lcModel*>>::iterator it = Models.begin(); it != Models.end(); it++)
{
QListWidgetItem* Item = new QListWidgetItem(it->first);
Item->setData(Qt::UserRole, qVariantFromValue<uintptr_t>((uintptr_t)it->second));
Item->setData(Qt::UserRole, QVariant::fromValue<uintptr_t>((uintptr_t)it->second));
ui->ModelList->addItem(Item);
}
ui->ModelList->setCurrentRow(lcGetActiveProject()->GetActiveModelIndex());
@ -85,7 +85,7 @@ void lcQModelListDialog::on_NewModel_clicked()
return;
QListWidgetItem* Item = new QListWidgetItem(Name);
Item->setData(Qt::UserRole, qVariantFromValue<uintptr_t>(0));
Item->setData(Qt::UserRole, QVariant::fromValue<uintptr_t>(0));
ui->ModelList->addItem(Item);
UpdateButtons();
}

View file

@ -660,7 +660,7 @@ void lcQPreferencesDialog::updateCommandList()
QKeySequence sequence(mOptions->KeyboardShortcuts.mShortcuts[actionIdx]);
item->setText(0, qApp->translate("Menu", gCommands[actionIdx].MenuName).remove('&').remove(QLatin1String("...")));
item->setText(1, sequence.toString(QKeySequence::NativeText));
item->setData(0, Qt::UserRole, qVariantFromValue(actionIdx));
item->setData(0, Qt::UserRole, QVariant::fromValue(actionIdx));
if (mOptions->KeyboardShortcuts.mShortcuts[actionIdx] != gCommands[actionIdx].DefaultShortcut)
setShortcutModified(item, true);

View file

@ -532,10 +532,10 @@ QWidget *lcQPropertiesTree::createEditor(QWidget *parent, QTreeWidgetItem *item)
std::sort(SortedPieces.begin(), SortedPieces.end(), PieceCompare);
for (PieceInfo* Info : SortedPieces)
editor->addItem(Info->m_strDescription, qVariantFromValue((void*)Info));
editor->addItem(Info->m_strDescription, QVariant::fromValue((void*)Info));
PieceInfo *info = (PieceInfo*)item->data(0, PropertyValueRole).value<void*>();
editor->setCurrentIndex(editor->findData(qVariantFromValue((void*)info)));
editor->setCurrentIndex(editor->findData(QVariant::fromValue((void*)info)));
connect(editor, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSetValue(int)));
@ -807,7 +807,7 @@ QTreeWidgetItem *lcQPropertiesTree::addProperty(QTreeWidgetItem *parent, const Q
newItem->setData(0, PropertyTypeRole, QVariant(propertyType));
newItem->setFlags(newItem->flags() | Qt::ItemIsEditable);
setItemExpanded(newItem, true);
newItem->setExpanded(true);
if (propertyType == PropertyGroup)
{
@ -987,7 +987,7 @@ void lcQPropertiesTree::SetPiece(const lcArray<lcObject*>& Selection, lcObject*
QString text = Info ? Info->m_strDescription : QString();
partID->setText(1, text);
partID->setToolTip(1, text);
partID->setData(0, PropertyValueRole, qVariantFromValue((void*)Info));
partID->setData(0, PropertyValueRole, QVariant::fromValue((void*)Info));
}
void lcQPropertiesTree::SetCamera(lcObject* Focus)
@ -1077,7 +1077,7 @@ void lcQPropertiesTree::SetCamera(lcObject* Focus)
cameraFar->setData(0, PropertyValueRole, ZFar);
cameraName->setText(1, Name);
cameraName->setData(0, PropertyValueRole, qVariantFromValue((void*)Name));
cameraName->setData(0, PropertyValueRole, QVariant::fromValue((void*)Name));
}
void lcQPropertiesTree::SetLight(lcObject* Focus)

View file

@ -192,7 +192,7 @@ void lcQSelectDialog::AddChildren(QTreeWidgetItem* ParentItem, lcGroup* ParentGr
continue;
QTreeWidgetItem* PieceItem = new QTreeWidgetItem(ParentItem, QStringList(Piece->GetName()));
PieceItem->setData(0, IndexRole, qVariantFromValue<uintptr_t>((uintptr_t)Piece));
PieceItem->setData(0, IndexRole, QVariant::fromValue<uintptr_t>((uintptr_t)Piece));
PieceItem->setCheckState(0, Piece->IsSelected() ? Qt::Checked : Qt::Unchecked);
}
@ -206,7 +206,7 @@ void lcQSelectDialog::AddChildren(QTreeWidgetItem* ParentItem, lcGroup* ParentGr
continue;
QTreeWidgetItem *cameraItem = new QTreeWidgetItem(ParentItem, QStringList(Camera->GetName()));
cameraItem->setData(0, IndexRole, qVariantFromValue<uintptr_t>((uintptr_t)Camera));
cameraItem->setData(0, IndexRole, QVariant::fromValue<uintptr_t>((uintptr_t)Camera));
cameraItem->setCheckState(0, Camera->IsSelected() ? Qt::Checked : Qt::Unchecked);
}
@ -218,7 +218,7 @@ void lcQSelectDialog::AddChildren(QTreeWidgetItem* ParentItem, lcGroup* ParentGr
continue;
QTreeWidgetItem *lightItem = new QTreeWidgetItem(ParentItem, QStringList(Light->GetName()));
lightItem->setData(0, IndexRole, qVariantFromValue<uintptr_t>((uintptr_t)Light));
lightItem->setData(0, IndexRole, QVariant::fromValue<uintptr_t>((uintptr_t)Light));
lightItem->setCheckState(0, Light->IsSelected() ? Qt::Checked : Qt::Unchecked);
}
}