HongLiang Wang | 23 May 2012 15:55
Favicon

how to click buttons to zoom in and out instead of mouse dragging?

Hello all,


I am working on a qwt plot curve zooming problem. Basically I would like to create two buttons so that if the user clicks one button, the plot is zooming in and same for the other button.

I also don't want the user to use mouse dragging on the plot to zooming.

I searched into the source code and got the impression that qwtplotzoomer::zoom() should be responsible for zooming in and out.

so I was using following code in button click slots:

void
JBStatGraph::horizontalZoomIn(void)
{
    zoomer->zoom(+10);
}

void
JBStatGraph::horizontalZoomOut(void)
{
    zoomer->zoom(-10);
}

Tracing message shows that zoomer->zoomRectIndex()  always returns 0, no matter +10 and -10 is send to zoom().  but I don't know why.

Can anybody give me a hand?

Furthermore, I don't know how to disable mousing dragging for zooming. Can anybody give me a suggestion?

Thanks in advance.


Hongliang Wang

HVR Software bv | Haaksbergweg 45 | 1101 BR Amsterdam | The Netherlands

T. +31-020 312 7517 | F. +31-020 312 7509 | hongliang.wang <at> hvr-software.com

www.hvr-software.com


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest
Uwe Rathmann | 24 May 2012 07:47
Picon

Re: how to click buttons to zoom in and out instead of mouse dragging?

On 05/23/2012 03:55 PM, HongLiang Wang wrote:

>
> I am working on a qwt plot curve zooming problem. Basically I would 
> like to create two buttons so that if the user clicks one button, the 
> plot is zooming in and same for the other button.
>

This is simply multiplying the current range of the scale by some 
factor. Forget about the zoomer - all you need is 
QwtPlot::axisScaleDiv() + QwtPlot::setAxisScale() used in a slot with 
about 10 lines of code.

Uwe

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
HongLiang Wang | 24 May 2012 11:19
Favicon

Re: how to click buttons to zoom in and out instead of mouse dragging?

Hi Uwe,
 
Sorry that I didn't make myself clear. What I want is first use buttom to zoom in and out. Then attach the scrollbar to X Axis for scrolling. So I guess scrollzoom and scrollbar is what I need.
 
But I don't know how to achieve my goal. Can you please advise?
 
Thanks and Best Regards,

Hongliang Wang

HVR Software bv | Haaksbergweg 45 | 1101 BR Amsterdam | The Netherlands

T. +31-020 312 7517 | F. +31-020 312 7509 | hongliang.wang <at> hvr-software.com

www.hvr-software.com




On Thu, May 24, 2012 at 7:47 AM, Uwe Rathmann <Uwe.Rathmann <at> tigertal.de> wrote:
On 05/23/2012 03:55 PM, HongLiang Wang wrote:

>
> I am working on a qwt plot curve zooming problem. Basically I would
> like to create two buttons so that if the user clicks one button, the
> plot is zooming in and same for the other button.
>

This is simply multiplying the current range of the scale by some
factor. Forget about the zoomer - all you need is
QwtPlot::axisScaleDiv() + QwtPlot::setAxisScale() used in a slot with
about 10 lines of code.

Uwe

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest
Uwe Rathmann | 25 May 2012 07:50
Picon

Re: how to click buttons to zoom in and out instead of mouse dragging?

On 05/24/2012 11:19 AM, HongLiang Wang wrote:

> So I guess scrollzoom and scrollbar is what I need.

When you are talking about the classes from the realtime example: only 
ScrollBar and the layout code in ScrollZoomer are relevant. Better don't 
derive your code from QwtPlotZoomer, use setAxisScale instead.

Uwe

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Gmane