1 Attachment(s)
Item edit in QTableWidget
Hi,
I have created a small program, I have observed several thing in QTableWidget, even though we disable the TabKey Navigation, it still works. How to disable the Tabkey Navigation in QtableWidget? if I click on the 1st column of any row it allows me to edit where as it should. I have attached the code in zip file please help me out with this.
Attachment 6305
Thanks
manmohan.
Re: Item edit in QTableWidget
I have removed your connection in the constructor and added the following:
Code:
for(int r=0;r<ui->tableWidget->rowCount();r++)
for(int c=0;c<ui->tableWidget->columnCount();c++)
{
ui->tableWidget->item(r,c)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
}
It works now.
Re: Item edit in QTableWidget
Thanks John,
The tab key navigation is disabled. In the table I want to disable editing of the 1st column, and the rest of the 2 columns should be editable by mouse clicks only (not by tab key navigation).
Code:
for(int r=0;r<ui->tableWidget->rowCount();r++)
for(int c=0;c<ui->tableWidget->columnCount();c++)
{
if(c == 0)
ui->tableWidget->item(r,c)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
}
Thanks and regards.
Manmohan
Re: Item edit in QTableWidget
Then, optimize it
Code:
for(int r=0;r<ui->tableWidget->rowCount();r++)
{
ui->tableWidget->item(r,0)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
}