문제

I'm trying to setup text alignment for QTableView , by:

setStyleSheet("QTableView {Alignment: center;}");

But it doesn't seem to work at all.

And if this ain't going to work , is there any other solution rather than re-implementing a model ?

Thanks

도움이 되었습니까?

해결책

I'm pretty sure there's no way to set the text alignment of a QTableView item via CSS, instead it's something that has to be expressed by reimplementing the model. The reasoning (I believe) being that QTableView elements can be 'anything' so textual alignment is too abstract.

On the plus side, once you set it for the column, it 'just works'.

For reference, stylesheet documentation

-n

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top