1
0
Fork 0
mirror of synced 2024-06-27 02:30:31 +12:00

[Icon/List]Widget: Disable focus on buttons

When the button gets clicked on, it receives keyboard focus. Disabling the button
afterwards leads to `focusNextChild` getting called. This makes the scrollarea
trying to ensure that `nextChild` is visible, essentially scrolling to a random widget
This commit is contained in:
loathingKernel 2023-03-02 19:57:31 +02:00
parent 1dd8856a29
commit 372b276157
2 changed files with 14 additions and 0 deletions

View file

@ -69,6 +69,13 @@ class IconWidget(object):
self.install_btn.setIconSize(QSize(20, 20))
self.install_btn.setFixedSize(QSize(widget.width() // 4, widget.width() // 4))
# lk: do not focus on button
# When the button gets clicked on, it receives keyboard focus. Disabling the button
# afterwards leads to `focusNextChild` getting called. This makes the scrollarea
# trying to ensure that `nextChild` is visible, essentially scrolling to a random widget
self.launch_btn.setFocusPolicy(Qt.NoFocus)
self.install_btn.setFocusPolicy(Qt.NoFocus)
# Create layouts
# layout on top of the image, holds the status label, a spacer item and the mini widget
image_layout = QVBoxLayout()

View file

@ -50,6 +50,13 @@ class ListWidget(object):
self.launch_btn.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.launch_btn.setFixedWidth(120)
# lk: do not focus on button
# When the button gets clicked on, it receives keyboard focus. Disabling the button
# afterwards leads to `focusNextChild` getting called. This makes the scrollarea
# trying to ensure that `nextChild` is visible, essentially scrolling to a random widget
self.launch_btn.setFocusPolicy(Qt.NoFocus)
self.install_btn.setFocusPolicy(Qt.NoFocus)
self.developer_label = ElideLabel(parent=widget)
self.developer_label.setObjectName(f"{type(self).__name__}DeveloperLabel")
self.developer_label.setFixedWidth(120)