[Development] QIODevice::peek is not virtual. Workaround proposed

André Pönitz andre.poenitz at mathematik.tu-chemnitz.de
Fri Sep 20 20:27:45 CEST 2013


On Fri, Sep 20, 2013 at 01:31:30PM +0200, Stephen Kelly wrote:
> 
> 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().

Did you consider the performance impact on "normal" operation?

Andre'



More information about the Development mailing list