diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 07b11207a..1b97a906b 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -21,7 +21,8 @@ v1.4.0 (unreleased) Added ~~~~~ -- Support for the bundled `sip` module in PyQt 5.11. +- Support for the bundled `sip` module in PyQt 5.11 and workarounds for + PyQt 5.11 bugs. - New `--debug-flag log-requests` to log requests to the debug log for debugging. - New `--first` flag for `:hint` (bound to `gi` for inputs) which automatically diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 2e30c26c2..b06cedbfd 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -30,7 +30,7 @@ import tempfile import enum from PyQt5.QtCore import (pyqtSlot, pyqtSignal, Qt, QObject, QModelIndex, - QTimer, QAbstractListModel, QUrl) + QTimer, QAbstractListModel, QUrl, PYQT_VERSION) from qutebrowser.commands import cmdexc, cmdutils from qutebrowser.config import config @@ -878,6 +878,11 @@ class DownloadModel(QAbstractListModel): """A list model showing downloads.""" + if PYQT_VERSION == 0x050b00: + # WORKAROUND for PyQt 5.11 bug: + # https://www.riverbankcomputing.com/pipermail/pyqt/2018-June/040445.html + headerDataChanged = pyqtSignal(Qt.Orientation, int, int) + def __init__(self, qtnetwork_manager, webengine_manager=None, parent=None): super().__init__(parent) self._qtnetwork_manager = qtnetwork_manager diff --git a/qutebrowser/completion/models/completionmodel.py b/qutebrowser/completion/models/completionmodel.py index 1c77e1d31..633d425d9 100644 --- a/qutebrowser/completion/models/completionmodel.py +++ b/qutebrowser/completion/models/completionmodel.py @@ -19,7 +19,8 @@ """A model that proxies access to one or more completion categories.""" -from PyQt5.QtCore import Qt, QModelIndex, QAbstractItemModel +from PyQt5.QtCore import (Qt, QModelIndex, QAbstractItemModel, pyqtSignal, + PYQT_VERSION) from qutebrowser.utils import log, qtutils from qutebrowser.commands import cmdexc @@ -38,6 +39,11 @@ class CompletionModel(QAbstractItemModel): _categories: The sub-categories. """ + if PYQT_VERSION == 0x050b00: + # WORKAROUND for PyQt 5.11 bug: + # https://www.riverbankcomputing.com/pipermail/pyqt/2018-June/040445.html + headerDataChanged = pyqtSignal(Qt.Orientation, int, int) + def __init__(self, *, column_widths=(30, 70, 0), parent=None): super().__init__(parent) self.column_widths = column_widths diff --git a/qutebrowser/completion/models/histcategory.py b/qutebrowser/completion/models/histcategory.py index 60f801492..06fa487ed 100644 --- a/qutebrowser/completion/models/histcategory.py +++ b/qutebrowser/completion/models/histcategory.py @@ -19,6 +19,7 @@ """A completion category that queries the SQL History store.""" +from PyQt5.QtCore import pyqtSignal, Qt, PYQT_VERSION from PyQt5.QtSql import QSqlQueryModel from qutebrowser.misc import sql @@ -30,6 +31,11 @@ class HistoryCategory(QSqlQueryModel): """A completion category that queries the SQL History store.""" + if PYQT_VERSION == 0x050b00: + # WORKAROUND for PyQt 5.11 bug: + # https://www.riverbankcomputing.com/pipermail/pyqt/2018-June/040445.html + headerDataChanged = pyqtSignal(Qt.Orientation, int, int) + def __init__(self, *, delete_func=None, parent=None): """Create a new History completion category.""" super().__init__(parent=parent) diff --git a/qutebrowser/completion/models/listcategory.py b/qutebrowser/completion/models/listcategory.py index 13bc1e6b2..1d0c41e99 100644 --- a/qutebrowser/completion/models/listcategory.py +++ b/qutebrowser/completion/models/listcategory.py @@ -21,7 +21,8 @@ import re -from PyQt5.QtCore import Qt, QSortFilterProxyModel, QRegExp +from PyQt5.QtCore import (Qt, QSortFilterProxyModel, QRegExp, PYQT_VERSION, + pyqtSignal) from PyQt5.QtGui import QStandardItem, QStandardItemModel from qutebrowser.utils import qtutils @@ -31,6 +32,11 @@ class ListCategory(QSortFilterProxyModel): """Expose a list of items as a category for the CompletionModel.""" + if PYQT_VERSION == 0x050b00: + # WORKAROUND for PyQt 5.11 bug: + # https://www.riverbankcomputing.com/pipermail/pyqt/2018-June/040445.html + headerDataChanged = pyqtSignal(Qt.Orientation, int, int) + def __init__(self, name, items, sort=True, delete_func=None, parent=None): super().__init__(parent) self.name = name