Resize completion when it's shown, and only then.
Before this, we always resized the completion when the mainwindow was resized. If the statusbar is hidden during the resize (ui -> hide-statusbar is true), we got an invalid calculated QRect for the completion, causing the update to be not applied at all - so the completion showed up incorrectly. With this change, another resize is done when the completion is shown - at this point it's certain the statusbar is visible. Also we only update it while it's shown - it doesn't make sense to always adjust its size when it's hidden anyways.
This commit is contained in:
parent
81b91888f4
commit
66ec4f0599
@ -241,3 +241,8 @@ class CompletionView(QTreeView):
|
||||
"""Extend resizeEvent to adjust column size."""
|
||||
super().resizeEvent(e)
|
||||
self._resize_columns()
|
||||
|
||||
def showEvent(self, e):
|
||||
"""Adjust the completion size when it's freshly shown."""
|
||||
self.resize_completion.emit()
|
||||
super().showEvent(e)
|
||||
|
@ -266,6 +266,10 @@ class MainWindow(QWidget):
|
||||
@pyqtSlot()
|
||||
def resize_completion(self):
|
||||
"""Adjust completion according to config."""
|
||||
if not self._completion.isVisible():
|
||||
# It doesn't make sense to resize the completion as long as it's
|
||||
# not shown anyways.
|
||||
return
|
||||
# Get the configured height/percentage.
|
||||
confheight = str(config.get('completion', 'height'))
|
||||
if confheight.endswith('%'):
|
||||
|
Loading…
Reference in New Issue
Block a user