diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2016-05-09 20:24:04 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2016-05-10 18:37:18 +0000 |
commit | 38fc6ad3e789c69dd09b0c494ead107d6da10807 (patch) | |
tree | 003b2ab0da52fe43dea5b7bc6dc9732740295db6 | |
parent | 75b595a6867652cc2b3ff8b2749f91236b6cb58c (diff) | |
download | qttools-38fc6ad3e789c69dd09b0c494ead107d6da10807.tar.gz |
Don't use qDebug for formatted output - but QDebug is ok
That's the difference between readable output and unreadable mess.
Good:
QPlatformSurfaceEvent(surfaceEventType=SurfaceCreated)
QEvent(WinIdChange, 0x7ffdadee2bd0)
QEvent(WindowIconChange, 0x7ffdadee2d30)
Bad:
[351295.324] qev(88029 88029)(Widget::event|QApplicationPrivate::notify_helper|QApplication::notify|QCoreApplication::notifyInternal2|QCoreApplication::sendEvent|?libQt5Widgets.t.so.5?|QApplicationPrivate::notify_helper|QApplication::notify|QCoreApplication::notifyInternal2|QCoreApplication::sendEvent):
QPlatformSurfaceEvent(surfaceEventType=SurfaceCreated)
[351295.333] qev(88029 88029)(Widget::event|QApplicationPrivate::notify_helper|QApplication::notify|QCoreApplication::notifyInternal2|QCoreApplication::sendEvent|QWidgetPrivate::setWinId|QWidgetPrivate::create_sys|QWidget::create|QWidget::setVisible|QWidget::show):
QEvent(WinIdChange, 0x7ffca6714280)
[351295.333] qev(88029 88029)(Widget::event|QApplicationPrivate::notify_helper|QApplication::notify|QCoreApplication::notifyInternal2|QCoreApplication::sendEvent|?libQt5Widgets.t.so.5?|QApplicationPrivate::notify_helper|QApplication::notify|QCoreApplication::notifyInternal2|QCoreApplication::sendEvent):
QEvent(WindowIconChange, 0x7ffca67143e0)
Change-Id: Id69569111e7d4e619e22ffff144d16fb04876219
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | src/qev/qev.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/qev/qev.cpp b/src/qev/qev.cpp index aff170d97..bd30e64b1 100644 --- a/src/qev/qev.cpp +++ b/src/qev/qev.cpp @@ -38,6 +38,8 @@ QT_USE_NAMESPACE +QIODevice *qout; + class Widget : public QWidget { public: @@ -46,7 +48,7 @@ public: bool event(QEvent *e) { if (e->type() == QEvent::ContextMenu) return false; - qDebug() << e; + QDebug(qout) << e << endl; return QWidget::event(e); } }; @@ -55,6 +57,11 @@ public: int main(int argc, char **argv) { QApplication app(argc, argv); + + QFile fout; + fout.open(stdout, QIODevice::WriteOnly); + qout = &fout; + Widget w; w.show(); return app.exec(); |