diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-09-25 11:07:42 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-09-25 11:12:30 (GMT) |
commit | 0fa201d84468d82bec4268971eba865c50606e5c (patch) | |
tree | 628563893f64b9d9ab84312d55d33805706e3032 /src/gui | |
parent | 2bea70ee7f25462a6942dff15a21a6d5377433d3 (diff) | |
download | Qt-0fa201d84468d82bec4268971eba865c50606e5c.zip Qt-0fa201d84468d82bec4268971eba865c50606e5c.tar.gz Qt-0fa201d84468d82bec4268971eba865c50606e5c.tar.bz2 |
Use qDebug() instead of printf() when dumping the simplex matrix.
printf() does not work very well on windows, since it will not send the
output to OutputDebugString(). This allows us to catch the output even
if the program is configured without "CONFIG += console".
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/graphicsview/qsimplex_p.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp index 94eb5c0..1ba24a3 100644 --- a/src/gui/graphicsview/qsimplex_p.cpp +++ b/src/gui/graphicsview/qsimplex_p.cpp @@ -333,23 +333,21 @@ void QSimplex::clearColumns(int first, int last) void QSimplex::dumpMatrix() { - printf("---- Simplex Matrix ----\n"); + qDebug("---- Simplex Matrix ----\n"); - printf(" "); + QString str(QLatin1String(" ")); for (int j = 0; j < columns; ++j) - printf(" <% 2d >", j); - printf("\n"); - + str += QString::fromAscii(" <%1 >").arg(j, 2); + qDebug("%s", qPrintable(str)); for (int i = 0; i < rows; ++i) { - printf("Row %2d:", i); + str = QString::fromAscii("Row %1:").arg(i, 2); qreal *row = matrix + i * columns; - for (int j = 0; j < columns; ++j) { - printf(" % 2.2f", row[j]); - } - printf("\n"); + for (int j = 0; j < columns; ++j) + str += QString::fromAscii("%1").arg(row[j], 7, 'f', 2); + qDebug("%s", qPrintable(str)); } - printf("------------------------\n\n"); + qDebug("------------------------\n"); } void QSimplex::combineRows(int toIndex, int fromIndex, qreal factor) @@ -474,7 +472,7 @@ bool QSimplex::iterate() setValueAt(pivotRow, 0, pivotColumn); // dumpMatrix(); - // printf("------------ end of iteration --------------\n"); + // qDebug("------------ end of iteration --------------\n"); return true; } |