[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:
parent
1dd8856a29
commit
372b276157
2 changed files with 14 additions and 0 deletions
|
@ -69,6 +69,13 @@ class IconWidget(object):
|
||||||
self.install_btn.setIconSize(QSize(20, 20))
|
self.install_btn.setIconSize(QSize(20, 20))
|
||||||
self.install_btn.setFixedSize(QSize(widget.width() // 4, widget.width() // 4))
|
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
|
# Create layouts
|
||||||
# layout on top of the image, holds the status label, a spacer item and the mini widget
|
# layout on top of the image, holds the status label, a spacer item and the mini widget
|
||||||
image_layout = QVBoxLayout()
|
image_layout = QVBoxLayout()
|
||||||
|
|
|
@ -50,6 +50,13 @@ class ListWidget(object):
|
||||||
self.launch_btn.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
self.launch_btn.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||||
self.launch_btn.setFixedWidth(120)
|
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 = ElideLabel(parent=widget)
|
||||||
self.developer_label.setObjectName(f"{type(self).__name__}DeveloperLabel")
|
self.developer_label.setObjectName(f"{type(self).__name__}DeveloperLabel")
|
||||||
self.developer_label.setFixedWidth(120)
|
self.developer_label.setFixedWidth(120)
|
||||||
|
|
Loading…
Reference in a new issue