Form problem
-
Hi
Are both form in same application ? -
I will do like this,emitting a signal from other forms to mainwindow it is okay but new problem is I cant catch which button clicked
QPushButton *DKCS_btnx[]= {ui->DKCS_btn1,ui->DKCS_btn2,ui->DKCS_btn3,ui->DKCS_btn4,ui->DKCS_btn5,ui->DKCS_btn6};
for(int i=0;i<6;i++)
connect(DKCS_btnx[i],SIGNAL(clicked(bool)),this,SLOT(ButtonHandler()));void dialogDKCS::ButtonHandler()
{
QPushButton *button = (QPushButton *)sender();
// ui->DKCS_btn1->setText(QString::number(button->text()[0].digitValue()));
ui->DKCS_btn1->setText(QString::number(button->));
QPushButton btn = (QPushButton)senderSignalIndex();
//ui->DKCS_btn2->setText(QString::number(btn->text().at(0)));}
I need button index
-
Hi,
Sounds like a job for QSignalMapper.
-
Hi
Why you need the index when you have the button that was click in "button " ?
Just need to cast it likeQPushButton *button = qobject_cast<QPushButton *>( sender() );
if (button){
button->text ...
}but as @SGaist says, a signal mapper might work better.