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: plot.PNG
My 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);
colorbar->setColorBarEnabled(true);
QwtInterval zInterval = ... //The zInterval is [2, 79]
QwtLinearColorMap *colormap = ...
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);
}
scaleDiv.setTicks(QwtScaleDiv::MajorTick, majorTick);
colorbar->setScaleDiv(scaleDiv);
To copy to clipboard, switch view to plain text mode
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!
Bookmarks