feat(ui_builders_shared): implement class ScrollbarWheelOnlyScrollArea
This commit is contained in:
parent
ca05b2e10d
commit
736a1626aa
1 changed files with 18 additions and 0 deletions
|
|
@ -71,3 +71,21 @@ def icon_from_svg_data_url(data_url, size=24, color_hex=None, palette=None):
|
||||||
renderer.render(painter)
|
renderer.render(painter)
|
||||||
painter.end()
|
painter.end()
|
||||||
return QIcon(pixmap)
|
return QIcon(pixmap)
|
||||||
|
|
||||||
|
|
||||||
|
# ScrollbarWheelOnlyScrollArea: class definition for ScanSlicer behavior.
|
||||||
|
class ScrollbarWheelOnlyScrollArea(QScrollArea):
|
||||||
|
# wheelEvent: function definition for ScanSlicer behavior.
|
||||||
|
def wheelEvent(self, event):
|
||||||
|
scrollbar = self.verticalScrollBar()
|
||||||
|
if scrollbar is None or not scrollbar.isVisible():
|
||||||
|
event.ignore()
|
||||||
|
return
|
||||||
|
|
||||||
|
global_pos = event.globalPosition().toPoint()
|
||||||
|
scrollbar_rect = QRect(scrollbar.mapToGlobal(QPoint(0, 0)), scrollbar.size())
|
||||||
|
if not scrollbar_rect.contains(global_pos):
|
||||||
|
event.ignore()
|
||||||
|
return
|
||||||
|
|
||||||
|
super().wheelEvent(event)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue