另外,
w.connect(&w, SIGNAL(clicked()), &t, SLOT(slt()), type);
w.connect(&w, SIGNAL(clicked()), &t, SLOT(slt()), type);
换成
w.connect(&w, &QPushButton::clicked, &t, &Test::slt, type);
w.connect(&w, &QPushButton::clicked, &t, &Test::slt, type);
也工作正常。
当然二者混合是不行的,比如
w.connect(&w, SIGNAL(clicked()), &t, SLOT(slt()), type);
w.connect(&w, &QPushButton::clicked, &t, &Test::slt, type);