Skip to content

Commit

Permalink
preferences: Tweak item layout
Browse files Browse the repository at this point in the history
The code for building the preferences window layout from the
available settings items was always trying to add `extraWidget`
to the item's `layout_hbox`, but since `extraWidget` is only
set on `param["type"] == "browse"` items, most of the time
`extraWidget` is undefined. This was causing a flurry of (harmless)
log messages whenever the prefs window was opened:
```
QLayout: Cannot add a null widget to QHBoxLayout/
QLayout: Cannot add a null widget to QHBoxLayout/
QLayout: Cannot add a null widget to QHBoxLayout/
QLayout: Cannot add a null widget to QHBoxLayout/
QLayout: Cannot add a null widget to QHBoxLayout/
QLayout: Cannot add a null widget to QHBoxLayout/
QLayout: Cannot add a null widget to QHBoxLayout/
QLayout: Cannot add a null widget to QHBoxLayout/
```

This change wraps an `if(extraWidget):` around the code adding
it to the layout, so it will only be attempted when it exists.
  • Loading branch information
ferdnyc committed Nov 25, 2018
1 parent 2d2be08 commit c816716
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/windows/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ def __init__(self):
layout_hbox = QHBoxLayout()
layout_hbox.addWidget(label)
layout_hbox.addWidget(widget)
layout_hbox.addWidget(extraWidget)

if (extraWidget):
layout_hbox.addWidget(extraWidget)

# Add widget to layout
tabWidget.layout().addLayout(layout_hbox)
Expand Down

0 comments on commit c816716

Please sign in to comment.