summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/generator.cpp
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@digia.com>2013-12-18 23:26:29 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-15 14:55:20 +0200
commit78a1c46a86e205e599d641ffb3eae721705e0d1e (patch)
tree50f9172687afdacd1943826360612615e3704ea4 /src/tools/moc/generator.cpp
parentb526e44a37776861b187de62ebc4e21ba4c67cc4 (diff)
Mark each QT_MOC_LITERAL usage with a comment
The comment shows to which string a QT_MOC_LITERAL is pointing. Change-Id: Ia389d750b1b1c21e2242bad6beceea4f9298ff8e Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r--src/tools/moc/generator.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index d831edfef0..3345cf4d64 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -266,10 +266,12 @@ void Generator::generateCode()
{
int idx = 0;
for (int i = 0; i < strings.size(); ++i) {
- if (i)
- fprintf(out, ",\n");
const QByteArray &str = strings.at(i);
fprintf(out, "QT_MOC_LITERAL(%d, %d, %d)", i, idx, str.length());
+ if (i != strings.size() - 1)
+ fputc(',', out);
+ const QByteArray comment = str.length() > 32 ? str.left(29) + "..." : str;
+ fprintf(out, " // \"%s\"\n", comment.constData());
idx += str.length() + 1;
for (int j = 0; j < str.length(); ++j) {
if (str.at(j) == '\\') {