mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-23 22:25:55 +00:00
Custom render tooltip events in RDHeaderView
* Because Qt is awful at customising controls, the functions used to fetch the index of sections are not virtual so the internal QHeaderView version doesn't get the right sections when we have column grouping enabled.
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include <QPixmap>
|
||||
#include <QPointer>
|
||||
#include <QScrollBar>
|
||||
#include <QToolTip>
|
||||
#include <QTreeView>
|
||||
#include "Code/QRDUtils.h"
|
||||
|
||||
@@ -864,6 +865,28 @@ void RDHeaderView::paintEvent(QPaintEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
bool RDHeaderView::viewportEvent(QEvent *e)
|
||||
{
|
||||
if(e->type() == QEvent::ToolTip)
|
||||
{
|
||||
QHelpEvent *h = (QHelpEvent *)e;
|
||||
int section = logicalIndexAt(h->pos());
|
||||
if(section >= 0)
|
||||
{
|
||||
QAbstractItemModel *m = this->model();
|
||||
|
||||
QVariant tooltip = m->headerData(section, orientation(), Qt::ToolTipRole);
|
||||
if(tooltip.isValid())
|
||||
{
|
||||
QToolTip::showText(h->globalPos(), tooltip.toString(), this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QHeaderView::viewportEvent(e);
|
||||
}
|
||||
|
||||
void RDHeaderView::paintSection(QPainter *painter, const QRect &rect, int section) const
|
||||
{
|
||||
if(!m_customSizing)
|
||||
|
||||
Reference in New Issue
Block a user