ui: Fixed scrolling in code view list mode broken for Mac touchpad

This commit is contained in:
Eberhard Graether
2017-02-09 19:22:52 +01:00
parent 3b89bad424
commit b423b41836
2 changed files with 19 additions and 4 deletions
+15 -3
View File
@@ -30,8 +30,7 @@
std::vector<QtCodeArea::AnnotationColor> QtCodeArea::s_annotationColors;
MouseWheelOverScrollbarFilter::MouseWheelOverScrollbarFilter(QObject* parent)
: QObject(parent)
MouseWheelOverScrollbarFilter::MouseWheelOverScrollbarFilter()
{
}
@@ -146,7 +145,7 @@ QtCodeArea::QtCodeArea(
this->setMouseTracking(true);
// MouseWheelOverScrollbarFilter is deleted by parent.
horizontalScrollBar()->installEventFilter(new MouseWheelOverScrollbarFilter(this));
horizontalScrollBar()->installEventFilter(new MouseWheelOverScrollbarFilter());
m_scrollSpeedChangeListener.setScrollBar(horizontalScrollBar());
createActions();
@@ -586,6 +585,19 @@ void QtCodeArea::mouseMoveEvent(QMouseEvent* event)
}
}
void QtCodeArea::wheelEvent(QWheelEvent *event)
{
if ((event->angleDelta().x() != 0 && horizontalScrollBar()->minimum() != horizontalScrollBar()->maximum()) ||
(event->angleDelta().y() != 0 && verticalScrollBar()->minimum() != verticalScrollBar()->maximum()))
{
QPlainTextEdit::wheelEvent(event);
}
else
{
event->ignore();
}
}
void QtCodeArea::contextMenuEvent(QContextMenuEvent* event)
{
if (m_setIDECursorPositionAction != nullptr)