Hi,
My question refers to this thread created in 2011....
http://www.qtforum.org/article/36821...namically.html
I would like to modify it so the text can also be deleted with a delete button. I want to add all the text that gets inputted to a database but I want to allow the user to also delete a line input they wish to change.
Here's what I have so far, it adds them to the list widget but with a lot of spacing for some reason...
void userDialog::on_pushButton_3_clicked()
{
static int LayoutCount;
ui->gridLayout->addWidget( lineEdit,LayoutCount,0 );
int iCount = ui->gridLayout->count(); //Total no of LineEdit added on gridLayout dynamically
for(int i = 0; i < iCount; i++)
{
str = pLineEdit->text();
ui->listWidget->addItem(str);
qDebug() << str;
}
}
void userDialog::on_pushButton_3_clicked()
{
static int LayoutCount;
QLineEdit *lineEdit = new QLineEdit;
ui->gridLayout->addWidget( lineEdit,LayoutCount,0 );
int iCount = ui->gridLayout->count(); //Total no of LineEdit added on gridLayout dynamically
QString str;
for(int i = 0; i < iCount; i++)
{
QLayoutItem* pLine = ui->gridLayout->itemAt(i);
QLineEdit* pLineEdit = (QLineEdit*)pLine->widget();
str = pLineEdit->text();
ui->listWidget->addItem(str);
qDebug() << str;
}
}
To copy to clipboard, switch view to plain text mode
Plz help...
Bookmarks