Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- connect(button1, SIGNAL(clicked()), this, SLOT(markClicked(button1)));
- void MainWindow::markClicked(QPushButton *button) { button->setText("Clicked"); }
- QSignalMapper mapper;
- ...
- connect(button1, SIGNAL(clicked()), &mapper, SLOT(map()));
- mapper.setMapping(button1, button1); // not sure whether this is mandatory or not
- ...
- connect(&mapper, SIGNAL(mapped(QWidget*)), this, SLOT(markClicked(QWidget*)));
- void MainWindow::markClicked(QWidget *widget) {
- QPushButton *button = qobject_cast<QPushButton*>(widget);
- button->setText("Clicked");
- }
Add Comment
Please, Sign In to add comment