Hello, friends!
I want to create a special version of QTableWidget that does special things when it is clicked on some if its cells.
I will reuse it several times.
I've created a new class SelVarTable
Qt Code:
  1. class SelVarTable
  2. {
  3. Q_OBJECT
  4. private:
  5. QTableWidget *myTable;
  6. // some other stuff
  7. public slots:
  8. void cellClicked_(int r, int c);
  9. // some other stuff
  10. };
To copy to clipboard, switch view to plain text mode 
and I wrote the following initialization code:
Qt Code:
  1. SelVarTable::SelVarTable(QWidget *parent)
  2. {
  3. myTable=new QTableWidget(parent);
  4. // some other stuff
  5. QObject::connect(myTable, SIGNAL(cellClicked(int,int)), this, SLOT(cellClicked_(int,int)));
  6. }
To copy to clipboard, switch view to plain text mode 

But when I compile I get for the QObject::connect (row 5 of the above code) command the following error
error: no matching function for call to 'QObject::connect(QTableWidget*&, const char*, SelVarTable* const, const char*)'
candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
note: static bool QObject::connect(const QObject*, const QMetaMethod&, const QObject*, const
note: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const

I could not understand what is wrong.
I cannot believe that it is not possible to connect a signal in a QWidget to a slot in a class that has that QWidget as one of its elements.

I've also tried a totally different way (inheriting SelVarTable from QTableWidget) but had other issues. I first will try to understand why this code does not work.

Someone can help?

Thank you.