View Full Version : qstandarditem how sisplay icon in center?
yunpeng880
2nd March 2009, 08:47
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?
aamer4yu
2nd March 2009, 09:27
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.
yunpeng880
3rd March 2009, 03:25
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?
aamer4yu
3rd March 2009, 06:19
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..
yunpeng880
3rd March 2009, 09:14
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
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.