I have a few QLineEdit-s; When the Edit QPushButton is clicked, I want to know which QLineEdit was selected beforehand.
QLineEdit *clickedLine
= qobject_cast<QLineEdit
*>
(sender
());
clickedLine->setText(";)");
QLineEdit *clickedLine = qobject_cast<QLineEdit *>(sender());
clickedLine->setText(";)");
To copy to clipboard, switch view to plain text mode
However, in the case I have several push button and want to know which button was clicked, this is accomplished successfully with the same code snippet:
QPushButton *clickedButton
= qobject_cast<QPushButton
*>
(sender
());
int digitValue = clickedButton->text().toInt();
qDebug() << digitValue;
QPushButton *clickedButton = qobject_cast<QPushButton *>(sender());
int digitValue = clickedButton->text().toInt();
qDebug() << digitValue;
To copy to clipboard, switch view to plain text mode
Bookmarks