Generated header files for Qt4 .ui files with cmake
Nicolas Goutte
nicolasg at snafu.de
Sun Apr 30 13:15:20 BST 2006
On Sunday 30 April 2006 14:07, David Faure wrote:
> 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"
If I remember well, this is not generated anymore, as the second "" is given
as 0 (except if Qt4 has again changed its behaviour to be the Qt3 behaviour).
> _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}")
More information about the kde-core-devel
mailing list