[Kde-java] QSizePolicy

Marco Ladermann kde-java@kde.org
Fri, 24 Jan 2003 15:00:44 +0100


Hi all,

I'm  on the way to develop XSLT stylesheets to generate Java from=20
Qt-designer's UI files. While translating the <sizepolicy> tag and its=20
<horstretch> and <verstretch> subtags I encountered the problem that the=20
designer uses numeric characters as content of those tags. I looked up th=
e Qt=20
reference and found the method signature (C++):

QSizePolicy
=09setHorStretch( uchar )
=09setVerStretch( uchar )

in Java
=09setHorStretch( String )
=09setVerStretch( String )

Indeed this methods are implemented as

<code>
JNIEXPORT void JNICALL
Java_org_kde_qt_QSizePolicy_setHorStretch(JNIEnv *env, jobject obj, jstri=
ng=20
sf)
{
static QCString * _qstring_sf =3D 0;
=09((QSizePolicy*) QtSupport::getQt(env, obj))->setHorStretch((uchar)=20
QtSupport::toCharString(env, sf, &_qstring_sf));
=09return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QSizePolicy_setVerStretch(JNIEnv *env, jobject obj, jstri=
ng=20
sf)
{
static QCString * _qstring_sf =3D 0;
=09((QSizePolicy*) QtSupport::getQt(env, obj))->setVerStretch((uchar)=20
QtSupport::toCharString(env, sf, &_qstring_sf));
=09return;
}
</code>

in qtjava/QSizePolicy.cpp, but QtSupport::toCharString returns char* and =
I'm=20
wondering if this cast to uchar is correct?  Okay, I think it will not cr=
ash,=20
but neither do any usefull ;-).

Marco