PDA

View Full Version : QListView icon size and align



Alundra
5th June 2014, 03:33
Hi all,
I'm working on a content browser, I have a QListView sets to icon mode.
That works fine but the problem is how changes the item size ?
Another problem is items are not aligned, a solution exists ?
Thanks for the help

[SOLVED] :


m_DetailTree->setMovement( QListView::Static );
m_DetailTree->setGridSize( QSize( 60, 60 ) );


[PROBLEM] :
That align but the size of the item in the grid cell doesn't take all the cell space, it's fixed size, a solution exist ?
I tried :


m_DetailTree->setGridSize( QSize( 80, 80 ) );
m_DetailTree->setIconSize( QSize( 80, 80 ) );
m_DetailTree->setUniformItemSizes( true );

setIconSize has no effect, maybe a bug of Qt.

wysota
5th June 2014, 08:22
If an icon is smaller than the set icon size then it is not upscaled. Use a larger icon.

Alundra
5th June 2014, 13:56
Ok, then a last question about that : Is it better to have large icon for icon view and downscale for the tree or have two icons ?

wysota
5th June 2014, 14:34
QIcon can hold more than one size of an icon and Qt mechanisms can ask QIcon for a pixmap with a given size thus it is better to have two pixmaps stored in one QIcon that will choose the pixmap for you.

Alundra
5th June 2014, 15:02
Is it possible to find an icon filepath from stylesheet or that demand a custom parser ?

wysota
5th June 2014, 15:24
There is no interface for accessing the stylesheet. It is an opaque string, if you want it parsed, you have to do it yourself.