Don't use QMainWindow

This commit is contained in:
Florian Bruhin 2014-02-12 20:51:50 +01:00
parent f893b11f1b
commit d343ea26af
3 changed files with 9 additions and 13 deletions

View File

@ -66,7 +66,7 @@ class TabbedBrowser(TabWidget):
keypress = pyqtSignal('QKeyEvent') keypress = pyqtSignal('QKeyEvent')
_url_stack = [] # Stack of URLs of closed tabs _url_stack = [] # Stack of URLs of closed tabs
def __init__(self, parent): def __init__(self, parent=None):
super().__init__(parent) super().__init__(parent)
self.currentChanged.connect(lambda idx: self.currentChanged.connect(lambda idx:
self.widget(idx).signal_cache.replay()) self.widget(idx).signal_cache.replay())
@ -440,7 +440,7 @@ class BrowserTab(QWebView):
# dict of tab specific signals, and the values we last got from them. # dict of tab specific signals, and the values we last got from them.
signal_cache = None signal_cache = None
def __init__(self, parent): def __init__(self, parent=None):
super().__init__(parent) super().__init__(parent)
self.signal_cache = SignalCache(uncached=['linkHovered']) self.signal_cache = SignalCache(uncached=['linkHovered'])
self.loadProgress.connect(self.set_progress) self.loadProgress.connect(self.set_progress)

View File

@ -17,14 +17,14 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
from PyQt5.QtWidgets import QMainWindow, QVBoxLayout, QWidget from PyQt5.QtWidgets import QVBoxLayout, QWidget
from qutebrowser.widgets.statusbar import StatusBar from qutebrowser.widgets.statusbar import StatusBar
from qutebrowser.widgets.browser import TabbedBrowser from qutebrowser.widgets.browser import TabbedBrowser
from qutebrowser.widgets.completion import CompletionView from qutebrowser.widgets.completion import CompletionView
class MainWindow(QMainWindow): class MainWindow(QWidget):
"""The main window of QuteBrowser. """The main window of QuteBrowser.
@ -33,7 +33,6 @@ class MainWindow(QMainWindow):
""" """
cwidget = None
vbox = None vbox = None
tabs = None tabs = None
status = None status = None
@ -45,19 +44,16 @@ class MainWindow(QMainWindow):
# FIXME maybe store window position/size on exit # FIXME maybe store window position/size on exit
self.resize(800, 600) self.resize(800, 600)
self.cwidget = QWidget(self) self.vbox = QVBoxLayout(self)
self.setCentralWidget(self.cwidget)
self.vbox = QVBoxLayout(self.cwidget)
self.vbox.setContentsMargins(0, 0, 0, 0) self.vbox.setContentsMargins(0, 0, 0, 0)
self.vbox.setSpacing(0) self.vbox.setSpacing(0)
self.tabs = TabbedBrowser(self) self.tabs = TabbedBrowser()
self.vbox.addWidget(self.tabs) self.vbox.addWidget(self.tabs)
self.completion = CompletionView(self) self.completion = CompletionView(self)
self.status = StatusBar(self) self.status = StatusBar()
self.vbox.addWidget(self.status) self.vbox.addWidget(self.status)
self.status.resized.connect(self.completion.resize_to_bar) self.status.resized.connect(self.completion.resize_to_bar)

View File

@ -59,8 +59,8 @@ class StatusBar(QWidget):
""" """
# TODO: the statusbar should be a bit smaller # TODO: the statusbar should be a bit smaller
def __init__(self, mainwindow): def __init__(self, parent=None):
super().__init__(mainwindow) super().__init__(parent)
self.setObjectName(self.__class__.__name__) self.setObjectName(self.__class__.__name__)
self.setStyleSheet(config.get_stylesheet(self._stylesheet)) self.setStyleSheet(config.get_stylesheet(self._stylesheet))