Results 1 to 6 of 6

Thread: QListView icon size and align

  1. #1
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QListView icon size and align

    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] :
    Qt Code:
    1. m_DetailTree->setMovement( QListView::Static );
    2. m_DetailTree->setGridSize( QSize( 60, 60 ) );
    To copy to clipboard, switch view to plain text mode 

    [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 :
    Qt Code:
    1. m_DetailTree->setGridSize( QSize( 80, 80 ) );
    2. m_DetailTree->setIconSize( QSize( 80, 80 ) );
    3. m_DetailTree->setUniformItemSizes( true );
    To copy to clipboard, switch view to plain text mode 
    setIconSize has no effect, maybe a bug of Qt.
    Last edited by Alundra; 5th June 2014 at 04:05.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QListView icon size and align

    If an icon is smaller than the set icon size then it is not upscaled. Use a larger icon.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QListView icon size and align

    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 ?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QListView icon size and align

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    Alundra (5th June 2014)

  6. #5
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QListView icon size and align

    Is it possible to find an icon filepath from stylesheet or that demand a custom parser ?

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QListView icon size and align

    There is no interface for accessing the stylesheet. It is an opaque string, if you want it parsed, you have to do it yourself.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Center icon in QListView using QStyledItemDelegate
    By franki in forum Qt Programming
    Replies: 1
    Last Post: 11th June 2013, 08:53
  2. Replies: 1
    Last Post: 20th May 2011, 17:36
  3. Icon margin in QListView
    By mpi in forum Qt Programming
    Replies: 4
    Last Post: 1st July 2010, 13:56
  4. icon glitch in QListView
    By trhaynes in forum Qt Programming
    Replies: 1
    Last Post: 31st August 2009, 19:48
  5. QListView icon double clicking
    By been_1990 in forum Qt Programming
    Replies: 8
    Last Post: 28th April 2009, 20:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.