-1
connect(from_file, SIGNAL(triggered()), MyQPlainTextEdit,
SLOT(on_pushButton_clicked()));

expected primary-expression before ',' token ..

Why this doesn't work? When I use this, it works (in my case this is MyQPlainTextEdit(0x20429230, name="plainTextEdit")), so why this doesn't work?

                                                         ^
Artur Lodklif
  • 83
  • 1
  • 9
  • Because `MyPlainTextEdit` is a class, and you can't connect to a class, only to object. Also, it should be _pointer_ to object. In the case of `this`, it's right. – Michael May 14 '17 at 08:51

1 Answers1

0

The receiver should be an object rather than class name.

So, the code should be:

MyQPlainTextEdit *edit = new MyQPlainTextEdit(this);
connect(from_file, SIGNAL(triggered()), edit, SLOT(on_pushButton_clicked()));
Ziming Song
  • 1,176
  • 1
  • 9
  • 22