How to Set Vertical and Horizontal Scrolling to CollectionReusableView and CollectionVeiwCell respectively - uicollectionviewcell

UICollectionView's ContentView have two items.
CollectionReusableView.
CollectionViewCell.
here, I want to set CollectionReusableView as header with Vertical Scrolling direction and collectionVeiwCells with Horitontal Scrolling Direction.
how do i make this posible
here,Top View is collectionReusableView and Bellow view is collectionViewCell.
i would like to have horizontal scrolling for CollectionveiwCells alone.

We can't set horizontal and vertical scrolling separately for UICollectionView's cells or collectionReusableViews. It's only possible to set scrolling directions and bounce to UICollectionView class alone.
I have planed to customize UIView with stretch header, for that i have arranged two separate UITableViews with vertical scrolling inside the two collectionViewCells with horizontal scrolling direction respectively. This collectionveiw should be part of UITableViewController with static cells which should have vertical scrolling only. To get more clarity on this please refere the image bellow.

Related

How to show several QTableViews(without scrollbar) in QListWidget(or other similar widgets)?

I have a problem with showing multiple tables(without their own scrollbars) under one scrollbar. Is there any workaround or a good way to resolve this issue in Qt?
I've tried to do what you ask, and found this. So, here is a solution:
add QScrollArea to a form
set the property widgetResizable to true
put QWidget to scroll area
right click on widget -> Set ancestor -> [your scroll area]
add vertical layout to a widget
scroll area will collapse, epand it with a mouse
insert into the widget as many tables as you want
set vertical size policy for each table to Minimum and set minimal vertical size.
Here is how it looks:

QT - Place Buttons on Bottom Right

I am trying to place a set of buttons so that they are anchored to the bottom right of the screen. My problem is that whenever I resize the screen, the buttons are not anchored to the bottom right, but stay in its current position.
I have placed two Push Buttons inside a Horizontal Layout. I then placed this layout inside a Grid Layout, which contains a Horizontal and Vertical Spacer. I have modified the Grid Layout layoutSize property to SetMaximumSize.
What am I doing incorrectly, so that I can get my buttons to be anchored to the bottom right?
You have almost everything just right here, but you probably overlooked something that is really easy to miss when you first start using Qt Designer.
Your grid layout is sitting inside your widget with a fixed size and position. It too needs to be managed by a layout. If you take a look at the Object Inspector on the top right (that contains your hierarchy) you will probably see your top level widget with a red icon. This indicates that it contains no layout. You have two options to fix this...
Have your existing grid layout placed into another main layout (like a vertical layout). You would simply right click on your top level widget in the Object Inspector -> Lay Out -> [Choose a main layout type].
Have your grid be the main layout. To do this you would need to remove the grid layout and have your child items arranged exactly how you have them in that picture. Then follow the previous option, right clicking on the top level widget (or the blank background) and choose Lay out -> Grid. This will pop your widgets into a Grid at a best visual fit (which you can then fix if needed), and your grid will be the top level layout.
That grid layout will make placing other widgets quite hard. Try this instead:
Add (from left to right) horizontal spacer and the two buttons.
Multiselect them all.
Select "Lay Out Horizontally" (Ctrl-H) from the Qt Designer's (or Qt Creator's) top toolbar (not from the widget box in the left!).
Add vertical spacer on top of the previous widgets.
Select the main window by clicking it (none of the added widgets are now selected).
Select "Lay Out Vertically" (Ctrl-L) from the top toolbar.
Done.
It seems that you're doing it correctly. Just forgot to apply a layout to your central widget, right? The Grid layout should be arranged in your central widget. The more convenient way is to remove grid layout widget and lay out the central widget in a grid ;-)

Qt: How do i set the height on a Vertical layout?

I'm having trouble using the layout manager system with Qt. This is going to be a Symbian app, so it should resize to different devices.
This is done by using the Layouts.
On the image below I used the Vertical Layout, but I don't understand how I can decide how much each cell should take in width and height.
I want the blue to be a top label background, but I don't want it to be as high as it is now.
Does anyone know how I can do this? (I'm new to Qt :))
You can set the maximum size for a widget by right clicking it and selecting 'Size Constraints'. Under that menu you can find actions that allow you to set the current displayed size as the maximum / minimum size for vertical / horizontal or both directions.
You can also set the numbers by hand by selecting the widget and by setting the number in the 'Property Editor'. They should be under the QWidget properties.
You cannot set the Height of a vertical layout directly, but you can set the height of the widget in which the vertical layout is.
If you want to split your Widgets so that the top widget takes 33.33% of the space, use the Stretch values. Set the top widget to 1 and the bottom widget to 2.

How to scale an widget in specified in qt

I have divided my main screen in 4 areas as border-layout as center,right,left and bottom. The right, left and bottom areas are small and contain only buttons. My center area has to display the different widgets and forms depending on the buttons pressed in right/left/bottom areas.
Can anybody suggest how I can design my forms or widgets so that when I show the widget in the center area, it will fit into the center area and all the items inside this will be scaled rationally.
Please refer to the attached image file for a better idea.
If my explanation is not clear please let me know I will try better.
Looks like you already have a decent start. If you only have icons, typically icons won't be able to expand much so you will want your left,bottom and right containers to be non-expanding.
The center container (most likely a QStackedWidget in your case) will be expanding both horizontally and vertically.
You will also need to add spacers at the bottom of left area and right area.
The bottom area can also use spacers on both sides.
In short
Bottom area: sizePolicy: Preferred/Minimum, maximumSize: inf/40
Left area: sizePolicy: Minimum/Preferred, maximumSize: 40/inf
Right area: sizePolicy: Minimum/Preferred, maximumSize: 40/inf
Center area: sizePolicy: Preferred/Preferred, maximumSize: inf/inf
Here is what you can do with drag and drop within QtDesigner
Here is what it looks like
Here is what it will look like expanded. Notice that although the main area is bigger, the buttons sides remain the same.

Is it possible to get a custom ItemRenderer to scroll the DataGrid rather than its cell?

I'm having an issue with a custom ItemRenderer I've written for a DataGrid. With this ItemRenderer, it's possible that the contents could exceed the width and height of the DataGrid cell - and when this happens, scroll bars appear, letting me scroll the individual cell.
What I would like, however, is that when the contents of the cell are too large, the entire DataGrid scrolls, rather than the individual cells.
Now, when I set the custom ItemRenderer's horizontal and vertical scroll bar policies to "off", I get the vertical scrolling on the DataGrid that I want (the individual cells stretch to accommodate the full height of the contents) but I don't get any horizontal scrolling. Instead, any content too wide for the cell is clipped. Incidentally, setting the DataGrid's horizontal scroll bar policy to "on" has no effect, the scroll bar gutter is drawn, but nothing scrolls
Is there a way to force the DataGrid to scroll horizontally when my custom ItemRenderer's contents are too wide for the cell?
You may have to find a way calculate and expand the size of the DataGrid horizontally in a canvas so that it shows all the cells, and the scrollbar would appear as part of the canvas.

Resources