mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
Fix display of ResourceId text in log viewer
This commit is contained in:
@@ -87,6 +87,7 @@ public:
|
||||
int verticalItemMargin() { return m_VertMargin; }
|
||||
void setIgnoreIconSize(bool ignore) { m_IgnoreIconSize = ignore; }
|
||||
bool ignoreIconSize() { return m_IgnoreIconSize; }
|
||||
QModelIndex currentHoverIndex() const { return m_currentHoverIndex; }
|
||||
void setItemDelegate(QAbstractItemDelegate *delegate);
|
||||
QAbstractItemDelegate *itemDelegate() const;
|
||||
|
||||
|
||||
@@ -219,6 +219,12 @@ public:
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
void itemChanged(const QModelIndex &idx, const QVector<int> &roles)
|
||||
{
|
||||
QModelIndex topLeft = index(idx.row(), 0);
|
||||
QModelIndex bottomRight = index(idx.row(), columnCount() - 1);
|
||||
emit dataChanged(topLeft, bottomRight, roles);
|
||||
}
|
||||
|
||||
protected:
|
||||
QVector<int> m_VisibleRows;
|
||||
@@ -268,6 +274,13 @@ LogView::LogView(ICaptureContext &ctx, QWidget *parent)
|
||||
m_FilterModel->setSourceModel(m_ItemModel);
|
||||
ui->messages->setModel(m_FilterModel);
|
||||
|
||||
ui->messages->viewport()->installEventFilter(this);
|
||||
|
||||
m_delegate = new RichTextViewDelegate(ui->messages);
|
||||
ui->messages->setItemDelegate(m_delegate);
|
||||
|
||||
ui->messages->setMouseTracking(true);
|
||||
|
||||
ui->messages->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||
|
||||
m_TypeModel = new QStandardItemModel(0, 1, this);
|
||||
@@ -433,6 +446,28 @@ void LogView::typeFilter_changed(QStandardItem *item)
|
||||
ui->typeFilter->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
bool LogView::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if(watched == ui->messages->viewport() && event->type() == QEvent::MouseMove)
|
||||
{
|
||||
bool ret = QObject::eventFilter(watched, event);
|
||||
|
||||
if(m_delegate->linkHover((QMouseEvent *)event, font(), ui->messages->currentHoverIndex()))
|
||||
{
|
||||
m_FilterModel->itemChanged(ui->messages->currentHoverIndex(), {Qt::DecorationRole});
|
||||
ui->messages->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->messages->unsetCursor();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void LogView::pidFilter_changed(QStandardItem *item)
|
||||
{
|
||||
uint32_t PID = item->text().toUInt();
|
||||
|
||||
@@ -39,6 +39,7 @@ class QAction;
|
||||
class QMenu;
|
||||
class LogItemModel;
|
||||
class LogFilterModel;
|
||||
class RichTextViewDelegate;
|
||||
|
||||
struct LogMessage
|
||||
{
|
||||
@@ -75,6 +76,8 @@ private slots:
|
||||
void typeFilter_changed(QStandardItem *item);
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
Ui::LogView *ui;
|
||||
ICaptureContext &m_Ctx;
|
||||
|
||||
@@ -84,6 +87,8 @@ private:
|
||||
|
||||
QList<uint32_t> m_PIDs;
|
||||
|
||||
RichTextViewDelegate *m_delegate = NULL;
|
||||
|
||||
LogItemModel *m_ItemModel = NULL;
|
||||
LogFilterModel *m_FilterModel = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user