Project

General

Profile

Alignment of cells/columns in WAbstractItemModel (align right)

Added by Norbert Mösbauer about 8 years ago

Hello,

how can I change the alignment of cells or columns in Wt::WAbstractItemModel

  • f.e. set text-align to right when displaying a numeric values like "1.123"

Thanks in advance,

Norbert


Replies (2)

RE: Alignment of cells/columns in WAbstractItemModel (align right) - Added by Roel Standaert about 8 years ago

You can set the text-align property on a style class in CSS, and then use the StyleClass ItemDataRole to set it on the appropriate cells.

Regards,

Roel

RE: Alignment of cells/columns in WAbstractItemModel (align right) - Added by Norbert Mösbauer almost 8 years ago

Hi Roel,

previously I've tried to set alignment in StyleClassRole directly by returning Wt::WString{"text-align:right;"}; but this didn't work

Using your advice solved my problem - thanks a lot!

Norbert

BTW: In Chrome, Firefox and IE it works fine... using Qt (QWebEngineView) still shows the same problem

    (1-2/2)