[Qt-interest] Can't change the Icon size in the HeadView of QTableView!

bob bob.li at i-soft.com.cn
Wed Aug 25 09:28:33 CEST 2010


Bo Thorsen 写道:
> Den 25-08-2010 08:24, bob skrev:
>   
>> Hi, All,
>>
>> When i use QTableView, find can't change the icon size in the HeadView
>> of it. The core part of code as follow:
>>
>> QTableView *pv = new QTableView();
>> QStandardItemModel* pm = new QStandardItemModel();
>> QStandardItem* pi = new QStandardItem(QIcon("./channel.png"), "hello");
>> //the size of png file is 128*128
>> pm->setHorizontalHeaderItem(0, pi);
>> pv->setModel(pm);
>> pv->setGeometry(100, 50, 400, 200);
>> pv->setParent(this);
>> QHeaderView *ph = pv->horizontalHeader();
>> ph->setFixedHeight(80);
>> ph->setIconSize(QSize(40,40));
>>     
>
> pi->setSizeHint(QSize(128, 128));
>   
Try this, but didn't any change, it's same.

Thanks!

Bob
> Bo.
>
>   




More information about the Qt-interest-old mailing list