D26320: endl is Qt:: namespaced in qt5.15. Port to \n and flush when QTextStream is not on a QFile

Friedrich W. H. Kossebau noreply at phabricator.kde.org
Wed Jan 1 03:15:58 GMT 2020


kossebau added a comment.


  @mlaurent  Bonne année :) Hm, are we sure that endl is namespaced with Qt:: in 5.15 already? Isn't that rather Qt6 only?
  
  For Qt5 `endl` is in the namespace `QTextStreamFunctions` rather, which though is also inlined by `using namespace QTextStreamFunctions`, so that should still compile, no?
  IMHO this should be rather only ported/touched during Qt6 then. Well, unless doing the flush only at the end is an improvement of course.
  
  See https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/serialization/qtextstream.h:
  
    #if defined(Q_QDOC) || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    namespace Qt {
    #else
    // This namespace only exists for 'using namespace' declarations.
    namespace QTextStreamFunctions {
    #endif
    // [...]
    Q_CORE_EXPORT QTextStream &endl(QTextStream &s);
    // [...]
    
    } // namespace QTextStreamFunctions
    
    #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_QDOC)
    namespace Qt {
    using namespace QTextStreamFunctions;
    }
    
    QT_WARNING_PUSH
    QT_WARNING_DISABLE_CLANG("-Wheader-hygiene")
    // We use 'using namespace' as that doesn't cause
    // conflicting definitions compiler errors.
    using namespace QTextStreamFunctions;
    QT_WARNING_POP
    #endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_QDOC)

REPOSITORY
  R269 BluezQt

REVISION DETAIL
  https://phabricator.kde.org/D26320

To: mlaurent, dfaure
Cc: kossebau, apol, kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200101/728a63d8/attachment.html>


More information about the Kde-frameworks-devel mailing list