Generated header files for Qt4 .ui files with cmake

David Faure faure at kde.org
Sun Apr 30 13:07:51 BST 2006


On Sunday 30 April 2006 13:57, Nicolas Goutte wrote:
> On Sunday 30 April 2006 12:43, Alexander Neundorf wrote:
> > On Sunday 30 April 2006 11:30, Nicolas Goutte wrote:
> > > Before I forget again to discuss this subject (for the umpteenth time), I
> > > write quickly this short email.
> > >
> > > In Qt4's .ui files, the user-visible strings are now in the header files
> > > and not in the cpp file anymore. Therefore the -tr tr2i18n parameter must
> > > be given to uic when generating the .h file.
> >
> > cmake currently does:
> > uic -tr tr2i18n blah.ui blah.h
> >
> > Doesn't this do what you mention ?
> > What should it do ?
> 
> Does it do 
> sed -e 's/${UIC_TR}(\"\")/QString()/g;s/${UIC_TR}(\"\", 0)/QString()/g'
> on the generated file too (where ${UIC_TR} is tr2i18n )?
Yes, something like that.
Just read kdelibs/cmake/modules/kde4uic.cmake:

#replace tr218n("") with QString::null to avoid warning from KLocale
STRING(REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" )
STRING(REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _uic_CONTENTS "${_uic_CONTENTS}" )
#replace image15_data with img15_filename to make enable_final work
STRING(REGEX REPLACE "image([0-9]+)_data" "img\\1_${KDE_UIC_BASENAME}" _uic_CONTENTS "${_uic_CONTENTS}")
#fixup include guard
STRING(REGEX REPLACE "#ifndef " "#ifndef UI_" _uic_CONTENTS "${_uic_CONTENTS}")
STRING(REGEX REPLACE "#define " "#define UI_" _uic_CONTENTS "${_uic_CONTENTS}")


-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).





More information about the kde-core-devel mailing list