Hello,

In grantlee there is a example called htmlapps, which creates a QNetworkReply 
subclass to render a template.

 
https://gitorious.org/grantlee/grantlee/source/master:examples/htmlapps/templatereply.cpp
24d711fc3ac88565a59c45fb6fb2dd1e75a7a9f2
This works with Qt 4.7, but the QWebView displays no content with Qt 4.8 (or 
with the Qt 5 port).

The problem seems to be that in Qt 4.8, the file

 src/3rdparty/webkit/Source/WebCore/platform/network/qt/QtMIMETypeSniffer.cpp

gained a new line:

 QByteArray data = m_reply->peek(m_sniffer.dataSize());

So, it calls peek() on the QNetworkReply object.

Unfortunately, peek() is non-virtual and it is implemented with a call to 
read(). For a QIODevice subclass implementation of read(), it does not know 
whether the call to read should advance its read-pointer (it should not if it 
is actually a peek). 

The solution is to make peek() virtual. This should have happened for Qt 5.0, 
but it did not. All Qt subclasses of QIODevice seem to re-implement a private 
virtual for this purpose, so the issue seems to be long-known. I have pushed a 
patch to add pseudo-virtual slots as a workaround:

 https://codereview.qt-project.org/66023

Any better ideas? Should such a workaround be applied to the Qt 4.8 branch?

Thanks,

-- 
Join us in October at Qt Developer Days 2013 - https://devdays.kdab.com

Stephen Kelly <[email protected]> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to