[RQt-devel] qstrWidth() outside the paintFun()

Yihui Xie xieyihui at gmail.com
Fri Oct 15 16:14:56 CEST 2010


qstrHeight() is there now.

Currently I'm using a brutal way (nearly hard coded) to specify the
width of the y-axis layer:
http://github.com/bigbear/cranvas/blob/master/Yihui/qparallel.R#L390

It looks silly but it works for strings of various lengths (at least for me).

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



On Fri, Oct 15, 2010 at 8:17 AM, Michael Lawrence
<lawrence.michael at gene.com> wrote:
>
>
> I checked in a fix for this, so you won't have to count new lines in R
> anymore. Please go ahead and push your (updated) qstrHeight function.
>
>
> Currently I'm unable to get Qt to call the sizeHint function. I think the
> sizeHint is only useful when one is considering constraints, i.e., Qt might
> ask what is the best vertical size given that I can only allocate so much
> horizontally? Most obvious application of this is text in an editor. There
> is a fixed width and only the text layout/wrapper knows how much vertical
> space it needs.
>
> So unless you want the axis to behave in such a fancy way, setting the
> min/max dimensions may be all that's needed in this case. The main issue
> then is that ideally one would be setting the dimensions on the layer
> itself, not the column or row. If there are multiple plots, it could get
> tricky. Unfortunately, setting the layer dimensions is not possible until
> the Smoke bug is fixed; according to the maintainer that will not happen any
> time soon. I could add some wrappers if we really needed this though.
>
>> In the meantime, you could just set the maximum dimensions to what you get
>> from QFontMetrics::boundingRect, since at least in your case there is no
>> view transform (and thus the scene and screen coordinates are the same).
>>


More information about the Qtinterfaces-devel mailing list