Fixed #98 Rename in a non-function (#105)

This commit is contained in:
Properrr 2017-11-08 05:17:24 -08:00 committed by xarkes
parent 2ccef94ea5
commit f75b630f0c
2 changed files with 48 additions and 1 deletions

View File

@ -786,6 +786,33 @@ void HexdumpWidget::resizeEvent(QResizeEvent *event)
QDockWidget::resizeEvent(event); QDockWidget::resizeEvent(event);
} }
void HexdumpWidget::wheelEvent(QWheelEvent* event)
{
if( Qt::ControlModifier == event->modifiers() )
{
const QPoint numDegrees = event->angleDelta() / 8;
if(!numDegrees.isNull())
{
const QPoint numSteps = numDegrees / 15;
if( 0 != numSteps.y() )
{
if(numSteps.y() > 0)
{
zoomIn(1);
}
else if( numSteps.y() < 0 )
{
zoomOut(1);
}
}
}
event->accept();
return;
}
event->ignore();
}
void HexdumpWidget::on_copyMD5_clicked() void HexdumpWidget::on_copyMD5_clicked()
{ {
QString md5 = ui->bytesMD5->text(); QString md5 = ui->bytesMD5->text();
@ -836,3 +863,19 @@ void HexdumpWidget::showOffsets(bool show)
core->setConfig("asm.offset", 0); core->setConfig("asm.offset", 0);
} }
} }
void HexdumpWidget::zoomIn(int range)
{
hexOffsetText->zoomIn(range);
hexASCIIText->zoomIn(range);
hexHexText->zoomIn(range);
resizeHexdump();
}
void HexdumpWidget::zoomOut(int range)
{
hexOffsetText->zoomOut(range);
hexASCIIText->zoomOut(range);
hexHexText->zoomOut(range);
resizeHexdump();
}

View File

@ -55,8 +55,12 @@ public slots:
void showOffsets(bool show); void showOffsets(bool show);
void zoomIn(int range = 1);
void zoomOut(int range = 1);
protected: protected:
void resizeEvent(QResizeEvent *event) override; virtual void resizeEvent(QResizeEvent *event) override;
virtual void wheelEvent(QWheelEvent* event) override;
private: private:
std::unique_ptr<Ui::HexdumpWidget> ui; std::unique_ptr<Ui::HexdumpWidget> ui;