Qt, mixing items with and without checkboxes in QListWidget - qt

Good day everyone. I'm trying to create a filemanager based on QListWidget. However, I ran into a problem. In my manager I need to have some items be with checkboxes and the other items to be without them. The problem is that in the items without checkboxes the text and icons are shifted to the left (slightly in IconView and substantially in ListView).
Is there a way to make the text and icons in all checkboxes be on the same line?

Aligning the items in that column to the right seems to be a viable option.

Related

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.

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.

QListWidget: More icons on one row

For my bachelor thesis I'm programming an Role Playing Game maker. I'm making use of tilesets (left picture below). I load such an image in my project and split it in small square blocks (tiles). Now, I load these in a QListWidget, but I would like the QListWidget to show as many tiles in a row as there are in the image (for example: the image below contains 8 tiles/row, but in my program, the QListWidget only shows 6 tiles per row).
I have tried to work with layouts, but these don't seem to work. Any idea on how to let the QListWidget display a custom amount of items per row? I like to work with the QListWidget because it provides a good way of selecting the tiles and propagating to the parent widgets which tile should be drawn in another widget.
Thanks in advance.
well... I am not 100 % happy with the current answer from user336063
the QListWidget has a "viewMode" property,
if you set that to IconMode your list will look like:
by default it looks like:
You may have an easier time using a QTreeWidget or QTableWidget.

adobe flex datagrid selectable columns

I'm trying to make a Flex (Advanced)DataGrid component with some mechanism where the user can toggle the visibility of the columns. I've crudely implemented this by reading in the columns into the right-click menu, and when a column name is selected here, the visibility is toggled. It works, but it's not the most elegant solution.
Specifically, I'm trying to emulate the "datagrid" that Mozilla Thunderbird uses to display emails. Here is an image:
In the upper right, there is an icon over the scroll bar. If there is no scrollbar, the icon remains in the same place. When clicking the icon, it opens up a menu that shows all the possible columns, with the visible ones having a check mark next to them, like this:
Also, the scroll bar always appears under this button, never "pushing" it over into it's own column.
I'd like to re-create this in Flex. I believe the menu part and creating a column with a button headerRenderer is easy enough. But I can't figure out how (if at all possible) to do this with the scrollbar, because the scrollbar always seems to be "its own column". Any ideas or help would be appreciated. Thank you.
Ian
One dirty solution comes to mind. Create a component based on Canvas, then add an AdvancedDataGrid by overriding createChildren. Override updateDisplayList as well and add a button like the one in Thunderbird to the upper right of the Canvas. This will cause the button to appear over the DataGrid. Problemo solved?

Can I use a table view for a table containing many images?

I have a table view in PyQt that needs to have an image in every cell.
I have used delegation of a label (and added a pixmap to that label). But the problem is when I add 12 cells (12 images of size 60x30 pixels), the table becomes too slow, and I need to have a table that contains hundreds of images. Should I be using another delegation? Or is it just not doable with a table view? If so, what is the best widget for such a task?
Any answer for Qt or PyQt would be highly appreciated.
I think you should try using QGraphicsView for your purpose. Its much faster to render images on it.
One clever way to do is created a huge graphicsitem which mimics a table based on ur rows and columns count.
then add children graphicsrectitem item as each cell container.
lastly add the images as qgraphicspixmap item as children of the rectitem. this way u can make it quicker and also interactive since u can select them individually and also make them movable inside the cell by user by checking collision detection to make sure they are not pulled outside the cell boundary.
hope that provides u an alternative.
QListView provides an icon mode where you can stack your images in a grid.

Resources