mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Don't enable drag of macro segment when interacting with scrollbars
This commit is contained in:
parent
f0df9ead3c
commit
98f3f51ba9
|
|
@ -44,8 +44,28 @@ MacroSegmentList::~MacroSegmentList()
|
|||
}
|
||||
}
|
||||
|
||||
static bool posIsInScrollbar(const QScrollBar *scrollbar, const QPoint &pos)
|
||||
{
|
||||
if (!scrollbar) {
|
||||
return false;
|
||||
}
|
||||
if (!scrollbar->isVisible()) {
|
||||
return false;
|
||||
}
|
||||
const auto geo = scrollbar->geometry();
|
||||
const auto globalGeo = QRect(scrollbar->mapToGlobal(geo.topLeft()),
|
||||
scrollbar->mapToGlobal(geo.bottomRight()));
|
||||
return globalGeo.contains(pos);
|
||||
}
|
||||
|
||||
int MacroSegmentList::GetDragIndex(const QPoint &pos)
|
||||
{
|
||||
// Don't drag widget when interacting with the scrollbars
|
||||
if (posIsInScrollbar(horizontalScrollBar(), mapTo(this, pos)) ||
|
||||
posIsInScrollbar(verticalScrollBar(), mapTo(this, pos))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int idx = 0; idx < _contentLayout->count(); ++idx) {
|
||||
auto item = _contentLayout->itemAt(idx);
|
||||
if (!item) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user