Iconview text location
-
I created IconView of pixmap files using QListView and set the followings
QListView* iconview2=new QListView; int iconSize_int=128; iconView2->setResizeMode(QListView::Adjust); iconView2->setMovement(QListView::Snap); iconView2->setViewMode(QListView::IconMode); iconView2->setUniformItemSizes(true); iconView2->setSelectionMode( QAbstractItemView::ExtendedSelection ); iconView2->setStyleSheet("QListView::item:deselected { border: 1px solid black; border-radius: 6px; color: black;} QListView::item:selected {background: white; border: 4px solid orange;}"); iconView2->setIconSize(QSize(iconSize_int,iconSize_int)); iconView2->setGridSize(QSize(iconSize_int+30,iconSize_int+30)); iconView2->setMinimumWidth(iconSize_int+38);
You can check the output of this in the attachment.
Instead of putting text inside border like this,
can I put the text outsied border such as at T1, T2, T3, ....? -
@samdol This will be possible by creating custom delegate using QStyledItemDelegate and draw them manually.
-
I created IconView of pixmap files using QListView and set the followings
QListView* iconview2=new QListView; int iconSize_int=128; iconView2->setResizeMode(QListView::Adjust); iconView2->setMovement(QListView::Snap); iconView2->setViewMode(QListView::IconMode); iconView2->setUniformItemSizes(true); iconView2->setSelectionMode( QAbstractItemView::ExtendedSelection ); iconView2->setStyleSheet("QListView::item:deselected { border: 1px solid black; border-radius: 6px; color: black;} QListView::item:selected {background: white; border: 4px solid orange;}"); iconView2->setIconSize(QSize(iconSize_int,iconSize_int)); iconView2->setGridSize(QSize(iconSize_int+30,iconSize_int+30)); iconView2->setMinimumWidth(iconSize_int+38);
You can check the output of this in the attachment.
Instead of putting text inside border like this,
can I put the text outsied border such as at T1, T2, T3, ....?Here is small sample of a Delegate
http://3adly.blogspot.dk/2013/09/qt-custom-qlistview-delegate-with-word.htmland the more involved sample
http://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html