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

Malyushytsky, Alex alex at wai.com
Wed Mar 11 03:45:11 CET 2009


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."




More information about the Qt-interest-old mailing list