From 2e40aef45245bcc14bef59c4b93998d7ae2b0195 Mon Sep 17 00:00:00 2001 From: Gleb Kasachou Date: Fri, 27 Jun 2025 10:47:21 +0300 Subject: Combine the zoom menu entries into one Line Replaced a KActionMenu that contained separate Zoom In, Zoom Out and Reset Zoom actions with a single QWidgetAction that provides the same functionality using three buttons arranged in a single line. Keyboard shortcuts for the three actions are preserved, and the actions still appear separately in the View submenu in the menubar. --- src/views/zoomwidgetaction.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/views/zoomwidgetaction.h (limited to 'src/views/zoomwidgetaction.h') diff --git a/src/views/zoomwidgetaction.h b/src/views/zoomwidgetaction.h new file mode 100644 index 000000000..b55f5e25c --- /dev/null +++ b/src/views/zoomwidgetaction.h @@ -0,0 +1,33 @@ +/* + * SPDX-FileCopyrightText: 2025 Gleb Kasachou + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef ZOOM_WIDGET_ACTION_H +#define ZOOM_WIDGET_ACTION_H + +#include + +/** + * This WidgetAction combines the three zoom actions into one line. + * + * This requires less space, logically groups these actions, and keeps the menu open when the user uses the buttons. + */ + +class ZoomWidgetAction : public KToolBarPopupAction +{ +public: + ZoomWidgetAction(QAction *zoomInAction, QAction *zoomResetAction, QAction *zoomOutAction, QObject *parent); + +protected: + QWidget *createWidget(QWidget *parent) override; + bool eventFilter(QObject *object, QEvent *event) override; + +private: + QAction *m_zoomInAction; + QAction *m_zoomResetAction; + QAction *m_zoomOutAction; +}; + +#endif -- cgit v1.3