I dynamically add and remove elements form VGroups. When I create an element and then append it to a VGroup and then remove it from that VGroup, does it destroy the element completely? if not, how can I destroy the element so it won't take space in memory.
An Object is sent to the garbage collector as long as there are no references to this object. which means two things:
all container elements that include this object should remove the element (Group,Box,Container,...)
all event listeners should be removed.
Related
When a parent node becomes invisible a child becomes invisible too without modifying child visible property. So how can the visibility of a child node be observed without observing all parent nodes and the hierarchy? Is there a proper event fired?
I don't think there is a direct way to achieve what you want. There is no property to observe and no event is fired when the parent visibility changes.
You can take a look at the internal implementation of Node.parentPropertyImpl(), which basically does what you want to avoid: it adds an InvalidationListener to the parent's impl_treeVisibleProperty (internal API and deprecated).
Using componentHandler.upgradeAllRegistered(); upgrades all matching elements within the DOM, which is an unnecessary performance cost in my case:
When I insert an element in the DOM, anything from parent to root does not need to be re-upgraded. Only the element and its children are newly created elements and need re-initialization.
How can I achieve this functionality?
Some insides: https://github.com/google/material-design-lite/issues/871
componentHandler.upgradeElements(node)
Where the node variable is the element (and children) you wish to upgrade.
Can anybody please tell me what about visible and includeInLayout properties of a component and what is the state of the component when they are in combination of {false,false},{false,true},{true,false}. Thank you in advance.
Ok, visible is only about visibility of component and includeInLayout is only about taking part in process of component's laying out. Talking about laying out we're talking about such layouts as vertical layout, horizontal layout or tile layout where positions of the children determines by positions of other children.
Well, according to this explanation false,false is about target display object will not visible and will not affect on the position of other objects in layout. It is the same as target display object isn't exist at all.
The case false,true describes the situation where target display object isn't visible but takes part in layout. For end user it is an empty space between other objects in layout. This space has the same dimensions as our target display object.
The case true,false makes target display object visible but with not predictable position (depends on the particular layout implementation). Anyway it is not affect other elements position which laying out the way as target display object doesn't exist. It is very likely some of the other element overlap our target display obje
I want to make editable cells with multi-lines content in QTreeWidget and I use for this purpose QPlainTextEdit as a delegate. I need to set proper size to all rows that switching between editing and displaying went smooth, without any visible changes.
rect = textEdit.blockBoundingRect(textEdit.firstVisibleBlock())
With this I can find out the height I need to set for the row, but I missing the place where I can do it.
How can I set proper height to QTreeWidget's rows on initialization stage and how to handle it's changes?
You need to reimplement delegate's sizeHint(). It will automatically handle row's height and width.
And note, that QTreeWidget::uniformRowHeight property must be false in this case, though it will slow tree element rendering if it contains many rows.
just wanna ask is it possible to remove the linebreaks? Now I want to have a row of textbox, buttons and a combobox, but the combobox will be at new line when I run the application. So is there a way to stop it from going to a new line? Thanks.
Setting the form elements style display property to "inline" will ensure they fall on the same line until they run out of space, at which point of course, they have to go to the next line. Now you can set the height and width properties on the form elements so they all fit on the same line, and even expand to fill the available space if needed.
The combo box should have it's style display property set to block, so it will fall on the next line automatically. EX: Style="display:block"
Are you running out of vertical space? Inline is the solution if not, as some elements may default to block and add a new line.
But if you want everything to be on the same line, but are running out of space, you could try specifying for a root element style="white-space:nowrap;". I forget if it's white-space or whitespace, but either it would prevent wrapping of elements that way.