From 04d5f49f6d24b7067899fc2bf44b887fbe1b1651 Mon Sep 17 00:00:00 2001 From: Jean-Louis Boudrand Date: Thu, 28 Dec 2017 15:10:55 +0100 Subject: [PATCH] Use QString::number easier to read + typos --- tools/assimp_qt_viewer/mainwindow.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tools/assimp_qt_viewer/mainwindow.cpp b/tools/assimp_qt_viewer/mainwindow.cpp index 0dffec2c6..acfc8e589 100644 --- a/tools/assimp_qt_viewer/mainwindow.cpp +++ b/tools/assimp_qt_viewer/mainwindow.cpp @@ -39,7 +39,7 @@ QTime time_begin = QTime::currentTime(); aiProcess_GenUVCoords | aiProcess_TransformUVCoords | aiProcess_FlipUVs); if(mScene != nullptr) { - ui->lblLoadTime->setText(QString("%1").arg(time_begin.secsTo(QTime::currentTime()))); + ui->lblLoadTime->setText(QString::number(time_begin.secsTo(QTime::currentTime()))); LogInfo("Import done: " + pFileName); // Prepare widgets for new scene. ui->leFileName->setText(pFileName.right(pFileName.length() - pFileName.lastIndexOf('/') - 1)); @@ -89,7 +89,7 @@ QTime time_begin = QTime::currentTime(); { ResetSceneInfos(); - QString errorMessage = QString("Error parsing \'%1\' : \'%2\'").arg(pFileName).arg(mImporter.GetErrorString(); + QString errorMessage = QString("Error parsing \'%1\' : \'%2\'").arg(pFileName).arg(mImporter.GetErrorString()); QMessageBox::critical(this, "Import error", errorMessage); LogError(errorMessage); }// if(mScene != nullptr) @@ -240,8 +240,8 @@ using namespace Assimp; void MainWindow::Paint_Finished(const size_t pPaintTime_ms, const GLfloat pDistance) { - ui->lblRenderTime->setText(QString("%1").arg(pPaintTime_ms)); - ui->lblDistance->setText(QString("%1").arg(pDistance)); + ui->lblRenderTime->setText(QString::number(pPaintTime_ms)); + ui->lblDistance->setText(QString::number(pDistance)); } void MainWindow::SceneObject_Camera(const QString& pName) @@ -282,9 +282,10 @@ QString filename, filter, format_id; Exporter exporter; QTime time_begin; aiReturn rv; -QStringList exporterList; +QStringList exportersList; QMap exportersMap; + if(mScene == nullptr) { QMessageBox::critical(this, "Export error", "Scene is empty"); @@ -295,13 +296,13 @@ QMap exportersMap; for (int i = 0; i < exporter.GetExportFormatCount(); ++i) { const aiExportFormatDesc* desc = exporter.GetExportFormatDescription(i); - exporterList.push_back(desc->id + QString(": ") + desc->description); + exportersList.push_back(desc->id + QString(": ") + desc->description); exportersMap.insert(desc->id, desc); } // get an exporter bool dialogSelectExporterOk; - QString selectedExporter = QInputDialog::getItem(this, "Export format", "Select the exporter : ", exporterList, 0, false, &dialogSelectExporterOk); + QString selectedExporter = QInputDialog::getItem(this, "Export format", "Select the exporter : ", exportersList, 0, false, &dialogSelectExporterOk); if (!dialogSelectExporterOk) return; @@ -318,13 +319,14 @@ QMap exportersMap; // begin export time_begin = QTime::currentTime(); rv = exporter.Export(mScene, selectedId.toLocal8Bit(), filename.toLocal8Bit(), aiProcess_FlipUVs); - ui->lblExportTime->setText(QString("%1").arg(time_begin.secsTo(QTime::currentTime()))); + ui->lblExportTime->setText(QString::number(time_begin.secsTo(QTime::currentTime()))); if(rv == aiReturn_SUCCESS) LogInfo("Export done: " + filename); else { - LogError("Export failed: " + filename); - QMessageBox::critical(this, "Error", "Export failed: " + filename); + QString errorMessage = QString("Export failed: ") + filename; + LogError(errorMessage); + QMessageBox::critical(this, "Export error", errorMessage); } }