1 Attachment(s)
QwtScaleWidget: The length of colorbar and backbone are different
Hello,
I am using QwtScaleWidget in a mainwindow to display color bar. The problem is that the color bar is somehow a little bit longer than the backbone of scalewidget's scaledraw at the bottom, when both of their lower boundaries are exactly the same.
Here is a screenshot: Attachment 13605
My code:
Code:
colorbar->setColorBarEnabled(true);
QwtInterval zInterval = ... //The zInterval is [2, 79]
colorbar->setColorMap(zInterval, colormap);
QwtScaleDiv scaleDiv
(zInterval.
minValue(), zInterval.
maxValue());
QList<double> majorTick;
for (double i = zInterval.minValue(); i <= zInterval.maxValue(); i += gap) { //gap is 8 here
majorTick.append(i);
}
colorbar->setScaleDiv(scaleDiv);
I want to align the bottom of the color bar with the backbone(i.e. the first tick of the scale). Is there any way to do this?
Thanks for your help!
Re: QwtScaleWidget: The length of colorbar and backbone are different
Your code works on my box when doing it in the setup process of a plot. So my guess is, that your code runs in a specific situation, where no layout recalculation happens.
If you can provide a minimal demo demonstrating the problem I will have a look at it.
Uwe
1 Attachment(s)
Re: QwtScaleWidget: The length of colorbar and backbone are different
Thanks for Uwe's reply.
I've accidentally fixed the problem by adding this code:
Code:
colorbar->setBorderDist(10, 10);
Result: Attachment 13606
It looks good for me and I won't go further with the issue because the function of my code is experimental and very initial.