widget layout status

Caolán McNamara caolanm at redhat.com
Mon Oct 8 06:24:05 PDT 2012

On Mon, 2012-10-08 at 07:52 -0300, Olivier Hallot wrote:
> Hi Caolán
> What is the recomendation to convert to a .ui file? That is, for all the
> existing scr/hrc pairs, is there a tool to convert them to .ui?

There's no tool. A tool might be helpful but I've put that on the long
finger for now. So it's currently 
a) fire up glade and draw something similar to the existing dialog and
cut and paste in the strings from the .src. 
b) Follow the basic guidelines from
https://wiki.documentfoundation.org/Development/WidgetLayout e.g. ok
buttons are called "ok" cancel "cancel" and so on
c) remove from the code any declarations of widgets which only appear in
the .hxx and once in the .cxx in the member init list (because we don't
need to explicitly declare them anymore if that's all they were there
d) search and replace aWidget. to m_pWidget->
e) convert aWidget(this, SOMERESID) in the ctor member init list to
get(m_pWidget, SOMEUIID) in the ctor where SOMEUIID is a human-helpful
name which you fill into the .ui e.g.

in .hxx
PushButton m_aFOO
in .cxx
SomeDialog::SomeDialog() :
    m_aFOO(this, SwRes(DIALOG_OK_BTN)


in .hxx
PushButton* m_pFOO
in .cxx
SomeDialog::SomeDialog() :
    get(m_pFOO, "foo);

If you'd like to get a conversion a shot, then you could just start with
demoing up converting a dialog in glade first and not worry about the
code yet and I can convert the code over to use the new .ui


More information about the LibreOffice mailing list