[Qt-interest] Object::connect: No such slot

Rohan McGovern rmcgover at trolltech.com
Tue Dec 9 23:34:21 CET 2008


On Tuesday 09 December 2008, xiaolei Shang wrote:
> Hi there:
>
> How did you define the class DripConfigWizard? If it inherits 
> from QWidget, the MyWizard should be initialised as:
>
> MyWizard = dynamic_cast< DripConfigWizard * > (parent);
>

Actually, if the DripPage must always have a DripConfigWizard as its 
parent, then the constructor should take a DripConfigWizard*, not a 
QWidget*, and it shouldn't default to 0.

But I don't think that can be the source of this problem.

>
> > Research & Development
> > ---------------------------------------------------------------
> >---------
> >
> > Hello,
> >
> >     I got a problem when trying to connect signal with slot. my
> > code is:
> >
> > class DripPage : public QWizardPage
> > {
> >     Q_OBJECT
> >     public:
> >         DripPage( QWidget *parent = 0 );
> >         ~DripPage();
> >         ... ...
> >     public slots:
> >         void slotDelete( int which );
> >         ... ...
> > };
> >
> >
> > DripPage::DripPage( QWidget *parent ) : QWizardPage( parent )
> > {
> >     MyWizard = ( DripConfigWizard * ) parent;
> >     ... ...
> >     connect(MyWizard, SIGNAL(customButtonClicked(int)), this,
> > SLOT(slotDelete(int)));
> >     ... ...
> > }
> >
> > void DripPage::slotDelete(int which)
> > {
> >     ... ...
> > }
> >
> >     There is no compile error, but when I run the application,
> > I get an error says:
> > Object::connect:  No such slot DripPage::slotDelete(int).
> > What's the problem with my
> > code? I really don't get it. Can you help me?
> >
> >     Thanks!
> >     Best regards,
> >
> >     Ying Ma
> >

-- 
Rohan McGovern
Qt Software, Nokia



More information about the Qt-interest-old mailing list