I have an Echarts graph (similar to a network graph), which has many nodes and edges. When I put the mouse on a node, the adjacent edges and nodes will be highlighted, but how can I move the mouse The highlighting of these nodes is still maintained after leaving. In other words, I want to trigger and cancel the highlighting by clicking, rather than hovering over the mouse.
In your tooltip chart options, add the option trigger:
tooltip : {
triggerOn : 'click'
}
in my case using click, mouseout, highlight event worked.
I can't find way to avoid default mouse hover event. so set click and mouseout event callback.
When click event occur, save the node 'dataIndex'. And when mouseout event occur, emit 'highlight' event with 'dataIndex' (use dispatchAction api)
Related
I want to show the corresponding page when mouse cursor hover on the tab of a QTabWidget.
For example, when the mouse cursor hover on tab ‘page2’ here , I hope the QTabWidget shows the corresponding page automatically instead of clicking. How to implement this feature?
You may try adding an event filter on the QTabWidget object's QTabBar in order to trap the mouse move event. In the filter handler, use QTabBar::tabAt( QPoint ) to find which tab is below the cursor. Set up a timer when the cursor first enters a given tab, reset time when cursor leaves it. When the timer fires, switch active tabs.
You may try using setTabToolTop function.
ui->tabWidgetHz->setTabToolTip(0,"tooltip for tab1.");
ui->tabWidgetHz->setTabToolTip(1,"tooltip for tab2.");
ui->tabWidgetHz->setTabToolTip(2,"tooltip for tab3");
I am creating a Flex Panel, which has an image on it. I have set the "buttonMode" and "useHandCursor" property of the image to true. So, whenever I do a mouse over, the cursor changes into a hand tool. I am able to set the mouse-down, mouse-up, mouse-move events on it. But, I see that the mouse-move events only get triggered when I move the mouse inside my Flex panel. I also want to capture the mouse-move event when user moves the mouse outside the Flex panel.
For eg, when user clicks on the image in Flex panel and then drags the mouse(while mouse down) outside the Flex panel, I want to get the current position of mouse while user is dragging the mouse.
Is there any way to get the mouse position outside the Flex panel??
Thanks!
The solution for this is "Mouse-Move" event only.
I need to do the following:
1. Capture mouse-down event on the image.
2. Register for mouse-move and mouse-up event inside the mouse-down event.
3. Inside the mouse-move event get the position of cursor.
4. Inside the mouse-up event unregister mouse-move event.
According to the QGraphicsView docs, dragMode's behavior "only affects mouse clicks that are not handled by any item." It then says "You can define a custom behavior by creating a subclass of QGraphicsView."
In my case I'd like clicks on an item that accepts mouse clicks to call the item's mouse clicks as normal. And I'd like clicks not on those items to start a rubber band drag (also as normal). However, I'd like to be able to ctrl-click the view, and have that start a rubber band drag selection rather than call the item's mouse event methods.
I know how to assess whether or not ctrl is associated with a mouse click event:
if (event->modifiers().testFlag(Qt::ControlModifier))
However, I don't know what to do with this condition, or where exactly to put it. Should I put it in QGraphicsItem, QGraphicsScene, or QGraphicsView? QGraphicsView seems most likely, as the docs somewhat hint.
You need to put the condition to QGraphicsItem like this:
if (event->modifiers().testFlag(Qt::ControlModifier))
{event->setAccepted(false); return;}
Now You can handle the event in Your QGraphicsView.
In flex, I am using the following:
mx:TextInput mouseOver="tester(event)"
It works fine. My pointer goes over the textInput and it calls the function. But when I click inside the textInput to enter some text( focus is on the textInput) and then move the mouse (not taking mouse pointer outside of the boundary of textinput), the mouseover event is not trigerred.
If I use click event, then even if I am entering text ( or the focus is on the textinput) and then click, it will call the function.
How can I call the tester function on mouseover when the focus is on textInput?
The mouseOver event fires when the mouse is moved over the control.
Maybe you want to try the mouseMove event which will fire every time the mouse moves?
Keep in mind that mouseEvents and focusEvents are not inherently related. I would expect the mouseOver event to fire when the mouse rolls over your textInput regardless of whether or not that textInput has the focus.
I am using a box element to add a transparent overlay to a column of buttons. I want to add a click event to the buttons. However, when you click a button the click event is only triggered on the overlaying box. Is there anyway to pass the event to the underlying button or perhaps a better way to display an overlay without blocking the click event?
If you want a DisplayObject (which nearly all visual things subclass in Flex) to be treated as "transparent" to the mouse (i.e. it won't intercept click events), set that object's mouseEnabled property to false.
e.g.
transparentBox.mouseEnabled = false;