ui detect mouse event on objects
-
@JonB
the first version:connect(ioGroup, &QButtonGroup::idClicked, this, MainWindow::on_ioGroup_clicked);
is without the object ID, implementing the ID in this version a error occurse.
@Pfanne said in ui detect mouse event on objects:
connect(ioGroup, &QButtonGroup::idClicked, this, MainWindow::on_ioGroup_clicked);
As I said earlier, you have to pass an address:
connect(ioGroup, &QButtonGroup::idClicked, this,
&
MainWindow::on_ioGroup_clicked); -
@mpergand said in ui detect mouse event on objects:
&MainWindow::on_ioGroup_clicked);
OIC I missed that when OP said it was correct.
@JonB said in ui detect mouse event on objects:
@mpergand said in ui detect mouse event on objects:
&MainWindow::on_ioGroup_clicked);
OIC I missed that when OP said it was correct.
You can see for yourself (when it's written in monospace) that in your
connect(ioGroup, &QButtonGroup::idClicked, this, MainWindow::on_ioGroup_clicked);
one method reference has a preceding
&
and the other does not, and thereby tell what you had is not correct. -
@JonB said in ui detect mouse event on objects:
@mpergand said in ui detect mouse event on objects:
&MainWindow::on_ioGroup_clicked);
OIC I missed that when OP said it was correct.
You can see for yourself (when it's written in monospace) that in your
connect(ioGroup, &QButtonGroup::idClicked, this, MainWindow::on_ioGroup_clicked);
one method reference has a preceding
&
and the other does not, and thereby tell what you had is not correct.connect(ioGroup, &QButtonGroup::idClicked, this, MainWindow::on_ioGroup_clicked);
OK, I think I understand, but this try worked, without ID but it creates a event on every click.
Without the reference (&) to MainWindow....But it´s OK, this try:
connect(ioGroup, SIGNAL(idClicked(int)), this, SLOT(on_ioGroup_clicked(int)));
is exactly the way that I use (SIGNAL -> SLOT) for my other connections.
Thanks for your support!
-
connect(ioGroup, &QButtonGroup::idClicked, this, MainWindow::on_ioGroup_clicked);
OK, I think I understand, but this try worked, without ID but it creates a event on every click.
Without the reference (&) to MainWindow....But it´s OK, this try:
connect(ioGroup, SIGNAL(idClicked(int)), this, SLOT(on_ioGroup_clicked(int)));
is exactly the way that I use (SIGNAL -> SLOT) for my other connections.
Thanks for your support!
@Pfanne said in ui detect mouse event on objects:
is exactly the way that I use (SIGNAL -> SLOT) for my other connections.
But you should switch to the pmf syntax for your own sake.
-
@Pfanne said in ui detect mouse event on objects:
is exactly the way that I use (SIGNAL -> SLOT) for my other connections.
But you should switch to the pmf syntax for your own sake.
should I use the pmf syntax only for object events or also for function events too?
-
should I use the pmf syntax only for object events or also for function events too?