1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

WebInspector: Remember height

This commit is contained in:
David Rosca 2017-01-21 17:59:54 +01:00
parent a049f44757
commit 224207b8d6
2 changed files with 18 additions and 4 deletions

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
* QupZilla - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
*
* 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 <QJsonArray>
#include <QJsonObject>
@ -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)

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
* QupZilla - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
*
* 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<QWebEngineView*> s_views;
int m_height;
bool m_inspectElement = false;
QWebEngineView *m_view;
};