Layout fails to adjust screen size in Qt - qt

I am trying to make a GUI similar to the layout in Image attached.
The problem starts when I add the three frames besides the stacked widget.
Frame one contains some labels for status.
Frame two contains some buttons and two sliders.
Frame three contains a tab widget.
I am adding suitable layouts at every stage. The layout fails to adjust to screen size and the window goes outside the limited size. I tried setting maximum size for the frames and stacked widget but the problem stays.
Can some one tell me if I am missing out on something.
Thank You

You should to understand, what is Layout is. And especially Layout stretching. Have you seen it?

Related

Freeze/float cell while keeping other cell scrollable

I am creating a table where I need to freeze some cell while keeping the other cell scrollable. The table must be responsive to screen size that is why I need to make some cell scrollable.
Based on the picture above, I want to keep the blue area floating/or freeze while the red area scrollable.
How is this possible in google app maker?
First of all, this widget that you refer to as a table in your sample screen is actually a composite widget where it combines several basic widgets like the list, horizontal panel, and pager.
There is another table widget under charts, called Table chart, that can be used to present your data in rows and columns. But if you are looking for a property that can achieve this UI effect, then I'm afraid AppMaker does not support this yet.
If you are really keen to make this work, I would suggest that you combine two table widgets that inherit the same data source then wrap them SIDE-BY-SIDE in a horizontal panel. The left side will only contain columns that you want to freeze while the right size will have the rest of the column that can be scrollable.
Make sure to set the height of both tables to auto-grow based on the content (Fit to content). This will give the effect that the two tables are merged when doing vertical scrolling.
I have here a sample implementation as I described above. I gave a background to the main container to better understand the concept. I also added a small gap to show that I used two table widgets.
Here is the set-up in editor view (screen-shot)
See it in action here (video)

How can i split my mainwindow into 5 areas with QT-Layouts

I want to make a GUI with QT Creator 4.9.1 ,my aim is to split my mainwindow into 5 areas(no multiple window), my question is how can i realize that, or better what is the best Layout solution for that?
I have allready tried to set a datagrid and add inside that grid 5 frames, the problem is that the first frame has the size of my whole datagrid and i can't resize it.
My next try was to add 5 different datagrid on my GUI but i can't set the size of the datagrid's in QT like wpf or forms.
My last try and my current solution is without any layout, i add 5 fame's inside my mainwindow but that isn't a good solution.
Inside visual studio i realize that with datagrids i create for every menu one grid and change the visibility when the user need a other (area 2).
friendly wishes sniffi
The suggestion to using dock windows may be a good one to investigate, particularly if you need to allow the user to resize or move things around. However, to get the layout you want with just layouts, the trick is to use multiple layouts.
Create a vertical layout for the left-hand side and add the four widgets to it. Create a horizontal layout and add the vertical layout in the first column and your tall, fifth widget to the second column. Apply the layout to your main windows, and that should give you roughly what you're looking for.
You'll almost certainly need to play with the row stretches on the vertical layout to get the proportions you want, and with the column stretches on the horizontal layout.
The alternate would be to create a grid layout where the widget on the right side spans four rows, but I think you'll be happier with the mix of the two layouts.

Is possible to do a flex layout with Qt?

I want to make something like a gridlayout but the layout must decide how many elements can be fitted in a row, and when the row is full continue with the next row.
QtGridLayout also fixes the columns width.
I want to something like this (this pictures was manually organised in Horizontals and verticals grids)
When the image size changes one of the buttons goes to first row.
((In this compositions both images looks with the same size, but actually second one is wider than first one).
Some one answer this question but remove it, so the credits are for my unknown friend.
Qt have an example named Flow Layout Example for a widget based form and another for Graphics View widget.

Add fixed sized items to grid layout in correct row

I am trying to create a grid layout of images kind of like how google images does it.
I want to add fixed sized images left to right, top to bottom but I am having trouble is figuring out when adding another image to a row would make it not fit and then decide that that images should be placed in a new row.
Also when the window resizes it should move images into/from rows based on how many it can fit in.
Ive got a scroll area with a grid layout in it which is fine if I know what can fit, but I can't figure out how to make it move items if say the window width is shrunk, and say an item needs to be moved down 1 row which moves other etc.
Assuming you are using QWidgets I'd suggest you to use QListView which does the layouting for free, if you want more control on how items are displayed use a QItemDelegate. For QListView the view mode should be set to QListView::IconMode so that you have a grid of items and not a list.
But if you are using QtQuick things are much easier, a GridView with Image delegates would do what you want really quickly and using GPU power to build you UI.

wxpython not showing the entire grid

I have a wxpython csv reader. I am displaying results on a grid. The grid will take about half of my screen. I would like to display 100 rows at a time. I assign there to be 100 rows but I can not scroll to the bottom 50. I have proved that the rows are there by writing to the rows that I can not see then copying the whole column and pasting in excel. What I am expecting to see is a scroll bar that allows me to scroll to the bottom 50. I allowed editing of size of column. When I increase the height of the column, the scroll bar appears,but still only allows me to view the top 50 columns. (if user makes column height a inch bigger than normal, my scroll adds an inch) My best guess is there is something wrong with the way I am initiating/getting the best size of the combinations of sizers,panels,and the grid. I have cut out the code that not needed but the layout panel and box are my overall/main panel and box.
import wx.grid as grd
import wx
self.layoutPanel = wx.Panel(self)
self.layoutBox = wx.BoxSizer(wx.VERTICAL)
self.previewPanel = wx.Panel(self.layoutPanel)
self.previewBox = wx.BoxSizer(wx.VERTICAL)
self.resultGrid = grd.Grid.__init__(self, self.previewPanel,0)
self.resultGrid.CreateGrid(105,20)
self.previewBox.Add(self.resultGrid,0, wx.GROW)
self.resultGrid.SetSize(self.resultGrid.GetBestSize())
self.previewPanel.SetSizer(self.previewBox)
self.layoutBox.Add(self.previewPanel,0, wx.ALL)
self.layoutPanel.SetSizerAndFit(self.layoutBox)
self.layoutPanel.Layout()
The problem was nested somewhere in having 2 panels in side one another. This is normally "ok" to do but it is a little more complicated with the grid. I got rid of the previewPanel and previewBox completely and that solved the problem. However another problem was the FIT. The fit makes the panel as small as possible which is not what I wanted to happen. In code not shown I had re-sizes occurring and when I did this I had setSizeAndFit which took the scroll away. I changed it to setSize and the scroll bar stayed.

Resources