[Qt-interest] Adding custom widget plugins error/problem

miroslav miroslav at keytos.no
Wed Mar 11 08:57:55 CET 2009


Hi All,

unfortunately am still having a problem. 
The point is that when I create a library (*.so) from the QtCreator
example - worldtimeclock, everything was compiled OK.

Question is that what everything I have to do to plug it to for example
a MainWindow.

1 - move it to Qcreator/designer/plugin folder (or other appropriate
path)
2 - restart QtCreator
3 - move the new plugin to your MainForm - in the designer view (this is
what I have already done)
4 - copy appropriate header file
5 - WHAT ELSE? 
   - do I have to include the lib file also in the *.pro file?
   - some special code in the MainFrame?



I have added the include in the *.pro file and now I'm not getting build
errors, but when I execute the application I'm ending up with:
"error while loading shared libraries: libworldtimeclockplugin.so:
cannot open shared object file: No such file or directory"

Is costom widget plugin a shared library? 

Thank you in advance,... ;o)

Miroslav



On Tue, 2009-03-10 at 19:45 -0700, Malyushytsky, Alex wrote:
> It looks like compiler complains on  WorldTimeClock::WorldTimeClock(QWidget*)
> 
> You need constructor taking QWidget* of WorldTimeClock  class as a parameter not QObject* of WorldTimeClockPlugin, which is fine.
> 
> Something like this:
> 
> WorldTimeClock::WorldTimeClock (QWidget *parent)
> : QWidget(parent)
> {
> .....
> }
> 
> You either missing include , in this case find which file has this definition ( even if it was generated ) and add appropriate include.
> 
> Or you forgot to declare / define this constructor in your code.
> 
> 
> Regards,
>    Alex
> 
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of miroslav
> Sent: Tuesday, March 10, 2009 5:13 AM
> To: Andreas Pakulat
> Cc: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] Adding custom widget plugins error/problem
> 
> Hi,
> 
> the custom widget constructor is specified here:
> 
> WorldTimeClockPlugin::WorldTimeClockPlugin(QObject *parent)
> : QObject(parent)
> {
> initialized = false;
> }
> 
> 
> Please, where should I initialize the constructor? I'm designing
> (importing custom widgets) via designer in QtCreator. That is making
> ui_*.h file - that I can not modify.
> 
> thnks,
> Miro
> 
> 
> 
> 
> 
> 
> On Tue, 2009-03-10 at 11:14 +0100, Andreas Pakulat wrote:
> > On 10.03.09 11:05:02, miroslav wrote:
> > > Hi,
> > >
> > > thanks for the reply,...but....please can you give me more hints?
> > > Constructor where/what? In the main window where I want to have the
> > > CustomWidgetPlugin?
> >
> > Your custom widget has a constructor and that one needs to have QWidget*
> > parameter as first, passing it on to its parent class. Looking again at
> > your error message, you might even have that constructor declared, but
> > didn't implement it.
> >
> > Andreas
> >
> 
> On Tue, 2009-03-10 at 10:27 +0100, Andreas Pakulat wrote:
> > On 10.03.09 09:52:59, miroslav wrote:
> > > Hi All,
> > > please can you help me with this?
> > >
> > > I have compiled the worldtimeclockplugin and placed it into
> > > QtCreator/Designer folder.
> > >
> > > When I move it to my form and compile it I'm getting following
> error:
> > >
> > > /media/disk/01_SourceCodes/05_VFST/src/ui_VFST.h:80: undefined
> reference
> > > to `WorldTimeClock::WorldTimeClock(QWidget*)'
> > > :-1: error: collect2: ld returned 1 exit status
> > >
> > >
> > > On line 80: was generated following code:
> > > worldTimeClock = new WorldTimeClock(centralWidget);
> > >
> > >
> > > Please do you know that what can be the problem?
> >
> > You didn't specify a constructor for your custom widget usable for the
> > generated code. You have to supply a constructor taking a QWidget*
> > argument, just like QWidget and QWidget derived classes in the Qt API
> do.
> >
> > Andreas
> >
> 
> 
> 
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
> 
> 
> ---------------------------------------------------------------------------------------------------
> Weidlinger Associates, Inc. made the following annotations.
> 
> "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
> 
> "Please consider our environment before printing this email."
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest





More information about the Qt-interest-old mailing list