1 Star 0 Fork 1.8K

yupeng/ndd

forked from 爬山虎/ndd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
hexcmprangewin.cpp 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
#include "hexcmprangewin.h"
#include <QLineEdit>
#include <QMessageBox>
HexCmpRangeWin::HexCmpRangeWin(QWidget *parent)
: QDialog(parent), m_isCancel(true)
{
ui.setupUi(this);
connect(ui.leftStartPos, &QLineEdit::textChanged, this, &HexCmpRangeWin::slot_asyncStartPos);
connect(ui.leftCmpLens, &QLineEdit::textChanged, this, &HexCmpRangeWin::slot_asyncLenPos);
}
HexCmpRangeWin::~HexCmpRangeWin()
{
}
void HexCmpRangeWin::slot_ok()
{
m_isCancel = false;
close();
}
//通过左边的值同步右边。右边不同步左边,加速用户输入
void HexCmpRangeWin::slot_asyncStartPos(const QString& text)
{
ui.rightStartPos->setText(text);
}
void HexCmpRangeWin::slot_asyncLenPos(const QString& text)
{
ui.rightCmpLens->setText(text);
}
//如果取消,则不返回任何有效范围值;错误值也是
const int MAX_CMP_LENS = 1024 * 1024 * 10;
void HexCmpRangeWin::getRange(bool & isCancel, qint64 & leftStartPos, int & leftCmpLen, qint64 & rightStartPos, int & rightCmpLen)
{
isCancel = m_isCancel;
if (isCancel)
{
return;
}
bool ok = false;
bool ok1 = false;
bool ok2 = false;
bool ok3 = false;
leftStartPos = ui.leftStartPos->text().toULongLong(&ok);
leftCmpLen = ui.leftCmpLens->text().toInt(&ok1);
rightStartPos = ui.rightStartPos->text().toULongLong(&ok2);
rightCmpLen = ui.rightCmpLens->text().toInt(&ok3);
if (!ok || !ok1 || !ok2 || !ok3)
{
isCancel = true;
leftStartPos = -1;
rightStartPos = -1;
leftCmpLen = 0;
rightCmpLen = 0;
QMessageBox::warning(this, tr("Error"), tr("StartPos or cmpare lens value error."));
return;
}
if (leftCmpLen > MAX_CMP_LENS)
{
leftCmpLen = MAX_CMP_LENS;
}
if (rightCmpLen > MAX_CMP_LENS)
{
rightCmpLen = MAX_CMP_LENS;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/yujingpeng/notepad--.git
[email protected]:yujingpeng/notepad--.git
yujingpeng
notepad--
ndd
master

搜索帮助