Results 1 to 5 of 5

Thread: qstandarditem how sisplay icon in center?

  1. #1
    Join Date
    Dec 2008
    Location
    chinese
    Posts
    47
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default qstandarditem how sisplay icon in center?

    i want to display icon in center of qstandarditem,but can't find way to work out ,colund somebody tell me how to do it?

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qstandarditem how sisplay icon in center?

    delegates... delegates
    calculate the position / rect where you want to draw the icon, and call QItemDelegate::drawDecoration with this modified rect ...
    You will also need to adjust ur displayRect aslo might be.

  3. #3
    Join Date
    Dec 2008
    Location
    chinese
    Posts
    47
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qstandarditem how sisplay icon in center?

    thank you ,but i do't draw icon, i create standarditem with icon .for example:

    qstandarditem testitem=new QStandardItem(iconObject);

    how to set the iconObject to center?

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qstandarditem how sisplay icon in center?

    I dont think any of the default views paint the icon in center... they provide left, right, top, bottom... but not center
    u might need to use delegates..

  5. #5
    Join Date
    Dec 2008
    Location
    chinese
    Posts
    47
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: qstandarditem how sisplay icon in center?

    Quote Originally Posted by aamer4yu View Post
    I dont think any of the default views paint the icon in center... they provide left, right, top, bottom... but not center
    u might need to use delegates..
    thank you ,let me try it

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.