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 | |
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".
-rw-r--r-- | examples/graphicsview/anchorlayout/anchorlayout.pro | 1 | ||||
-rw-r--r-- | src/gui/graphicsview/qsimplex_p.cpp | 22 |
2 files changed, 11 insertions, 12 deletions
diff --git a/examples/graphicsview/anchorlayout/anchorlayout.pro b/examples/graphicsview/anchorlayout/anchorlayout.pro index c969c8b..c2a1bea 100644 --- a/examples/graphicsview/anchorlayout/anchorlayout.pro +++ b/examples/graphicsview/anchorlayout/anchorlayout.pro @@ -12,3 +12,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/anchorlayout INSTALLS += target sources TARGET = anchorlayout_example +CONFIG+=console
\ No newline at end of file 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; } |