How to change property of more than one qlineedit at once

Viewed 628

I have done some coding for L00 (name of my first QLineEdit).

I want to do the same for other 99 widgets (up to L99). I don't wanna copy paste it 100 hundred times.

void MainWindow::on_L00_returnPressed(){
    QString c = ui->L00->text();
    char d = QString(c).at(0).toLatin1();
    if(d>=65&&d<=90||d>=97&&d<=122)
    {
        square[0]=d;
        ui->MessageBox->setText("Alphabet succesfully entered");
        ui->L00->setReadOnly(true);
        ui->L00->setStyleSheet("QLineEdit { background: rgb(0, 255, 255);}");
    }
    else
    {
        ui->MessageBox->setText("Enter Alphabets Only");
        ui->L00->setText("");
    }
}
3 Answers
Related