aliasbody
7th June 2011, 10:42
Hi everyone, (Sorry for my bad english)
I am trying to create a Pin Code for my program, 3 numbers in the horizontal and 3 numbers in the vertical. Then when the user click in the QPushButton with the number, the text of the QPushButton is send to the QLineEdit....
I have already done that :
QPushButton *BtnPin;
char *Numeros[9] = {"1","2","3","4","5","6","7","8","9"};
int posicao = 0;
for (int i=0; i<3; i++)
{
for (int j=0; j<3; j++)
{
BtnPin = new QPushButton(Numeros[posicao],this);
BtnPin->setText(Numeros[posicao]);
BtnPin->setMinimumSize(50,50);
BtnPin->setMaximumSize(50,50);
layout->addWidget(BtnPin,i,j);
connect(BtnPin,SIGNAL(clicked()),this,SLOT(AddPinN umero()));
posicao++;
}
}
ui->frame->setLayout(layout);
All the buttons appears but if I click, it only returns the last number added (9), how can I solve the problem ?
Thanks in advance,
Luis Da Costa
I am trying to create a Pin Code for my program, 3 numbers in the horizontal and 3 numbers in the vertical. Then when the user click in the QPushButton with the number, the text of the QPushButton is send to the QLineEdit....
I have already done that :
QPushButton *BtnPin;
char *Numeros[9] = {"1","2","3","4","5","6","7","8","9"};
int posicao = 0;
for (int i=0; i<3; i++)
{
for (int j=0; j<3; j++)
{
BtnPin = new QPushButton(Numeros[posicao],this);
BtnPin->setText(Numeros[posicao]);
BtnPin->setMinimumSize(50,50);
BtnPin->setMaximumSize(50,50);
layout->addWidget(BtnPin,i,j);
connect(BtnPin,SIGNAL(clicked()),this,SLOT(AddPinN umero()));
posicao++;
}
}
ui->frame->setLayout(layout);
All the buttons appears but if I click, it only returns the last number added (9), how can I solve the problem ?
Thanks in advance,
Luis Da Costa