mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-08 16:50:44 +00:00
Add shortcuts for functionality in event browser
This commit is contained in:
@@ -126,6 +126,12 @@ void RDTreeWidget::focusOutEvent(QFocusEvent *event)
|
||||
QTreeWidget::focusOutEvent(event);
|
||||
}
|
||||
|
||||
void RDTreeWidget::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
emit(keyPress(e));
|
||||
QTreeWidget::keyPressEvent(e);
|
||||
}
|
||||
|
||||
void RDTreeWidget::clearHovers(QTreeWidgetItem *root, QTreeWidgetItem *exception)
|
||||
{
|
||||
for(int i = 0; i < root->childCount(); i++)
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
signals:
|
||||
void mouseMove(QMouseEvent *e);
|
||||
void leave(QEvent *e);
|
||||
void keyPress(QKeyEvent *e);
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -56,6 +57,7 @@ private:
|
||||
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
void focusOutEvent(QFocusEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
void clearHovers(QTreeWidgetItem *root, QTreeWidgetItem *exception);
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include "EventBrowser.h"
|
||||
#include <QKeyEvent>
|
||||
#include <QShortcut>
|
||||
#include <QTimer>
|
||||
#include "3rdparty/flowlayout/FlowLayout.h"
|
||||
#include "Code/CaptureContext.h"
|
||||
@@ -76,6 +78,7 @@ EventBrowser::EventBrowser(CaptureContext &ctx, QWidget *parent)
|
||||
QObject::connect(ui->closeJump, &QToolButton::clicked, this, &EventBrowser::on_HideFindJump);
|
||||
QObject::connect(ui->jumpToEID, &RDLineEdit::leave, this, &EventBrowser::on_HideFindJump);
|
||||
QObject::connect(ui->findEvent, &RDLineEdit::leave, this, &EventBrowser::on_HideFindJump);
|
||||
QObject::connect(ui->events, &RDTreeWidget::keyPress, this, &EventBrowser::events_keyPress);
|
||||
ui->jumpStrip->hide();
|
||||
ui->findStrip->hide();
|
||||
ui->bookmarkStrip->hide();
|
||||
@@ -90,6 +93,42 @@ EventBrowser::EventBrowser(CaptureContext &ctx, QWidget *parent)
|
||||
m_CurrentIcon.addFile(QStringLiteral(":/flag_green.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
m_FindIcon.addFile(QStringLiteral(":/find.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
m_BookmarkIcon.addFile(QStringLiteral(":/asterisk_orange.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
|
||||
Qt::Key keys[] = {
|
||||
Qt::Key_1, Qt::Key_2, Qt::Key_3, Qt::Key_4, Qt::Key_5,
|
||||
Qt::Key_6, Qt::Key_7, Qt::Key_8, Qt::Key_9, Qt::Key_0,
|
||||
};
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
QShortcut *sc = new QShortcut(QKeySequence(keys[i] | Qt::ControlModifier), this);
|
||||
QObject::connect(sc, &QShortcut::activated, [this, i]() { jumpToBookmark(i); });
|
||||
}
|
||||
|
||||
{
|
||||
QShortcut *sc = new QShortcut(QKeySequence(Qt::Key_Left | Qt::ControlModifier), this);
|
||||
QObject::connect(sc, &QShortcut::activated, [this]() {
|
||||
if(!m_Ctx.LogLoaded())
|
||||
return;
|
||||
|
||||
const FetchDrawcall *draw = m_Ctx.CurDrawcall();
|
||||
|
||||
if(draw && draw->previous >= 0)
|
||||
SelectEvent(draw->previous);
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
QShortcut *sc = new QShortcut(QKeySequence(Qt::Key_Right | Qt::ControlModifier), this);
|
||||
QObject::connect(sc, &QShortcut::activated, [this]() {
|
||||
if(!m_Ctx.LogLoaded())
|
||||
return;
|
||||
|
||||
const FetchDrawcall *draw = m_Ctx.CurDrawcall();
|
||||
|
||||
if(draw && draw->next >= 0)
|
||||
SelectEvent(draw->next);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
EventBrowser::~EventBrowser()
|
||||
@@ -342,6 +381,43 @@ void EventBrowser::on_findPrev_clicked()
|
||||
Find(false);
|
||||
}
|
||||
|
||||
void EventBrowser::events_keyPress(QKeyEvent *event)
|
||||
{
|
||||
if(!m_Ctx.LogLoaded())
|
||||
return;
|
||||
|
||||
if(event->key() == Qt::Key_F3)
|
||||
{
|
||||
if(event->modifiers() == Qt::ShiftModifier)
|
||||
Find(false);
|
||||
else
|
||||
Find(true);
|
||||
}
|
||||
|
||||
if(event->modifiers() == Qt::ControlModifier)
|
||||
{
|
||||
if(event->key() == Qt::Key_F)
|
||||
{
|
||||
on_find_clicked();
|
||||
event->accept();
|
||||
}
|
||||
else if(event->key() == Qt::Key_G)
|
||||
{
|
||||
on_gotoEID_clicked();
|
||||
event->accept();
|
||||
}
|
||||
else if(event->key() == Qt::Key_B)
|
||||
{
|
||||
on_bookmark_clicked();
|
||||
event->accept();
|
||||
}
|
||||
else if(event->key() == Qt::Key_T)
|
||||
{
|
||||
on_timeDraws_clicked();
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EventBrowser::clearBookmarks()
|
||||
{
|
||||
|
||||
@@ -70,6 +70,7 @@ private slots:
|
||||
|
||||
// manual slots
|
||||
void findHighlight_timeout();
|
||||
void events_keyPress(QKeyEvent *event);
|
||||
|
||||
public slots:
|
||||
void clearBookmarks();
|
||||
|
||||
@@ -477,7 +477,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="events">
|
||||
<widget class="RDTreeWidget" name="events">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
@@ -551,6 +551,11 @@
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Widgets/Extended/RDLineEdit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>RDTreeWidget</class>
|
||||
<extends>QTreeWidget</extends>
|
||||
<header>Widgets/Extended/RDTreeWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../Resources/resources.qrc"/>
|
||||
|
||||
Reference in New Issue
Block a user