Currently when I drag out a row from an NSTableView it is semi-transparent text in the row. Instead I would like to show a semi-transparent image representing this row.
How can I achive this?
I suggest overriding either -[NSTableView dragImageForRowsWithIndexes:tableColumns:event:offset:] (available since OS X 10.4) or the draggingImageComponents property of NSTableCellView (available since OS X 10.7, for the new view-based table views).
Related
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.
I use grid layout (horizontal and vertical too). I like the fact that when resizing the window fills the entire window contents. but this extension is poorly managed. I often want to change the size of only one column in grid layout without changing the size of the window. such as in Windows Explorer. there are two columns - the left list of directories and their contents to the left to the right. and i can always press mouse button therebetween and pulling change the mutual sizes of columns in relation to each other.
how can I do this in Qt?
You need to use a QSplitter rather than a QGridLayout in this specific case (where you just want 2 widgets shown together). QSplitters are draggable.
You are looking for QSplitter
(The following is the procedure in the Qt Designer)
Group your widgets, and click Lay Out Horizontally/Vertically in Splitter
Put this group into another layout (QGridLayout, for example) to automatically expand it.
Congrats! Your Layout is now draggable(from step1) and expandable(from step2).
I hope to create a "NEW" listview like QML Exmaple with native Qt classes.
Exactly I want to make a listview which works like below.
It looks like a QML example but slightly differs. QListView has a limitation for it's layout, right? I want a hint for overcoming the problem.
You'd want to use GridView instead of ListView. That'll get you a step closer to making your UI look like what you have designed. However currently Qt Quick only supports fixed cell sizes of grid items, which means you won't be able to expand the cell size of just one item. All you can do is set up the cell size to fit the expanded item so that every grid item will take up as much space as it could possibly need. Then you can alter the dimensions of each item without worrying about fitting issues.
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.
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.