tableWidget->setFocusPolicy(Qt::NoFocus );
tableWidget->setFocusPolicy(Qt::NoFocus );
To copy to clipboard, switch view to plain text mode
{
QRect rect
(40,
100,
650,
200);
tableWidget->setGeometry(rect);
for (int i =0; i < 4; i++)
tableWidget->setColumnWidth(i,50);
for (int i =0; i < 4; i++)
tableWidget->setRowHeight(i,20);
tableWidget->setFocusPolicy(Qt::NoFocus)
connect(tableWidget,SIGNAL(cellClicked(int,int)),this,SLOT(doSomething(int,int)));
}
void Widget::doSomething(int row, int column){
newItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
tableWidget->setItem(row, column, newItem);
tableWidget->clearFocus();
}
{
tableWidget = new QTableWidget(4, 4,RenderScheduleLayout );
QRect rect(40,100,650,200);
tableWidget->setGeometry(rect);
for (int i =0; i < 4; i++)
tableWidget->setColumnWidth(i,50);
for (int i =0; i < 4; i++)
tableWidget->setRowHeight(i,20);
tableWidget->setFocusPolicy(Qt::NoFocus)
connect(tableWidget,SIGNAL(cellClicked(int,int)),this,SLOT(doSomething(int,int)));
}
void Widget::doSomething(int row, int column){
QTableWidgetItem *newItem = new QTableWidgetItem(tr(""));
newItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
tableWidget->setItem(row, column, newItem);
tableWidget->clearFocus();
}
To copy to clipboard, switch view to plain text mode
I am also doing a clear focus on this but still the focus on the selected cell is shown, i dont know how to remove the focus as its not being removed using tableWidget->setFocusPolicy(Qt::NoFocus)
Bookmarks