PDA

View Full Version : Custom Widget Plugin "cannot instantiate abstract class" porting from Qt3 to Qt4



kemp
24th August 2006, 10:50
Hi!

I am porting custom widget plugins for Qt Designer from Qt3 to Qt4.
I managed to solve all errors except one.
I have a PURE VIRTUAL function which is not implemented:


virtual void paintRow( Q3Painter *p, const QColorGroup &cg, int row, CRow *pRow ) = 0;


In my plugin class:



QWidget *CLargeListPlugin::createWidget(QWidget *parent)
{
return new CLargeList(parent);
}

It says:



>.\largelistplugin.cpp(61) : error C2259: 'CLargeList' : cannot instantiate abstract class
> due to following members:
> 'void CLargeList:: paintRow(Q3Painter *,const QColorGroup &,int,CRow *)' : is abstract
>d:\projcomp\qt\largelist\largelist.h(122) : see declaration of 'CLargeList:: paintRow'


I have tried this and it works:


virtual void paintRow( Q3Painter * /*p*/, const QColorGroup & /*cg*/, int /*row*/, CRow * /*pRow*/ ) { ; }

but when i want to use my plugin in a test application i get an unresolved external simbol error.


How can i create a working plugin?

I am looking forward for your help.
Thank you.

high_flyer
24th August 2006, 14:44
Designer plugins in Qt4 need quite some changes when ported.
Show the full code, what you posted is not enough inorder to see the problem.

kemp
25th August 2006, 12:35
Hi!

I found out that the linker error was not caused by the default virtual function.
So the default function is solving the problem with pure virtual function.

Thank you.