mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-02-20 20:09:14 +00:00
Fix mouse wheel behavior.
This commit is contained in:
parent
95dce399b5
commit
8313b2a2fd
@ -134,8 +134,8 @@ Item{
|
||||
anchors.fill: parent
|
||||
onWheel:{
|
||||
var coord = correctDistortion(wheel.x, wheel.y);
|
||||
var lines = wheel.angleDelta.y > 0 ? -2 : 2;
|
||||
kterminal.scrollWheel(coord.width, coord.height, lines);
|
||||
var lines = wheel.angleDelta.y > 0 ? -1 : 1;
|
||||
kterminal.scrollWheelEvent(coord, lines);
|
||||
}
|
||||
//onClicked: {
|
||||
// if (mouse.button == Qt.RightButton){
|
||||
|
@ -447,28 +447,27 @@ QStringList KTerminalDisplay::availableColorSchemes()
|
||||
return ret;
|
||||
}
|
||||
|
||||
void KTerminalDisplay::scrollWheel(qreal x, qreal y, int lines){
|
||||
void KTerminalDisplay::scrollWheelEvent(QPoint position, int lines){
|
||||
if(_mouseMarks){
|
||||
int charLine;
|
||||
int charColumn;
|
||||
getCharacterPosition(QPoint(x,y) , charLine , charColumn);
|
||||
|
||||
emit mouseSignal(lines > 0 ? 5 : 4,
|
||||
charColumn + 1,
|
||||
charLine + 1,
|
||||
0);
|
||||
} else {
|
||||
if(_screenWindow->lineCount() == _screenWindow->windowLines()){
|
||||
const int keyCode = lines > 0 ? Qt::Key_Down : Qt::Key_Up;
|
||||
QKeyEvent keyEvent(QEvent::KeyPress, keyCode, Qt::NoModifier);
|
||||
|
||||
emit keyPressedSignal(&keyEvent);
|
||||
emit keyPressedSignal(&keyEvent);
|
||||
} else {
|
||||
_screenWindow->scrollBy( ScreenWindow::ScrollLines, lines );
|
||||
_screenWindow->scrollCount();
|
||||
updateImage();
|
||||
}
|
||||
} else {
|
||||
int charLine;
|
||||
int charColumn;
|
||||
getCharacterPosition(position, charLine, charColumn);
|
||||
|
||||
emit mouseSignal(lines > 0 ? 5 : 4,
|
||||
charColumn + 1,
|
||||
charLine + 1,
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,8 +312,6 @@ public slots:
|
||||
void setColorScheme(const QString &name);
|
||||
QStringList availableColorSchemes();
|
||||
|
||||
void scrollWheel(qreal x, qreal y, int lines);
|
||||
|
||||
void scrollScreenWindow(enum ScreenWindow::RelativeScrollMode mode, int amount);
|
||||
|
||||
void setUsesMouse(bool usesMouse);
|
||||
@ -481,6 +479,7 @@ protected:
|
||||
Q_INVOKABLE void mouseReleaseEvent(QPoint position, int but, int mod);
|
||||
Q_INVOKABLE void mouseDoubleClickEvent(QPoint position, int but, int mod);
|
||||
Q_INVOKABLE void mouseMoveEvent(QPoint position, int but, int buts, int mod);
|
||||
Q_INVOKABLE void scrollWheelEvent(QPoint position, int lines);
|
||||
//void mouseReleaseEvent( QMouseEvent* );
|
||||
//void mouseMoveEvent( QMouseEvent* );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user