Hi,
I've been searching for this all day, perhaps someone can point me in the right direction.
What function do I need to overload to find the current rectangle of my canvas before
QwtScaleDraw::label(double value) is called?
I know the first time QwtScaleDraw::label(double value) is called 'value' is the minimum value of the axis, and the second time it is called 'value' is the max value of the axis. I want to be able to know the min and the max value before QwtScaleDraw::label is called (everytime it is called)
The reason I want to know this is to make the dates on my x axis change depending on how big of a time frame is displayed on the plot. For example, if it is a 10 year span, I only want years as labels, but if it is 10 minutes I'd like minutes.
I've been trying to do this a hacky way by getting the zoom rect's but nothing I have tried works in all cases, for example, if the user zooms out to a bigger area.
I've also tried overloading QwtScaleWidget::layoutScale because it seems to have a rect() function. But my code never seems to get to it:
public:
ScaleWidget(){}
void layoutScale(bool update_geometry){
const QRectF r
= rect
();
// I think I want this rect! }
};
class ScaleWidget : public QwtScaleWidget{
public:
ScaleWidget(){}
void layoutScale(bool update_geometry){
const QRectF r = rect(); // I think I want this rect!
QwtScaleWidget::layoutScale();
}
};
To copy to clipboard, switch view to plain text mode
Please, any ideas?
Thanks a lot!
Bookmarks