┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/zoomwidgetaction.h
diff options
context:
space:
mode:
authorGleb Kasachou <[email protected]>2025-06-27 10:47:21 +0300
committerMéven Car <[email protected]>2025-06-27 07:47:21 +0000
commit2e40aef45245bcc14bef59c4b93998d7ae2b0195 (patch)
tree1424ff387c932b93eec162b828ed2ce8de1219c6 /src/views/zoomwidgetaction.h
parent9b201b03c1ff8be03ba322d17ea246807cf1b4b9 (diff)
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.
Diffstat (limited to 'src/views/zoomwidgetaction.h')
-rw-r--r--src/views/zoomwidgetaction.h33
1 files changed, 33 insertions, 0 deletions
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 <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef ZOOM_WIDGET_ACTION_H
+#define ZOOM_WIDGET_ACTION_H
+
+#include <KToolBarPopupAction>
+
+/**
+ * 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