forked from qt-creator/qt-creator
QmlDesigner: Fix text selection bug for code editor
The event is returned to the parent hierarchy when the position is not in the scrollbars area. Task-number: QDS-9726 Change-Id: Id781650e15035a26f282990d7ee387b4417bc6eb Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -41,24 +41,31 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
inline void checkToFlashScroll(QPointer<ScrollBar> scrollBar, const QPoint &pos)
|
||||
inline bool checkToFlashScroll(QPointer<ScrollBar> scrollBar, const QPoint &pos)
|
||||
{
|
||||
if (scrollBar.isNull())
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (!scrollBar->style()->styleHint(
|
||||
QStyle::SH_ScrollBar_Transient,
|
||||
nullptr, scrollBar))
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (scrollBarRect(scrollBar).contains(pos))
|
||||
if (scrollBarRect(scrollBar).contains(pos)) {
|
||||
scrollBar->flash();
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void checkToFlashScroll(const QPoint &pos)
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool checkToFlashScroll(const QPoint &pos)
|
||||
{
|
||||
checkToFlashScroll(verticalScrollBar, pos);
|
||||
checkToFlashScroll(horizontalScrollBar, pos);
|
||||
bool coversScroll = checkToFlashScroll(verticalScrollBar, pos);
|
||||
if (!coversScroll)
|
||||
coversScroll |= checkToFlashScroll(horizontalScrollBar, pos);
|
||||
|
||||
return coversScroll;
|
||||
}
|
||||
|
||||
inline void installViewPort(QObject *eventHandler) {
|
||||
@@ -126,7 +133,7 @@ bool TransientScrollAreaSupport::eventFilter(QObject *watched, QEvent *event)
|
||||
if (watched == d->viewPort){
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent) {
|
||||
d->checkToFlashScroll(mouseEvent->pos());
|
||||
if (d->checkToFlashScroll(mouseEvent->pos()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user