Unsolved Dialog close() function not showing?
-
Hi, I'm really new to qt so I like experimenting even if its not within the tutorial I'm working on just for more expireince.
I tried to set a push button to close the window but couldn't connect the signal clicked() to the slot close(), the close function wasn't showing up, furthermore I tried to connect them using this code:
connect(ui->pushButton_2, SIGNAL(clicked(bool)), this, SLOT(this->close()));
but that code doesn't work, it only compiles and theres still a red line as if thats an error which it may I'm not sure.
after that I went to the on_pushButton_2_clicked() slot and wrote in the functionthis->close();
which worked fine, can anyone explain why the slot wasn't showing up when I was trying to connect them with the ui window and why my connect function isn't working?
-
@Archy
remove bool and try.SIGNAL(clicked())
-
it still doesn't work :/
-
Hi,
@Archy said in Dialog close() function not showing?:
connect(ui->pushButton_2, SIGNAL(clicked(bool)), this, SLOT(this->close()));
This is wrong, the
SLOT
macro expects a slot signature. Remove thethis->
from it.