Results 1 to 3 of 3

Thread: Custom Widget Plugin "cannot instantiate abstract class" porting from Qt3 to Qt4

  1. #1
    Join Date
    Aug 2006
    Posts
    77
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Custom Widget Plugin "cannot instantiate abstract class" porting from Qt3 to Qt4

    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:
    Qt Code:
    1. virtual void paintRow( Q3Painter *p, const QColorGroup &cg, int row, CRow *pRow ) = 0;
    To copy to clipboard, switch view to plain text mode 

    In my plugin class:

    Qt Code:
    1. QWidget *CLargeListPlugin::createWidget(QWidget *parent)
    2. {
    3. return new CLargeList(parent);
    4. }
    To copy to clipboard, switch view to plain text mode 
    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:
    Qt Code:
    1. virtual void paintRow( Q3Painter * /*p*/, const QColorGroup & /*cg*/, int /*row*/, CRow * /*pRow*/ ) { ; }
    To copy to clipboard, switch view to plain text mode 
    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Custom Widget Plugin "cannot instantiate abstract class" porting from Qt3 to Qt4

    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.

  3. #3
    Join Date
    Aug 2006
    Posts
    77
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Custom Widget Plugin "cannot instantiate abstract class" porting from Qt3 to Qt4

    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.

Similar Threads

  1. Custom Widget Plugin Analog Clock
    By kemp in forum Qt Programming
    Replies: 8
    Last Post: 11th August 2006, 14:22
  2. How to initialize properties to a custom plugin widget?
    By high_flyer in forum Qt Programming
    Replies: 2
    Last Post: 28th February 2006, 17:56
  3. Replies: 12
    Last Post: 15th February 2006, 11:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.