سؤال

I use QStandardModel::setHorizontalHeaderLabels(QStringList() << "XXX") to set the header text, how could I extract it from the model?

I've checked the document about both QHeaderView and QStandardItemModel, but to no avail.

هل كانت مفيدة؟

المحلول

you can get QStandardItem representing headerItem using horizontalHeaderItem() API of QStandardItemModel.

QStandardItem * QStandardItemModel::horizontalHeaderItem(int column) const

then you can use text() API from QStandartItem to retrieve text back.

QString QStandardItem::text () const
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top