0
我已經創建了一個QPushButton的QList,我已經分配給一個槽功能。 但我想獲得在列表中點擊的按鈕的座標。QPushButton在QList中的座標
例如,單擊按鈕n°5,它返回我(25,150)。
listButton = new QList<QPushButton*>;
//some code here
QPushButton *button = new QPushButton(QString::number(1),ui->widget);
button->setGeometry(50, 50, 30, 30);
button->setStyleSheet("background-color:red;");
QObject::connect(button, SIGNAL(clicked()), this, SLOT(selectP()));
listeButton->append(button);
//some code here
void selectP()
{
//I'd like to print here, coordinates of the button which has called "selectP()"
}
對不起,我的語言,提前致謝!
謝謝夥計! – 2014-10-31 21:47:02