diff options
author | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-10-16 19:10:29 (GMT) |
---|---|---|
committer | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-10-26 22:17:54 (GMT) |
commit | 3f29c77a26d0a898ca3a7c9c6715da90f1ecc50a (patch) | |
tree | 94834adbf3483b39b17cf27cbf6024d3efa2608c /src | |
parent | dc89e929d0f60e996c132e9484357e0b42f99436 (diff) | |
download | Qt-3f29c77a26d0a898ca3a7c9c6715da90f1ecc50a.zip Qt-3f29c77a26d0a898ca3a7c9c6715da90f1ecc50a.tar.gz Qt-3f29c77a26d0a898ca3a7c9c6715da90f1ecc50a.tar.bz2 |
QGAL: Add QSimplexConstraint::toString() method for debugging
Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qsimplex_p.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qsimplex_p.h b/src/gui/graphicsview/qsimplex_p.h index 51991a9..423f9bc 100644 --- a/src/gui/graphicsview/qsimplex_p.h +++ b/src/gui/graphicsview/qsimplex_p.h @@ -118,6 +118,29 @@ struct QSimplexConstraint return false; } } + + QString toString() { + QString result; + result += QString::fromAscii("-- QSimplexConstraint %1 --").arg(int(this), 0, 16); + + QHash<QSimplexVariable *, qreal>::const_iterator iter; + for (iter = variables.constBegin(); iter != variables.constEnd(); ++iter) { + result += QString::fromAscii(" %1 x %2").arg(iter.value()).arg(int(iter.key()), 0, 16); + } + + switch (ratio) { + case LessOrEqual: + result += QString::fromAscii(" (less) <= %1").arg(constant); + break; + case MoreOrEqual: + result += QString::fromAscii(" (more) >= %1").arg(constant); + break; + default: + result += QString::fromAscii(" (eqal) == %1").arg(constant); + } + + return result; + } #endif }; |