Using KCompressionDevice with QSaveFile

David Faure faure at kde.org
Wed Dec 4 13:42:19 UTC 2013


On Monday 02 December 2013 22:31:43 Dominik Haumann wrote:
> Hi,
> 
> porting KSaveFile to QSaveFile, I stumbled into the following:
> 
> // This method has been made private so that it cannot be called,
> // in order to prevent mistakes.
> void QSaveFile::close()
> {
>     qFatal("QSaveFile::close called");
> }
> 
> In Kate, we use a QSaveFile saveFile(...); and then use
> 
>   KCompressionDevice compDevice(&saveFile, ...);
> 
> to write compressed data through compDevice into saveFile.
> 
> However, KCompressionDevice at some point always seems to call close(),
> which hits the qFatal().
> 
> Should I derive from QSaveFile and overwrite close() to call commit() ?
> Am I missing something here?

I just added a unittest in kdelibs-frameworks's kfiltertest, and it works for 
me.
Can you check 1) that it works for you, 2) what your code does differently 
from the unittest ? And then change the unittest to show the problem, so I can 
look into it.

Thanks!

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list