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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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