Вопрос

I put icons as items in a table:

QTableWidget *table = new QTableWidget(this);
QTableWidgetItem *item = new QTableWidgetItem;
item->setSizeHint(QSize(100, 100));
item->setIcon(QIcon(fileName));
table->setItem(0, 0, item);

However no matter the icons' size, they are shown extremely small in the table.
I do not care about the text.

How can I get them bigger?

Это было полезно?

Решение

You need to change the size of the icons in the QTableWidget. You can do so using the iconSize property inherited from QAbstractItemView. See here.

QTableWidget *table = new QTableWidget(this);
table->setIconSize(QSize(100, 100));
QTableWidgetItem *item = new QTableWidgetItem;
item->setSizeHint(QSize(100, 100));
item->setIcon(QIcon(fileName));
table->setItem(0, 0, item);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top