void Monitor::mark()
{
colorFormat.setForeground(Qt::red);
cursor.setPosition(j);
cursor.mergeCharFormat(colorFormat);
}
void Monitor
::quickSearch(const char *x,
int m,
const char *y,
int n,
QTextEdit *textEdit
) { this->textEdit = textEdit;
j = 0;
int k = 0;
while (j <= n - m) {
if (memcmp(x, y + j, m) == 0)
{
//mark();
QTimer::singleShot(2000,
this,
SLOT(mark
()));
}
j += qsBc[y[j + m]];
}
}
void Monitor::mark()
{
QTextCursor cursor(textEdit->document());
colorFormat.setForeground(Qt::red);
cursor.setPosition(j);
if (cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, 3))
cursor.mergeCharFormat(colorFormat);
}
void Monitor::quickSearch(const char *x, int m, const char *y, int n, QTextEdit *textEdit) {
this->textEdit = textEdit;
j = 0;
int k = 0;
while (j <= n - m) {
if (memcmp(x, y + j, m) == 0)
{
//mark();
QTimer::singleShot(2000, this, SLOT(mark()));
}
j += qsBc[y[j + m]];
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks