Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to change the direction of images in QListWidgetItem.
Hi everyone, I'm stuck in my code. I want to change the direction of images form "Top to Bottom" to "Left to Right" and the text below the images
self.blistWidget.setLayoutDirection(QtCore.Qt.LeftToRight) self.tabWidget.currentChanged.connect(self.add_images_to_TabLayout) def add_images_to_TabLayout(self): #QtWidgets.QListWidgetItem.setLayoutDirection(QtCore.Qt.LeftToRight) item1 = QtWidgets.QListWidgetItem(QIcon("C:/Users/OB/Desktop/DevoMech Project/4.JPG"), "item1") self.dlistWidget.addItem(item1) item2 = QtWidgets.QListWidgetItem(QIcon("C:/Users/OB/Desktop/DevoMech Project/5.JPG"), "item2") self.dlistWidget.addItem(item2)
output of my code
Did you try icon mode ?
it will make ListWidget display like
Do note the
that sets the grid/sizes.
okay. Thank you
oh last note.
the property movement is default sat to "free" so user can drag the images around. I often set to fixed as its not really useful.
@mrjj One more Question how to increase the gap between the images
You can do that with the gridSize property.