1 Star 0 Fork 1.8K

miklechun/ndd

forked from 爬山虎/ndd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
hexfilegoto.cpp 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
#include "hexfilegoto.h"
HexFileGoto::HexFileGoto(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
connect(ui.lineEditDecAddr, &QLineEdit::textChanged, this, &HexFileGoto::slot_showDecInfo);
connect(ui.lineEditHexAddr, &QLineEdit::textChanged, this, &HexFileGoto::slot_showHexInfo);
}
HexFileGoto::~HexFileGoto()
{
}
//ʾΪ
void HexFileGoto::slot_showDecInfo(const QString &text)
{
bool ok;
qlonglong num = text.toLongLong(&ok, 10);
if (ok)
{
QString v = QString("Dec : %1 \nHex : 0x%2 ").arg(QString::number(num, 10)).arg(QString::number(num, 16));
ui.textBrowser->setText(v);
}
else
{
QString v = QString("Dec : error \nHex : error ");
ui.textBrowser->setText(v);
}
}
void HexFileGoto::slot_showHexInfo(const QString &text)
{
bool ok;
qlonglong num = text.toLongLong(&ok, 16);
if (ok)
{
QString v = QString("Dec : %1 \nHex : 0x%2 ").arg(QString::number(num, 10)).arg(QString::number(num, 16));
ui.textBrowser->setText(v);
}
else
{
QString v = QString("Dec : error \nHex : error ");
ui.textBrowser->setText(v);
}
}
qint64 HexFileGoto::getFileAddr()
{
bool ok;
qint64 ret = 0;
if (ui.radioButtonHex->isChecked())
{
ret = ui.lineEditHexAddr->text().toLongLong(&ok,16);
ui.lineEditDecAddr->setText(QString::number(ret));
}
else
{
ret = ui.lineEditDecAddr->text().toLongLong(&ok);
ui.lineEditHexAddr->setText(QString::number(ret,16));
}
return (ok ? ret: -1);
}
void HexFileGoto::slot_goto()
{
emit gotoClick(getFileAddr());
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/miklechun/notepad--.git
[email protected]:miklechun/notepad--.git
miklechun
notepad--
ndd
master

搜索帮助