Setting row height is more or less trivial via inherit from QItemDelegate.
The problem is that I can make the row size bigger but I cannot make it smaller if I add a widget inside.
Any tip on this?
Thank you in advance.
Maybe your widget QWidget::minimumSize().height() is bigger than you want to set in your row height?
Also, maybe you will post some related code?
Related
I have a vertical QSplitter with two widgets inside whose layouts contains more widgets. How can I set the initial height of the second widget to its minimum possible height (wrap to its content)?
Thanks in advance,
You can use QSplitter::setSizes to set widgets' sizes. You can obtain total available space using QSplitter::size. You can obtain minimal width of the second widget using QWidget::sizeHint. It will help you to calculate values that should be passed to setSizes.
I have a Qt Widget which has a frame, containg the rest of the widgets.
I only want one of the widgets to expand on maximazing the window, so I've set a max value for the others.
But it will only expand if I set a grid layout to the frame, which messes up the place of the widgets.
How can I solve it?
Do you use any kind of layout ?
Size policy only works if the parent has a layout set.
You can use a combination of different layouts to obtain the desired look, otherwise you will have to calculate the size of the 'expanding widget' yourself in the resize event method of the parent.
My problem probably is very simple, but I have no idea how to solve it.
So, I have several widgets in vertical layout. Some of them in some moment should be invisible. I suppose this moment the control that has expanding vertical policy should increase its height but it never happens. Why? How to force it to change the size? So far there is only one way to do that - to change the size of window manually a little bit and only after it the widget changes its height.
When you make a widget invisible (i.e. call hide), also remove it from the layout (see removeWidget). That way all of the other widgets will automatically resize to make use of the extra space. Since you are only hiding the widget, its space is still reserved in the vertical layout.
Make use of insertWidget to maintain the layout ordering when transitioning a hidden widget back into view. Otherwise, addWidget would always place it at the bottom. This approach should be less complex than managing the sizes manually.
Try calling adjustSize() on the parent of the layout.
Have you tried setting the stretch on 1 for the widget you want to be expanded when others are hidden?
QBoxLayout::addWidget( my_widget, 1 );
When this widget is added with a stretch of 1 and the other widgets without stretch, this widget will expand to the available space. Maybe that will do the trick.
I have three datagrids inside VBox container. Since I don't want scrollbar in my flex widget i am increasing the height of SWF
through javascript, which increases with each addition of row in my datagrid. My query is how can I get the exact height of
my VBox which is the parent element of datagrid. I am not able to get the height of VBox. I have tried to use measuredHeight,height with no success.
Could anybody please suggest me the way out for the same.
Thanks in advance!!!
vbox.height should give you theheight of the DataGrid.
I am trying to center itemRenderers in a horizontal list if the number of items in the list is less than the maximum visible number. Has anyone found a good way to do this?
See an illustration of what I mean if it is hard to picture.
Thanks!
Override the measure() method - I've writen a blog entry here: http://flexmonkey.blogspot.com/2010/05/centre-aligned-horizontallist-in-flex.html
simon
One solution that comes to mind would be to add invisible renderers to achieve the same centering.
You might want to consider using a horizontal box or "Hbox" instead of a horizontal list component. This will allow you to use the horizontal align property to set center. If not, simply extend the horizontal list component to accept a center align property, and copy it from the hbox to your new extended component.
Would paddingRight or paddingLeft accomplish what you're looking for? If you combine it with setting the columnWidth and the columnCount, that would allow you to adjust where the items first appear.