Seite 1 von 1

connect problem

Verfasst: 3. Juni 2006 16:40
von Karldin Shinowa
habe 2 Klassen:

Code: Alles auswählen

class Button:public QPushButton
{
   Q_OBJECT
   
   private:
      int number;

   public:
     Button(int value,std::string name,
             int x,int y,int w,int h, 
             QWidget* parent,LCD*lcd);
      
      short getNumber() const;

   signals:
      void myClicked(Button*button);
   
   public slots:  
      void sendLcdPointer();
};
und

Code: Alles auswählen

class LCD:public QLCDNumber
{
   Q_OBJECT

   private:
      int maxRange;
      

   public:
      LCD(int digits,
          int x,int y,int w,int h, 
          QWidget*parent);

   public slots:
      void newNumber(Button*button);
};
in dem Konstruktor von Button hab ich jetzt connects:

Code: Alles auswählen

 Button::Button(int value,std::string name,
               int x,int y,int w,int h, 
               QWidget*parent,LCD*lcd):
   QPushButton(name.c_str(),parent),number(value)
{
   this->setGeometry(x,y,w,h);

   QObject::connect(this,SIGNAL(  clicked()         ),
                              this,SLOT  (  sendLcdPointer()  ),
                              Qt::DirectConnection);
   
   QObject::connect(this,  SIGNAL(  myClicked(Button*)  ),
                             lcd,   SLOT  (  newNumber(Button*)  ),
                             Qt::DirectConnection);
}
Jetzt sagt er folgendes:

no matching function fount to call to 'Button::connect(Button* const,const char[20],LCD*&,const char[20],Qt::ConectionType)'

canidates are:

static bool QObject::connect( const QObject*,const char*,const QObject*,const char*,Qt::ConectionType)'

bool QObject::connect( const QObject*,const char*,const QObject*,const char*,Qt::ConectionType)'

Was heißt das? Was muss ich tun?

Verfasst: 5. Juni 2006 19:53
von Esleborn
am besten lä#sst du einfach das "QObject::" weg...

er kapiert nicht, ob er die statische oder die geerbte Funktion aufrufen soll... warum auch immer... wenn du das QObject:: weglässt sollte er automatisch die zweitere nehmen