table header tooltip: data type name v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Tue, 09 Oct 2018 23:10:00 +0200
branchv_0
changeset 24 75f8fd148f06
parent 23 ff4a1c07a481
child 25 da2e3739b197
table header tooltip: data type name
src/RelpipeTableModel.h
--- a/src/RelpipeTableModel.h	Tue Oct 09 23:02:11 2018 +0200
+++ b/src/RelpipeTableModel.h	Tue Oct 09 23:10:00 2018 +0200
@@ -39,9 +39,10 @@
 	}
 
 	QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::ItemDataRole::DisplayRole) const {
-		if (role != Qt::ItemDataRole::DisplayRole) return QVariant();
-		else if (orientation == Qt::Orientation::Horizontal) return QString::fromStdWString(attributes[section].getAttributeName().c_str());
-		else if (orientation == Qt::Orientation::Vertical) return QString("%1").arg(section + 1);
+		if (orientation == Qt::Orientation::Horizontal && role == Qt::ItemDataRole::DisplayRole) return QString::fromStdWString(attributes[section].getAttributeName().c_str());
+		if (orientation == Qt::Orientation::Horizontal && role == Qt::ItemDataRole::ToolTipRole) return QString::fromStdWString(attributes[section].getTypeName().c_str());
+		if (orientation == Qt::Orientation::Vertical && role == Qt::ItemDataRole::DisplayRole) return QString("%1").arg(section + 1);
+		return QVariant();
 	}
 
 	QVariant data(const QModelIndex &index, int role = Qt::ItemDataRole::DisplayRole) const {