How to change the direction of images in QListWidgetItem.
Solved
General and Desktop
-
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
-
Hi
Did you try icon mode ?
it will make ListWidget display like
-
thanks bro
-
@Osama_Billah
np.
Do note the
listWidget->setGridSize(QSize(64, 64));that sets the grid/sizes.
-
okay. Thank you
-
@Osama_Billah
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. -
Hi,
You can do that with the gridSize property.