1 May 20:43
Re: QwtScaleWidget has wrong scale
From: Rainer Thaden <RThaden <at> web.de>
Subject: Re: QwtScaleWidget has wrong scale
Newsgroups: gmane.comp.graphics.qwt.general
Date: 2008-05-01 18:43:51 GMT
Subject: Re: QwtScaleWidget has wrong scale
Newsgroups: gmane.comp.graphics.qwt.general
Date: 2008-05-01 18:43:51 GMT
Hi Klaus,
> Hi,
>
> thanks for your suggestion. I tried it but it didn't work. Still I haven't
> quite understood your solution, though: How can the VBox change the internal
> behaviour of the colour scale, which is one widget with one bounding
> rectange? Can you see an error in my implementation below, or does it simply
> not work with a colour scale?
If you have the scale and the colour bar in the same layout, then, the
scale line will fill the height of the layout minus the space needed for
the numbers above and below the line.
The colour bar, however, will take the whole height and, thus, is longer
than the line of the scale. So, you'll have to shrink the colour bar.
How can you do that? By putting it in an own layout and set the layout
margins to the same value as the margins of the scale which are reserved
for the numbers.
You, then, shrink the colour bar while keeping the length of the scale
constant.
> // Qwt scale widget and stuff
> QwtScaleWidgetX* scale = new QwtScaleWidgetX(QwtScaleDraw::RightScale,
> this);
> QwtLinearScaleEngine se;
> scale->setScaleDiv(se.transformation(),
> se.divideScale(interval.minValue(), interval.maxValue(),
> 8, 5)); // as in QwtPlot::Axis
> scale->setColorBarEnabled(true);
> scale->setColorMap(interval, colormap);
> scale->setTitle("Intensity");
> scale->setMargin(2);
> // layout to adjust scale
> QVBoxLayout* qd = new QVBoxLayout();
> int margin = scale->scaleMargin();
> scale->setMinimumSize(QSize(48, 170-2*margin));
Ah, I think there was a misunderstanding. I thought you had a colour bar
_and_ a free standing scale as two different objects.
Then, the solution, would work, because you could put bar and scale in
different layouts.
If this is not the case, it is caused by internal behaviour of the
bar/scale. Sorry, but for that, I don't know a solution.
Regards,
Rainer
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
RSS Feed