1
0
Fork 0

GUI: fixed various bugs in QHexEditPrivate

This commit is contained in:
Mr. eXoDia 2014-07-05 14:53:57 +02:00
parent c50dd97996
commit 9b6dfae064
2 changed files with 5 additions and 5 deletions

View File

@ -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)

View File

@ -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