Sunday 15 July 2012

text - How to work with Qml Fonttype in javascript? -



text - How to work with Qml Fonttype in javascript? -

i have next issue, pops when using qml , working fonts.

i utilize next code, dynamically take between differently sized fonts:

function getvaluefontdefault(valueareaheight, valueareawidth) { var fonts = [font0, font1, font2, font3] for( var fontcandidate in fonts){ if ( fontcandidate.pixelsize <= valueareaheight ){ checktextdummy.font = fontcandidate; if( checktextdummy.paintedwidth <= valueareawidth ){ break; } } } homecoming fontcandidate; } text{ id: checktextdummy visible: false text: "this longest illustration text thinkable" }

the fonts of "font" type in qml. problem is, javascript cannot set them in "var". says, fontcandidate.pixelsize undefined. using not loop on different fonts, using them explicitly (i.e. font0.pixelsize), works.

so how treat qml fonts in javascript? right way set them in variables , work them?

thanks lot help!

greetings germany

ok, found issue. didn't have qml , javascript, lack of knowledge js.

in fact loops no for_each assumed. simple loops. putting correctly becomes:

for( var idx in fonts){ var fontcandidate = fonts[idx] checktextdummy.font = fontcandidate

and works intended. give thanks anyway help.

javascript text fonts qml

No comments:

Post a Comment