Error when connecting a custom class and MainWindow
-
This post is deleted!
-
This post is deleted!
-
This post is deleted!
@Forfunckle
In a word, especially if you sound like you are writing new Qt code, switch to the new, compile-time-supported way of connecting signals & slots, as documented in https://doc.qt.io/qt-5/signalsandslots.html or read through https://wiki.qt.io/New_Signal_Slot_Syntax, instead of usingSIGNAL()
&SLOT()
macros. You will get a (more) meaningful compile-time error for whatever your fault is.In this case,
"no known conversion from 'Button *' to 'const QObject *'
leads me to wonder what yourButton
class is? It sounds like it isn't even aQWidget
....? -
Hi
the syntax is not correct should be
connect(button, SIGNAL(sendDeleteSignal()), this, SLOT(checkForDeletes()));
with no classname:: and would show paramters if it has any.Also
Did you remember Q_OBJECTclass Button : public QPushButton
{
Q_OBJECTPlease show Buttons .h file
It must also inherit from a QWidget or QObject which your error suggests you did not.
And as @JonB says, the new syntax is far better as it helps to find errors.
connect(button, &Button::sendDeleteSignal, this, &MainWindow::checkForDeletes);
-
This post is deleted!