mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-03-01 05:53:53 +08:00
cabana: horizontal scrolling with Shift+wheel (#31929)
This commit is contained in:
@@ -85,7 +85,9 @@ MessagesWidget::MessagesWidget(QWidget *parent) : menu(new QMenu(this)), QWidget
|
||||
<span style="color:gray">Byte color</span><br />
|
||||
<span style="color:gray;">■ </span> constant changing<br />
|
||||
<span style="color:blue;">■ </span> increasing<br />
|
||||
<span style="color:red;">■ </span> decreasing
|
||||
<span style="color:red;">■ </span> decreasing<br />
|
||||
<span style="color:gray">Shortcuts</span><br />
|
||||
Horizontal Scrolling: <span style="background-color:lightGray;color:gray"> shift+wheel </span>
|
||||
)"));
|
||||
}
|
||||
|
||||
@@ -391,6 +393,14 @@ void MessageView::updateBytesSectionSize() {
|
||||
header()->resizeSection(MessageListModel::Column::DATA, delegate->sizeForBytes(max_bytes).width());
|
||||
}
|
||||
|
||||
void MessageView::wheelEvent(QWheelEvent *event) {
|
||||
if (event->modifiers() == Qt::ShiftModifier) {
|
||||
QApplication::sendEvent(horizontalScrollBar(), event);
|
||||
} else {
|
||||
QTreeView::wheelEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
// MessageViewHeader
|
||||
|
||||
MessageViewHeader::MessageViewHeader(QWidget *parent) : QHeaderView(Qt::Horizontal, parent) {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <QMenu>
|
||||
#include <QToolBar>
|
||||
#include <QTreeView>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include "tools/cabana/dbc/dbcmanager.h"
|
||||
#include "tools/cabana/streams/abstractstream.h"
|
||||
@@ -65,10 +66,13 @@ class MessageView : public QTreeView {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MessageView(QWidget *parent) : QTreeView(parent) {}
|
||||
void updateBytesSectionSize();
|
||||
|
||||
protected:
|
||||
void drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
void drawBranches(QPainter *painter, const QRect &rect, const QModelIndex &index) const override {}
|
||||
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) override;
|
||||
void updateBytesSectionSize();
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
};
|
||||
|
||||
class MessageViewHeader : public QHeaderView {
|
||||
|
||||
Reference in New Issue
Block a user