Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt QTableWidget's gray dotted border around a selected cell [duplicate]

Tags:

qt

qt4

I'm wondering if anyone knows of, perhaps a flag to disable the gray dotted border that appears when you single click on a QTableWidget's cell.

Thanks.

like image 750
Jean-Luc Avatar asked Jan 28 '12 10:01

Jean-Luc


3 Answers

C++: tableWidget->setFocusPolicy(Qt::NoFocus);

Python: tableWidget.setFocusPolicy(QtCore.Qt.NoFocus)

Be aware that you will lose the ability to process keyboard events, but mouse events will work fine.

like image 172
Aleksandar Avatar answered Nov 11 '22 06:11

Aleksandar


It seems like you want to remove the border when the cell gets the focus.

Try editing the Stylesheet as follows.

QTableWidget {
    outline: 0;
}

This worked for me perfectly.

like image 15
Surajeet Bharati Avatar answered Nov 11 '22 06:11

Surajeet Bharati


That gray dotted border indicates that that widget has focus.

Setting the below at the widget level should do the trick.

setFocusPolicy( Qt::NoFocus )
like image 8
Wes Avatar answered Nov 11 '22 06:11

Wes