mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 18:38:51 +00:00
Fix arrow offset when scrolling with arrows or zooming in. (#1677)
This commit is contained in:
parent
cbdc4b70e1
commit
239fde50be
@ -379,18 +379,21 @@ void DisassemblyWidget::zoomIn()
|
||||
{
|
||||
mDisasTextEdit->zoomIn();
|
||||
updateMaxLines();
|
||||
leftPanel->update();
|
||||
}
|
||||
|
||||
void DisassemblyWidget::zoomOut()
|
||||
{
|
||||
mDisasTextEdit->zoomOut();
|
||||
updateMaxLines();
|
||||
leftPanel->update();
|
||||
}
|
||||
|
||||
void DisassemblyWidget::zoomReset()
|
||||
{
|
||||
setupFonts();
|
||||
updateMaxLines();
|
||||
leftPanel->update();
|
||||
}
|
||||
|
||||
void DisassemblyWidget::highlightCurrentLine()
|
||||
@ -746,6 +749,12 @@ void DisassemblyScrollArea::resetScrollBars()
|
||||
verticalScrollBar()->blockSignals(false);
|
||||
}
|
||||
|
||||
qreal DisassemblyTextEdit::textOffset() const
|
||||
{
|
||||
return (blockBoundingGeometry(document()->begin()).topLeft() +
|
||||
contentOffset()).y();
|
||||
}
|
||||
|
||||
bool DisassemblyTextEdit::viewportEvent(QEvent *event)
|
||||
{
|
||||
switch (event->type()) {
|
||||
@ -826,7 +835,7 @@ void DisassemblyLeftPanel::paintEvent(QPaintEvent *event)
|
||||
constexpr int arrowWidth = 5;
|
||||
int rightOffset = size().rwidth();
|
||||
auto tEdit = qobject_cast<DisassemblyTextEdit*>(disas->getTextWidget());
|
||||
int topOffset = int(tEdit->document()->documentMargin() + tEdit->contentsMargins().top());
|
||||
int topOffset = int(tEdit->contentsMargins().top() + tEdit->textOffset());
|
||||
int lineHeight = disas->getFontMetrics().height();
|
||||
QColor arrowColorDown = ConfigColor("flow");
|
||||
QColor arrowColorUp = ConfigColor("cflow");
|
||||
|
@ -125,6 +125,7 @@ public:
|
||||
this->lockScroll = lock;
|
||||
}
|
||||
|
||||
qreal textOffset() const;
|
||||
protected:
|
||||
bool viewportEvent(QEvent *event) override;
|
||||
void scrollContentsBy(int dx, int dy) override;
|
||||
|
Loading…
Reference in New Issue
Block a user