Right align numeric column in TreeView

I have a simple tree view with which has numeric data in the last column, which I would like right aligned.
This is the XML I’m using so far

                <child>
                  <object class="GtkTreeViewColumn">
                    <property name="title" translatable="yes">Elevation</property>
                    <style>
                      <class name="right"/>
                    </style>
                    <child>
                      <object class="GtkCellRendererText" id="a-elev-renderer"/>
                      <attributes>
                        <attribute name="text">4</attribute>
                      </attributes>
                    </child>
                  </object>
                </child>
              </object>
            </child>

Neither GtkTreeViewColumn nor GtkCellRendererText have a CSS node and there seem to be no alignment properties available to set in the xml.

All GtkCellRenderers have a xalign property, set it to 1.0 for right alignment:

<object class="GtkCellRendererText" id="a-elev-renderer">
  <property name="xalign">1.0</property>
</object>

Thanks for that. Looked everywhere and googled everything imaginable and found no answers. So simple once you know.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.