سؤال

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