bind ctrl+0 to reset zoom
This commit is contained in:
parent
8849d47c48
commit
26f073d844
3 changed files with 10 additions and 6 deletions
|
@ -133,7 +133,7 @@ void WebBrowser::decreaseZoom() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebBrowser::resetZoom() {
|
void WebBrowser::resetZoom() {
|
||||||
m_webView->resetWebPageZoom();
|
m_webView->resetWebPageZoom(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebBrowser::clear() {
|
void WebBrowser::clear() {
|
||||||
|
|
|
@ -38,7 +38,7 @@ bool WebViewer::canDecreaseZoom() {
|
||||||
bool WebViewer::event(QEvent* event) {
|
bool WebViewer::event(QEvent* event) {
|
||||||
if (event->type() == QEvent::Type::ChildAdded) {
|
if (event->type() == QEvent::Type::ChildAdded) {
|
||||||
QChildEvent* child_ev = static_cast<QChildEvent*>(event);
|
QChildEvent* child_ev = static_cast<QChildEvent*>(event);
|
||||||
QWidget* w = qobject_cast<QWidget*>(child_ev->child());
|
QWidget* w = dynamic_cast<QWidget*>(child_ev->child());
|
||||||
|
|
||||||
if (w != nullptr) {
|
if (w != nullptr) {
|
||||||
w->installEventFilter(this);
|
w->installEventFilter(this);
|
||||||
|
@ -82,8 +82,8 @@ bool WebViewer::decreaseWebPageZoom() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebViewer::resetWebPageZoom() {
|
bool WebViewer::resetWebPageZoom(bool to_factory_default) {
|
||||||
const qreal new_factor = qApp->settings()->value(GROUP(Messages),
|
const qreal new_factor = to_factory_default ? 1.0 : qApp->settings()->value(GROUP(Messages),
|
||||||
SETTING(Messages::Zoom)).toReal();
|
SETTING(Messages::Zoom)).toReal();
|
||||||
|
|
||||||
if (new_factor != zoomFactor()) {
|
if (new_factor != zoomFactor()) {
|
||||||
|
@ -265,6 +265,10 @@ bool WebViewer::eventFilter(QObject* object, QEvent* event) {
|
||||||
decreaseWebPageZoom();
|
decreaseWebPageZoom();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (key_event->key() == Qt::Key::Key_0) {
|
||||||
|
resetWebPageZoom(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class WebViewer : public QWebEngineView {
|
||||||
public slots:
|
public slots:
|
||||||
bool increaseWebPageZoom();
|
bool increaseWebPageZoom();
|
||||||
bool decreaseWebPageZoom();
|
bool decreaseWebPageZoom();
|
||||||
bool resetWebPageZoom();
|
bool resetWebPageZoom(bool to_factory_default = false);
|
||||||
|
|
||||||
void displayMessage();
|
void displayMessage();
|
||||||
void loadMessages(const QList<Message>& messages, RootItem* root);
|
void loadMessages(const QList<Message>& messages, RootItem* root);
|
||||||
|
|
Loading…
Add table
Reference in a new issue