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

Ramesh ramesh.bs at robosoftin.com
Wed Aug 25 08:46:16 CEST 2010


The icon size is depending on the items icon you insert, i.e
QStandardItem* pi = new QStandardItem(QIcon("./channel.png"), "hello");

Or another option is, use the delegate to return the icon size for your
listview.

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of bob
Sent: Wednesday, August 25, 2010 11:55 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] Can't change the Icon size in the HeadView of
QTableView!

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));

I try to change the size of ph->setIconSize(QSize(40,40)); ,but the size
of icon don't do any change, why?

BTW:the version is qt-everywhere-opensource-src 4.6.2

Best Regards

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.



More information about the Qt-interest-old mailing list