QML: redraw TableView when context menu shown - qt

I show context menu when user right clicks on row at TableView and select clicked item:
downloadContextMenu.popup()
tableView.selection.clear()
tableView.selection.select(row)
but TableView show selection only if I will move mouse to something else (i.e. button) after it. So, how to update TableView in this case?
downloadContextMenu is Menu
P.S. If I will do it by this:
tableView.selection.clear()
tableView.selection.select(row)
downloadContextMenu.popup()
I will have the same problem, but after next opening of context menu (open menu, then click outside to close it, then open again)

Related

getting information from a different view in javafx

i have a main view with a combo box and its controller, and a second view which gets loaded when a button is clicked on the main view.
the second view contains a button and a label and has its different controller.
what i want to do is, when the button on the second controller is clicked, the selected item on the combo box on the main view should be displayed on the label..
so that when i go back and change the item on the combo box and go back and click the button on the second view ,the text on the label would be changed to the currently selected item.
any help..???
thanks

QToolButton don't hide popup menu after triggering action

I have a QToolButton with a popup menu on a toolbar. Popup menu has a number of checkable actions, and it looks like this:
Problem is - popup menu closes every time I check/uncheck the action, but I want it to stay opened so I can check a number of actions with no need to reopen popup menu. How can I achieve this?
Edited:
Found this workaround - Prevent a QMenu from closing when one of its QAction is triggered
It looks a bit different but still ok for me:

Close all ContextMenu with mouse button

Is there a way to close all opened context menus opened on the scene?
When I press a button I would like to close all Context menus opened by right muse click.
Sure, just have some data structure, say a Stack<ContextMenu> Where every time you make a context menu, you push it on the stack, and every time you hide it, you pop it off the stack. Then when you press a certain button, just iterate through the stack and call the .hide() method of contextMenu, on each item i the stack, hiding them as you go, and voila! that should do it.

UINavigationController bar button Trigger

How can I trigger when a bar button is clicked in UINavigationController?
As I need to reset the image in the details view when the bar button item "Back" is clicked.
Question is a bit vague. 2 possible answers.
Link the bar button item in IB to a method in your view controller object that does the reset when clicked.
I assume you want to reset something when the view controller unloads or disappears. You will want to see -()viewdidunload. http://developer.apple.com/library/ios/ipad/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html

Flex - Menu Created On Button Click

I created a Button in MXMXL. On button click, I create a Menu as a child of the Button. I am using an XML datasource. The reason for creating it this way, was due to the amount of custom skinning involved. A popupmenubutton was not an option. Anyway, so my question is this: when clicking the button, the menu is displayed. However, if you click the button again, the menu reopens. I want the menu to close if the user clicks the button a second time. Now, I got it to work by setting a var after opening the menu, and then I check that var on each click to make sure that the menu isn't already open. If true, then it will close the menu, instead of reopening it. This works, until the user clicks away, in which the HIDE event gets dispatched and the menu closes. My hack no longer works.
Any suggestions? I spent hours trying different things. The hardest part is trying to destinguish from that second button click when the menu is open, and when the user clicks away from the menu. They both dispatch the HIDE event.
Help!!!
Have you tried adding another eventlistener to the button...FlexMouseEvent.MOUSE_DOWN_OUTSIDE ? You should then be able to set the preventDefault event to true to stop the event from firing anything else and stop the menu from closing.

Resources