Bug 180908

Summary: digiKam does not compile with recent Qt 4.5 snapshot; QVariant issue
Product: [Applications] digikam Reporter: Christoph Feck <cfeck>
Component: Portability-CompilationAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: marcel.wiesweg
Priority: NOR    
Version: 0.10.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Unspecified   
Latest Commit: Version Fixed In: 0.10.0

Description Christoph Feck 2009-01-16 02:07:16 UTC
Version:            (using Devel)
Installed from:    Compiled sources

Compiling digiKam with latest Qt 4.5 snapshot results in a compilation error. The QVariant(void *) constructor has been made private.

When passing pointers to QVariant, the constructor QVariant(int typeOrUserType, const void *copy) should be used. It may require registering a custom QVariant type.

What follows is the detailed error message:

/usr/local/qt4/include/QtCore/qvariant.h: In member function 'virtual QVariant Digikam::AbstractAlbumModel::data(const QModelIndex&, int) const':
/usr/local/qt4/include/QtCore/qvariant.h:408: error: 'QVariant::QVariant(void*)' is private
/mnt/svn/kde/trunk/extragear/graphics/digikam/digikam/albummodel.cpp:167: error: within this context
make[2]: *** [digikam/digikam/CMakeFiles/digikam.dir/albummodel.o] Error 1
make[1]: *** [digikam/digikam/CMakeFiles/digikam.dir/all] Error 2
make: *** [all] Error 2
-- Failed: extragear/graphics
Comment 1 Pino Toscano 2009-01-16 02:28:54 UTC
(In reply to comment #0)
> When passing pointers to QVariant, the constructor QVariant(int typeOrUserType,
> const void *copy) should be used. It may require registering a custom QVariant
> type.

Or the simpler QVariant::fromValue(mypointer) / qVariantFromValue(mypointer).
Comment 2 caulier.gilles 2009-01-16 08:12:57 UTC
Marcel,

I don't have Qt 4.5 here to test... What do you think about Pino tip from #1 ?

Gilles
Comment 3 Marcel Wiesweg 2009-01-16 17:19:11 UTC
SVN commit 912061 by mwiesweg:

Declare Album* as Metatype and use QVariant::fromValue.
Did not compile with Qt4.5

CCBUG: 180908

 M  +2 -0      album.h  
 M  +1 -1      albummodel.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=912061
Comment 4 Marcel Wiesweg 2009-01-16 17:20:12 UTC
Christoph, can you test compilation? We all dont have Qt4.5.
Comment 5 Christoph Feck 2009-01-16 18:18:04 UTC
r912061 compiles with Qt 4.5 snapshot 20090116, thanks!

Note that Marble currently has the same bug, so I had to compile digiKam without libmarblewidget support. All other dependencies enabled, as far as CMake report is correct.