GUI: fixed various bugs in QHexEditPrivate
This commit is contained in:
parent
c50dd97996
commit
9b6dfae064
|
@ -74,7 +74,7 @@ void QHexEdit::setData(const QString & pattern)
|
||||||
for(int i=0; i<pattern.length(); i++)
|
for(int i=0; i<pattern.length(); i++)
|
||||||
{
|
{
|
||||||
QChar ch = pattern[i].toLower();
|
QChar ch = pattern[i].toLower();
|
||||||
if((ch >= '1' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (wildcardEnabled() && ch == '?'))
|
if((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (wildcardEnabled() && ch == '?'))
|
||||||
convert += ch;
|
convert += ch;
|
||||||
}
|
}
|
||||||
if(convert.length()%2) //odd length
|
if(convert.length()%2) //odd length
|
||||||
|
@ -140,7 +140,7 @@ QString QHexEdit::pattern(bool space)
|
||||||
if(space)
|
if(space)
|
||||||
result += " ";
|
result += " ";
|
||||||
}
|
}
|
||||||
return result.toUpper();
|
return result.toUpper().trimmed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QHexEdit::setOverwriteMode(bool overwriteMode)
|
void QHexEdit::setOverwriteMode(bool overwriteMode)
|
||||||
|
|
|
@ -19,7 +19,6 @@ QHexEditPrivate::QHexEditPrivate(QScrollArea *parent) : QWidget(parent)
|
||||||
font.setStyleHint(QFont::Monospace);
|
font.setStyleHint(QFont::Monospace);
|
||||||
this->setFont(font);
|
this->setFont(font);
|
||||||
|
|
||||||
|
|
||||||
_size = 0;
|
_size = 0;
|
||||||
_horizonalSpacing = 3;
|
_horizonalSpacing = 3;
|
||||||
resetSelection(0);
|
resetSelection(0);
|
||||||
|
@ -491,7 +490,7 @@ void QHexEditPrivate::keyPressEvent(QKeyEvent *event)
|
||||||
for(int i=0; i<pattern.length(); i++)
|
for(int i=0; i<pattern.length(); i++)
|
||||||
{
|
{
|
||||||
QChar ch = pattern[i].toLower();
|
QChar ch = pattern[i].toLower();
|
||||||
if((ch >= '1' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (_wildcardEnabled && ch == '?'))
|
if((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (_wildcardEnabled && ch == '?'))
|
||||||
convert += ch;
|
convert += ch;
|
||||||
}
|
}
|
||||||
if(convert.length()%2) //odd length
|
if(convert.length()%2) //odd length
|
||||||
|
@ -611,7 +610,8 @@ void QHexEditPrivate::keyPressEvent(QKeyEvent *event)
|
||||||
result += " ";
|
result += " ";
|
||||||
}
|
}
|
||||||
QClipboard *clipboard = QApplication::clipboard();
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
clipboard->setText(result.toUpper());
|
clipboard->setText(result.toUpper().trimmed());
|
||||||
|
QApplication::beep();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch between insert/overwrite mode
|
// Switch between insert/overwrite mode
|
||||||
|
|
Loading…
Reference in New Issue