Hi!

I have a problem with a custom slot of a QLabel. The error that the compiler gives is:

Object::connect: No such slot QLabel::displayIzquierda(int)
Object::connect: (receiver name: 'izquierda')

It is the first time that I have a slot and i don't know where the error may be.

Thanks in advance!!!

trasera.h
Qt Code:
  1. #ifndef TRASERA_H
  2. #define TRASERA_H
  3. #include <QtGui>
  4. #include "ui_trasera.h"
  5. #include "../include/prueba/ultrasonidos.h"
  6.  
  7. class Ultrasonidos;
  8.  
  9. class Trasera : public QWidget
  10. {
  11. Q_OBJECT
  12.  
  13. public:
  14. explicit Trasera(const QString &title, const QString &content, const QString &imagePath, QWidget *parent = 0);
  15.  
  16. Ui::trasera ui;
  17.  
  18. Ultrasonidos *ultra;
  19. void inicializarInterfazUltrasonidos();
  20.  
  21. public slots:
  22. void displayIzquierda (int i);
  23. };
  24.  
  25. #endif // TRASERA_H
To copy to clipboard, switch view to plain text mode 


trasera.cpp
Qt Code:
  1. #include "../include/prueba/trasera.h"
  2. #include "../build/ui_trasera.h"
  3. #include <QtGui>
  4. #include <qt4/QtCore/qnamespace.h>
  5.  
  6. Trasera::Trasera(const QString &title, const QString &content, const QString &imagePath, QWidget *parent) :
  7. QWidget(parent)
  8. {
  9. ui.setupUi(this);
  10. ultra = new Ultrasonidos();
  11. inicializarInterfazUltrasonidos();
  12. }
  13.  
  14. void Trasera::inicializarInterfazUltrasonidos()
  15. {
  16. connect(ultra, SIGNAL(datoIzquierda(int)), ui.izquierda, SLOT(displayIzquierda(int))); <---------- FAIL //NOTE: ui.izquierda is a Qlabel
  17. }
  18.  
  19. void Trasera::displayIzquierda(int i) {
  20. switch(i) {
  21. case 0:
  22. ui.izquierda->setPixmap(QPixmap(QString::fromUtf8(":/images/verde")));
  23. break;
  24. case 1:
  25. ui.izquierda->setPixmap(QPixmap(QString::fromUtf8(":/images/amarillo")));
  26. break;
  27. }
  28. }
To copy to clipboard, switch view to plain text mode 


Ultrasonidos.h
Qt Code:
  1. class Ultrasonidos : public QThread
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. Ultrasonidos();
  7.  
  8. signals:
  9.  
  10. void datoIzquierda(int i);
  11.  
  12. };
To copy to clipboard, switch view to plain text mode