¿Es posible obtener Qpoint de QModelIndex?
Frecuentes
Visto 1,240 veces
2 Respuestas
6
Puede utilizar el QAbstractItemView::visualRect(const QModelIndex &index)
that will return the rectangle on the viewport occupied by the item at index.
For example:
QRect rect = tableView->visualRect(index); // index is a QModelIndex
QPoint pos = tableView->mapToGlobal(rect.center());
QToolTip::showText(pos, "This is my tool tip", tableView, rect);
respondido 27 nov., 13:07
2
You should implement your model so that it returns tooltip contents when Qt::ToolTipRole
role is requested. This is a proper model-view way to add tooltips to views.
respondido 27 nov., 13:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas c++ qt or haz tu propia pregunta.