PDA

View Full Version : Showing Icon in vertical header of a table



vishal.chauhan
10th January 2007, 11:27
Hi All,

I m using qt 4.2.2 on my mac intel.
I have created a tablewidget and using this code to show Icon in a vertical header to its original size

QSize size1(48,48);
QIcon a(":/images/nikon_logo.png");
a.actualSize(size1,QIcon::Active,QIcon::Off);

QTableWidgetItem *item=new QTableWidgetItem(a,"1",0);//set Icon a and string 1

tableWidget->setVerticalHeaderItem(0,item);
tableWidget->verticalHeaderItem(0)->setSizeHint(QSize(70,tableWidget->verticalHeaderItem(0)->sizeHint().height()));


but actually this is showing very small icon.

If anybode know how I can show largeIcon in VerticalHeader then plz tell me.

Thanks.

guilugi
10th January 2007, 13:28
Did you try this ?

tableWidget->verticalHeader()->setIconSize( QSize(48, 48) );

vishal.chauhan
10th January 2007, 13:56
There is no change in icon size.
Its not working.

guilugi
11th January 2007, 15:43
Yes, I tried to play a little with itemviews methods, without success..

You should try those 2 ideas :

- Use a costum item delegate for the headerview, with your own settings.
- Subclass QHeaderView and provide your own header ;-)

Guilugi.

jpn
11th January 2007, 15:51
- Use a costum item delegate for the headerview, with your own settings.

QHeaderView is not a full-featured item view. It doesn't actually use item delegates for anything at all. One idea less to test.. ;)

wysota
11th January 2007, 16:07
Here is another one to test - use QPixmap instead of QIcon.

vishal.chauhan
15th January 2007, 09:52
Here is another one to test - use QPixmap instead of QIcon.

Thanks.
But still no change in Icon size.

I m taking image in pixmap and then adding it to icon but no change in icon size.

wysota
15th January 2007, 10:44
But still no change in Icon size.

In that case you have to reimplement the header and do the drawing yourself. Try searching this forum, there has recently been a simmilar issue brought up.