45 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) 46 setSectionsClickable(
true);
47 setSectionResizeMode(Fixed);
52 setDefaultSectionSize(27);
57 if (orientation() == Qt::Vertical)
59 QHeaderView::paintSection(painter, rect, logicalIndex);
65 painter->translate(rect.x(), rect.y());
67 painter->translate(-rect.height(), 0);
68 QHeaderView::paintSection(painter, QRect(0, 0, rect.height(), rect.width()), logicalIndex);
74 if (orientation() == Qt::Vertical)
75 return QHeaderView::sectionSizeFromContents(logicalIndex);
77 Q_ASSERT(logicalIndex >= 0);
82 QVariant variant = model()->headerData(logicalIndex, Qt::Vertical, Qt::SizeHintRole);
83 if (variant.isValid())
84 return qvariant_cast<QSize>(variant);
87 QStyleOptionHeader opt;
88 initStyleOption(&opt);
89 opt.section = logicalIndex;
90 QVariant var = model()->headerData(logicalIndex, orientation(), Qt::FontRole);
92 if (var.isValid() && var.canConvert<QFont>())
93 fnt = qvariant_cast<QFont>(var);
97 opt.fontMetrics = QFontMetrics(fnt);
98 opt.text = model()->headerData(logicalIndex, orientation(), Qt::DisplayRole).toString();
99 variant = model()->headerData(logicalIndex, orientation(), Qt::DecorationRole);
100 opt.icon = qvariant_cast<QIcon>(variant);
101 if (opt.icon.isNull())
102 opt.icon = qvariant_cast<QPixmap>(variant);
103 QSize
size = style()->sizeFromContents(QStyle::CT_HeaderSection, &opt, QSize(),
this);
104 if (isSortIndicatorShown())
106 int margin = style()->pixelMetric(QStyle::PM_HeaderMargin, &opt,
this);
107 if (orientation() == Qt::Horizontal)
108 size.rwidth() += size.height() + margin;
110 size.rheight() += size.width() + margin;
112 return QSize(size.height(), size.width());
117 if (isSectionHidden(logicalIndex))
119 if (logicalIndex < 0 || logicalIndex >= count())
122 QVariant
value = model()->headerData(logicalIndex, orientation(), Qt::SizeHintRole);
124 size = qvariant_cast<QSize>(value);
127 int hint = size.height();
128 qDebug() << logicalIndex << size << hint;
129 return qMax(minimumSectionSize(), hint);
std::size_t size(custom_string const &s)