From 224207b8d69f14c33d6140cb21c0db4ba9dbb4cf Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sat, 21 Jan 2017 17:59:54 +0100 Subject: [PATCH] WebInspector: Remember height --- src/lib/webengine/webinspector.cpp | 16 ++++++++++++++-- src/lib/webengine/webinspector.h | 6 ++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/lib/webengine/webinspector.cpp b/src/lib/webengine/webinspector.cpp index 1740214f2..ecbd42508 100644 --- a/src/lib/webengine/webinspector.cpp +++ b/src/lib/webengine/webinspector.cpp @@ -1,6 +1,6 @@ /* ============================================================ -* QupZilla - WebKit based browser -* Copyright (C) 2010-2016 David Rosca +* QupZilla - Qt web browser +* Copyright (C) 2010-2017 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +18,7 @@ #include "webinspector.h" #include "mainapplication.h" #include "networkmanager.h" +#include "settings.h" #include #include @@ -34,6 +35,8 @@ WebInspector::WebInspector(QWidget *parent) setObjectName(QSL("web-inspector")); setMinimumHeight(80); + m_height = Settings().value(QSL("Web-Inspector/height"), 80).toInt(); + registerView(this); connect(page(), &QWebEnginePage::windowCloseRequested, this, &WebInspector::deleteLater); @@ -43,6 +46,8 @@ WebInspector::WebInspector(QWidget *parent) WebInspector::~WebInspector() { unregisterView(this); + + Settings().setValue(QSL("Web-Inspector/height"), height()); } void WebInspector::setView(QWebEngineView *view) @@ -119,6 +124,13 @@ void WebInspector::loadFinished() } } +QSize WebInspector::sizeHint() const +{ + QSize s = QWebEngineView::sizeHint(); + s.setHeight(m_height); + return s; +} + void WebInspector::keyPressEvent(QKeyEvent *event) { Q_UNUSED(event) diff --git a/src/lib/webengine/webinspector.h b/src/lib/webengine/webinspector.h index 650ef032e..943e1ddf5 100644 --- a/src/lib/webengine/webinspector.h +++ b/src/lib/webengine/webinspector.h @@ -1,6 +1,6 @@ /* ============================================================ -* QupZilla - WebKit based browser -* Copyright (C) 2010-2016 David Rosca +* QupZilla - Qt web browser +* Copyright (C) 2010-2017 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,11 +44,13 @@ private slots: void loadFinished(); private: + QSize sizeHint() const override; void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE; void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE; static QList s_views; + int m_height; bool m_inspectElement = false; QWebEngineView *m_view; };