From 134cad32d73c776ffdc9db89a24f582bb847f165 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 17 Oct 2015 17:48:34 +0200 Subject: QtCore: use printf-style qWarning/qDebug where possible (I) The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "" with qWarning("..."). Saves ~750b in text size on optimized GCC 5.3 AMD64 builds. Change-Id: I8bf3e46cd5a6b2cae0ceb3e355a50f61925c63d3 Reviewed-by: Kai Koehne --- src/corelib/itemmodels/qsortfilterproxymodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/itemmodels') diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index dc159c8f7c..18cb49d483 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -376,7 +376,7 @@ QModelIndex QSortFilterProxyModelPrivate::proxy_to_source(const QModelIndex &pro if (!proxy_index.isValid()) return QModelIndex(); // for now; we may want to be able to set a root index later if (proxy_index.model() != q_func()) { - qWarning() << "QSortFilterProxyModel: index from wrong model passed to mapToSource"; + qWarning("QSortFilterProxyModel: index from wrong model passed to mapToSource"); Q_ASSERT(!"QSortFilterProxyModel: index from wrong model passed to mapToSource"); return QModelIndex(); } @@ -394,7 +394,7 @@ QModelIndex QSortFilterProxyModelPrivate::source_to_proxy(const QModelIndex &sou if (!source_index.isValid()) return QModelIndex(); // for now; we may want to be able to set a root index later if (source_index.model() != model) { - qWarning() << "QSortFilterProxyModel: index from wrong model passed to mapFromSource"; + qWarning("QSortFilterProxyModel: index from wrong model passed to mapFromSource"); Q_ASSERT(!"QSortFilterProxyModel: index from wrong model passed to mapFromSource"); return QModelIndex(); } -- cgit v1.2.3