<table><tr><td style="">igorkushnir added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D3040" rel="noreferrer">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8;
color: #6B748C;
font-style: italic;
margin: 4px 0 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;">
<div style="font-style: normal;
padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D3040#88407" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;" rel="noreferrer">D3040#88407</a>, <a href="https://phabricator.kde.org/p/rjvbb/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;" rel="noreferrer">@rjvbb</a> wrote:</div>
<div style="margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);"><p>I guess that depends on the exact way you implement it, but I would assume that it should be possible to do it in such a way that the action applies only to the focussed widget. After all, the "Close" action doesn't close all widgets either, just the one that has focus.</p></div>
</blockquote>
<p>A possible implementation of this global action:</p>
<ol class="remarkup-list">
<li class="remarkup-list-item">Add a Reset Zoom action to <tt style="background: #ebebeb; font-size: 13px;">actionCollection()</tt> in <tt style="background: #ebebeb; font-size: 13px;">KDevelop::MainWindowPrivate::setupActions()</tt>. Assign a default shortcut Ctrl+0 to this new action.</li>
<li class="remarkup-list-item">Optionally add this action to the KDevelop View menu.</li>
<li class="remarkup-list-item"><a href="https://doc.qt.io/qt-5/qevent.html#registerEventType" class="remarkup-link" target="_blank" rel="noreferrer">Register</a> a custom event type <tt style="background: #ebebeb; font-size: 13px;">resetZoomEvent</tt> and make its type code available to all KDevelop code globally.</li>
<li class="remarkup-list-item">Send <tt style="background: #ebebeb; font-size: 13px;">QEvent{resetZoomEvent}</tt> to <a href="https://doc.qt.io/qt-5/qapplication.html#focusWidget" class="remarkup-link" target="_blank" rel="noreferrer">QApplication::focusWidget()</a> in a new slot connected to the Reset Zoom action.</li>
<li class="remarkup-list-item">Override <a href="https://doc.qt.io/qt-5/qapplication.html#focusWidget" class="remarkup-link" target="_blank" rel="noreferrer">QObject::customEvent</a> in <tt style="background: #ebebeb; font-size: 13px;">StandardDocumentationView</tt>, propagate the event to <tt style="background: #ebebeb; font-size: 13px;">ZoomController</tt> and accept it if its type matches the global <tt style="background: #ebebeb; font-size: 13px;">resetZoomEvent</tt> type.</li>
<li class="remarkup-list-item">It will be possible to add Reset Zoom support to other widgets simply by handling <tt style="background: #ebebeb; font-size: 13px;">resetZoomEvent</tt>.</li>
</ol>
<p>Issues:</p>
<ol class="remarkup-list">
<li class="remarkup-list-item">I'm not sure how best to make the custom event type globally accessible. Maybe a const member function can be added to <tt style="background: #ebebeb; font-size: 13px;">KDevelop::MainWindow</tt> and accessed through <tt style="background: #ebebeb; font-size: 13px;">ICore::self()->uiController()->activeMainWindow()</tt> (if it is not nullptr).</li>
<li class="remarkup-list-item">I know little about KDevelop code and I'm not very experienced in Qt UI development, so this is most likely a suboptimal implementation plan.</li>
<li class="remarkup-list-item">I doubt that this complex global action implementation fits well into this review request. This probably warrants a separate review.</li>
</ol></div></div><br /><div><strong>REPOSITORY</strong><div><div>R33 KDevPlatform</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D3040" rel="noreferrer">https://phabricator.kde.org/D3040</a></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>igorkushnir, mwolff, KDevelop<br /><strong>Cc: </strong>rjvbb, mwolff, apol, kdevelop-devel<br /></div>