Because it's quite old project I don't have any choice and have to use Qt 3.3.3/Embedded. I have to display a file. As the display fills up, a vertical scrollbar is displayed. Problem is control that scrollbar now it dosen't work as I want. I press keyUp or keyDown, scrollbar goes up, reaches top and then with every next press scrollbar decreases.
Part of constructor:
textEdit->setGeometry(1,2, 639,425);
textEdit->setPaper(Qt::black);
textEdit->setColor(Qt::white);
textEdit = new QTextEdit(this);
textEdit->setGeometry(1,2, 639,425);
textEdit->setPaper(Qt::black);
textEdit->setColor(Qt::white);
To copy to clipboard, switch view to plain text mode
Part of readFile function:
char buff[255];
fp.open(IO_ReadOnly);
textEdit->setCurrentFont(font);
while (!fp.atEnd() ) {
fp.readLine(buff, sizeof(buff));
textEdit->append(buff);
}
fp.close();
QFile fp("errors.txt");
char buff[255];
fp.open(IO_ReadOnly);
textEdit->setCurrentFont(font);
while (!fp.atEnd() ) {
fp.readLine(buff, sizeof(buff));
textEdit->append(buff);
}
fp.close();
To copy to clipboard, switch view to plain text mode
Part of handling device's keyboard:
bool keyHandled = false;
switch (event->key()) {
case Key_Up:
keyHandled = true;
update();
break;
case Key_Down:
keyHandled = true;
textEdit
->moveCursor
(QTextEdit::MoveDown,
0);
update();
break;
default:
keyHandled = false;
break;
}
return keyHandled;
bool keyHandled = false;
switch (event->key()) {
case Key_Up:
keyHandled = true;
textEdit->moveCursor(QTextEdit::MoveUp, 0);
update();
break;
case Key_Down:
keyHandled = true;
textEdit->moveCursor(QTextEdit::MoveDown, 0);
update();
break;
default:
keyHandled = false;
break;
}
return keyHandled;
To copy to clipboard, switch view to plain text mode
Bookmarks