|
No Scrolling Signal After Dragging in a Chart |
Posted by Fabio on Jan-09-2016 07:13 |
|
Hello,
I have a Qt 5.5 project with ChartDirector 6.0 that has a chart dialog, which is a mix of the examples xyzoomscroll and realtimezoomscroll. The dialog displays real-time line charts (as the one in realtimezoomscroll) and real-time scatter charts (as the one in xyzoomscroll).
When the user clicks and drags a chart, the chart does not scroll or the mouse pointer does not change from an arrow to a sphere. I found that the viewPortChanged() signal that is connected to the onViewPortChanged() slot does not trigger any event when the mouse is released. How can I fix this scrolling issue?
Thanks in advance,
Fabio |
Re: No Scrolling Signal After Dragging in a Chart |
Posted by Peter Kwan on Jan-12-2016 00:39 |
|
Hi Fabio,
First, please try the original unmodified realtimezoomscroll sample code that comes with
ChartDirector (in case you have not already done so) to verify that the viewPortChanged
signal is working correctly in your Qt system for that project.
If the viewPortChanged signal works on the unmodified sample project, but not on your
project, please kindly check the followings:
(a) Have your code configured the mouse for "drag to scroll" or "zoom in" or "zoom out"?
By default, the mouse action is none of them, it just generates a mouse click event. To use
the mouse to control the viewport, you would need to set the mouse to one of the above
actions, so that the QChartViewer can know how to interpret the mouse action. In the
sample code, during initiation, the code usually will simulate a "Pointer" button click, which
will eventually call "m_ChartViewer->setMouseUsage" to set the mouse action to drag to
scroll.
(b) Have you connected the signal to the slot?
connect(m_ChartViewer, SIGNAL(viewPortChanged()), SLOT(onViewPortChanged()));
When the code is compiled, in the compiler output window, do you see any warning
message that complains about the "slot" not found? (The slot would not be found if the
onViewPortChanged does not exist, or if it is not declared in the header file as a slot.)
Regards
Peter Kwan |
Re: No Scrolling Signal After Dragging in a Chart |
Posted by Fabio on Jan-12-2016 02:23 |
|
Hi Peter,
Again, thanks for your response.
>> Try the original realtimezoomscroll sample code that comes with ChartDirector
I tried it, and both the signal is triggered and the mouse pointer becomes a sphere. By the way, I tried the original xyzoomscroll, and both the signal is triggered and the mouse pointer becomes a sphere.
>> Have your code configured the mouse for "drag to scroll" or "zoom in" or "zoom out"?
No, it had not. I just added the following code in the constructor at the end of the chart viewer configuration:
// Configure the mouse for drag to scroll
chartViewer->setMouseUsage(Chart::MouseUsageScroll);
After adding that, both the signal is triggered and the mouse pointer becomes a sphere, resolving this issue.
>> Have you connected the signal to the slot? Do you see any warning message that complains about the "slot" not found?
Yes I had connected the signal to the slot, and I did not see any ?slot not found? warning.
Again, you may consider this issue as resolved.
Best regards,
Fabio |
|