diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-10-24 22:31:27 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-05-03 04:35:06 +0000 |
commit | 5a76a3fb03f8d1dc8cb367de1a1dc6a37048376a (patch) | |
tree | 2328d894da121bd0912cb9777f6254cc62296946 /src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp | |
parent | 0eaac0a3a95f8a74c06d062d3aa7928cbb09d493 (diff) |
QtBase: use printf-style qWarning/qDebug where possible (II)
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 second part, replace
qWarning() << "" << non-QString
with
qWarning("..%.", non-QString).
QString (and QUrl etc) have special escaping handling when streamed
into QDebug, so leave those alone. They also seem to expand to less
code than the qPrintable() alternative, so there's no reason to
replace them.
Saves 2KiB, 3.4KiB, ~750b and ~450b in text size in QtCore, Gui,
Network and Widgets, resp., on optimized GCC 5.3 AMD64 builds.
Change-Id: Iae6823e543544347e628ca1060d6d51e3b04d3f4
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp')
-rw-r--r-- | src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp index 79ff74b113..ce3a445d7c 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp @@ -721,7 +721,7 @@ void QQnxInputContext::update(Qt::InputMethodQueries queries) initEvent(&caretEvent.event, sInputSession, EVENT_CARET, CARET_POS_CHANGED, sizeof(caretEvent)); caretEvent.old_pos = lastCaret; caretEvent.new_pos = m_caretPosition; - qInputContextDebug() << "ictrl_dispatch_event caret changed" << lastCaret << m_caretPosition; + qInputContextDebug("ictrl_dispatch_event caret changed %d %d", lastCaret, m_caretPosition); p_ictrl_dispatch_event(&caretEvent.event); } } @@ -914,7 +914,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan navigation_event_t navEvent; initEvent(&navEvent.event, sInputSession, EVENT_NAVIGATION, key, sizeof(navEvent)); navEvent.magnitude = 1; - qInputContextDebug() << "ictrl_dispatch_even navigation" << key; + qInputContextDebug("ictrl_dispatch_even navigation %d", key); p_ictrl_dispatch_event(&navEvent.event); } } else { @@ -927,7 +927,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan keyEvent.sequence_id = sequenceId; p_ictrl_dispatch_event(&keyEvent.event); - qInputContextDebug() << "ictrl_dispatch_even key" << key; + qInputContextDebug("ictrl_dispatch_even key %d", key); } return true; @@ -943,7 +943,7 @@ void QQnxInputContext::updateCursorPosition() QCoreApplication::sendEvent(input, &query); m_caretPosition = query.value(Qt::ImCursorPosition).toInt(); - qInputContextDebug() << m_caretPosition; + qInputContextDebug("%d", m_caretPosition); } void QQnxInputContext::endComposition() @@ -1116,7 +1116,7 @@ int32_t QQnxInputContext::processEvent(event_t *event) int flags = KEY_SYM_VALID | KEY_CAP_VALID; if (event->event_id == IMF_KEY_DOWN) flags |= KEY_DOWN; - qInputContextDebug() << "EVENT_KEY" << flags << keySym; + qInputContextDebug("EVENT_KEY %d %d", flags, keySym); QQnxScreenEventHandler::injectKeyboardEvent(flags, keySym, modifiers, 0, keyCap); result = 0; break; @@ -1156,7 +1156,7 @@ int32_t QQnxInputContext::onCommitText(spannable_string_t *text, int32_t new_cur int32_t QQnxInputContext::onDeleteSurroundingText(int32_t left_length, int32_t right_length) { - qInputContextDebug() << "L:" << left_length << " R:" << right_length; + qInputContextDebug("L: %d R: %d", int(left_length), int(right_length)); QObject *input = qGuiApp->focusObject(); if (!input) |