Go to parent component in WebStorm - webstorm

Basically the title. Does WebStorm have an option to jump to parent component? For example, you are editing child-component.ts and you need to jump to parent-component.ts to change some input value. Or you are in child-component.html and you need to jump to parent-component.html
Jumping from parent to child is super helpful.

Related

Locking selection in QTableView/QTreeView

Is it possible to "lock" selection in QAbstractView?
I have a form with:
A list of objects I can edit (QTableView).Objects are stored in a database, the list shows their ID.
A New button, whose effect is to append an empty row I can edit to create a new ID and enable controls in the rest of the form.
An Edit button whose effect is to enable the edition of the rest of the form, but leaves the ID non editable.
Everything is driven by a state machine. There are parallel states but for the sake of this question, only transition between a Viewing state and an Editing state is relevant. Clicking either button enters the Editing state, which means testing if I am in the Editing state provides no information about whether I clicked on New or on Edit.
I am trying to lock the selection when entering the Editing state.
I cannot simply disable the view because I need to edit new IDs, I cannot connect a slot to the selectionChanged signal to restore the selection because of side effects (calls to the database + focus going all over the place), and if possible, I wish to avoid having to call QAbstractItemView::setSelectionModel (it is reset by QAbstractItemView::setModel, see below) and wish to drive this behavior thanks only to the Viewing and Editing states.
I have tried to use, but to no avail:
QAbstractItemModel::flags (the best I can do is prevent selecting another item but not clearing the selection.)
QAbstractItemView::selectionMode
QItemSelectionModel::select, with QItemSelectionModel::SelectionFlag::NoUpdate (The description of this enum value made me think it could block the next selection change but that is not the case).
Subclassing QItemSelectionModel (#chehrlic's comment below) to override all the virtual public slots.While it does work (a property can be used to stop the selection from changing), it is a pain that QAbstractItemView::setModel creates a new model. It does work now but I do not see any easy way to prevent the code from breaking after accumulating code changes over the span of several years.
Did I miss any existing property to achieve this? And if I did not, how can I implement a property to lock the selection but no have any other effect on my view?
At this point, the last item in the above list of things I tried does do the job but it has a downside I am trying to avoid.
This is similar to this question except it was for a now old version of Qt and the answer is not very satisfying anyway.

Desktop Navigation Menu, How to fix the problem when you click?

help please, I can not understand what the problem is. When you click on the drop-down menu, opens a completely different tab, which is located above.
The page itself opens correct.
But the menu unfolds is not correct.
What i want to see
Any thoughts? Maybe this is done in the settings?
To edit the Menu you go into Shared Components-Navigation Menu.
Not sure what your problem is, but it could be something to do with how those are sorted.
What you need is for all the top layer tobs(the ones you have w/o names) to have no parent, and each have its contained tabs marked with it as parent.
And maybe try changing their sequence so that all the second layer tabs are in sequence between the top layer tabs(say your first top layer tab is sequence 1000, and your second top layer tab is 2000, make sure all the second layer tabs belonging to the first top layer tab are marked with the correct parent entry, and are numbered between 1000 and 2000).
I hope this resolves whatever bug you have.

Nested comboboxes in Qt

I'm looking for a way of nesting comboboxes in my GUI application (or to be more precise, I'm looking for a way to have an item displaying similar visual and functionnal properties as nested comboboxes).
Looking first at all the functions provided by the combobox class, it seems comboboxes nesting it's not supported by Qt.
I therefore thought that another solution would be to create a "menu" item outside the menu bar. If I understand correctly this phrase from the offical Qt documentation, it seems to be feasiable :
A menu widget can be either a pull-down menu in a menu bar or a standalone context menu
Not sure though was is meant by the "context" word.
However, there is no such (menu) widget in Qt designer and I haven't found any good examples about how to do it on the internet (and can't get a menu not associated with a menu bar to be displayed on the windows), explaining why I'm currently doubting whether it's feasible or not with a menu item.
I would greaty appreciate if you could provide some code sample along your response.
EDIT :
To clarify my first post, I'm trying to do something similar to this app :
It's the application that comes along the 3D connexion mouse whose usage is to parametrize each button.
As you can see, there are several sub-menu items. By clicking on the arrow next to a textbox, you open a sub-menu containing itself folders that contains themselves paramaters.

Issues with keyboard navigation on list with custom renderer

We have a list that uses a custom renderer containing a label, a checkbox and two icons (which have click events). This list needs to be made WCAG 2.0 compliant and in order to do that we need the list to be keyboard navigable.
The problem is with being able to move from one list item to the next and have the focus move to the label for the next/previous list item. Specifically, when the user enters the list using TAB button, the label for the first list item receives focus (highlighted box around text) and the entire row in the list is highlighted as the selected item.
However, when the user then presses the down arrow key to move to the next list item, the next row becomes highlighted (is now the selected item) but the focus remains on the label of the previous row (highlight still shown around label for row 1). The only way to get the focus to move to the newly selected row is to tab through the checkbox and two icons. This isn't a big deal if there are only a couple list items but would be a pain if there are 20+ rows in the list.
Is there a way to get the focus to move to the label of the newly selected row as soon as the user moves (using up/down cursor keys) to the new list item? I know a picture would help but I don't have anyway of posting a screenshot online. Any help would be greatly appreciated.
You're going to have to dig into how focus works in Flex. This is not a complete answer, but hopefully you can put together a solution that works for you. I did this about 4-5 years ago in Flex 3, but it should be similar in Flex 4.
How Focus Works in Flex
The main things to know are the FocusManager singleton class and the IFocusManagerComponent interface.
The FocusManager moves the focus around the UI based on user interactions (mouse clicks, keyboard navigation, etc.).
If a component implements the IFocusManagerComponent interface, then the FocusManager will include it in the "tab" loop and allow the component to be focused via keyboard navigation.
How Focus Works With Flex List Components
You've already stumbled onto the peculiarities of how focus works with the List component and item renderers. The Flex List components implement IFocusMangerComponent and so when you tab through the UI the FocusManager sends the focus to the list.
The List may or may not focus the item renderers. In Flex 3 you had to be using editable item renderers for this to happen, it may or may not be the same in Flex 4.
Some Ideas for Solutions to Your Problem
I think there are numerous ways to solve this. Use some combination of these techniques:
override the protected keyDownHandler() method of the List component. I don't have the code handy, but if you look at it's implementation in the List class you should be able to make your overridden version set the focus on the next renderer.
use methods of the FocusManager to find components in the tab loop: getNextFocusManagerComponent(), findFocusManagerComponent(). Check the docs there are others that will be useful. For example, when the user presses the down arrow, you can let the next item renderer get selected, then use findFocusManagerComponent() (passing in the newly selected renderer) and then tell the FocusManager to focus it with the setFocus() method. This is probably not exactly the right approach ;)
By the way, the FocusManger is a Flex singleton object, every UIComponent in Flex has a focusManager property you can use to get a reference to it.
consider disabling focus on objects that don't need to receive focus (like the Label in your item renderer). There are numerous properties to do this: focusEnabled, hasFocusableChildren, mouseFocusEnabled, tabEnabled, tabChildren etc.
consider disabling focus on the List component, but then making your item renderers implement the IFocusManagerComponent interface. Implementing the interface is simple, you just declare it in your class (there's no actual methods to implement). The tricky part will be now your item renderers need to have key down handlers (just override the protected keyDownHandler() method that all UIComponent objects have).
I think there are other techniques you can use, it's just been too long since I did this. I'd be happy to provide more help if you get stuck somehwere...

Embed custom control to CMFCPropertyGridCtrl Property Item

I want to embed two generic buttons like "Select" and "Cancel" to CMFCPropertyGridCtrl property line. Is there a painless way to do that?
Found a solution myself. You can use OnCreateEditor virtual method to send a custom control to a property. Note, that it will be shown on property edit. Another important note, that CMFCPropertyGridCtrl calls OnCreateEditor each time the user edits the property but before the control is destroyed it deletes the last received CWnd object itself. You should consider that. I have found no notes about that in MSDN CMFCPropertyGridProperty documentation (you know what to say).