[Differential] [Commented On] D3040: Allow scaling documentation view (BUG 285162)

Igor Kushnir noreply at phabricator.kde.org
Wed Feb 22 07:56:54 UTC 2017


igorkushnir added a comment.


  In https://phabricator.kde.org/D3040#88407, @rjvbb wrote:
  
  > 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.
  
  
  A possible implementation of this global action:
  
  1. Add a Reset Zoom action to `actionCollection()` in `KDevelop::MainWindowPrivate::setupActions()`. Assign a default shortcut Ctrl+0 to this new action.
  2. Optionally add this action to the KDevelop View menu.
  3. Register <https://doc.qt.io/qt-5/qevent.html#registerEventType> a custom event type `resetZoomEvent` and make its type code available to all KDevelop code globally.
  4. Send `QEvent{resetZoomEvent}` to QApplication::focusWidget() <https://doc.qt.io/qt-5/qapplication.html#focusWidget> in a new slot connected to the Reset Zoom action.
  5. Override QObject::customEvent <https://doc.qt.io/qt-5/qapplication.html#focusWidget> in `StandardDocumentationView`, propagate the event to `ZoomController` and accept it if its type matches the global `resetZoomEvent` type.
  6. It will be possible to add Reset Zoom support to other widgets simply by handling `resetZoomEvent`.
  
  Issues:
  
  1. I'm not sure how best to make the custom event type globally accessible. Maybe a const member function can be added to `KDevelop::MainWindow` and accessed through `ICore::self()->uiController()->activeMainWindow()` (if it is not nullptr).
  2. 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.
  3. I doubt that this complex global action implementation fits well into this review request. This probably warrants a separate review.

REPOSITORY
  R33 KDevPlatform

REVISION DETAIL
  https://phabricator.kde.org/D3040

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: igorkushnir, mwolff, #kdevelop
Cc: rjvbb, mwolff, apol, kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170222/4e67eb0a/attachment-0001.html>


More information about the KDevelop-devel mailing list