0001-Add-hasMenuIndicator-and-setMenuIndicator-to-KToolBa.patch

File Metadata

Author
hallas
Created
Apr 14 2019, 5:48 PM

0001-Add-hasMenuIndicator-and-setMenuIndicator-to-KToolBa.patch

From 5bbcc2fdcb356e4d249af9fb05d8506b52705ed1 Mon Sep 17 00:00:00 2001
From: David Hallas <david@davidhallas.dk>
Date: Sun, 14 Apr 2019 19:44:03 +0200
Subject: [PATCH] Add hasMenuIndicator and setMenuIndicator to
KToolBarPopupAction
Summary:
Add hasMenuIndicator and setMenuIndicator to KToolBarPopupAction, to
control setting of a Breeze style property to disable rendering of the
menu arrow indicator. This is useful for navigation style buttons.
Test Plan:
Reviewers:
---
src/ktoolbarpopupaction.cpp | 15 ++++++++++++++-
src/ktoolbarpopupaction.h | 18 ++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/src/ktoolbarpopupaction.cpp b/src/ktoolbarpopupaction.cpp
index 9bf95d1..e259b97 100644
--- a/src/ktoolbarpopupaction.cpp
+++ b/src/ktoolbarpopupaction.cpp
@@ -35,12 +35,13 @@ class Q_DECL_HIDDEN KToolBarPopupAction::Private
{
public:
Private()
- : delayed(true), stickyMenu(true)
+ : delayed(true), stickyMenu(true), menuIndicator(true)
{
}
bool delayed: 1;
bool stickyMenu: 1;
+ bool menuIndicator: 1;
};
KToolBarPopupAction::KToolBarPopupAction(const QIcon &icon, const QString &text, QObject *parent)
@@ -94,6 +95,9 @@ QWidget *KToolBarPopupAction::createWidget(QWidget *_parent)
else {
button->setPopupMode(QToolButton::InstantPopup);
}
+ if (!d->menuIndicator) {
+ button->setProperty("_kde_toolButton_noMenuArrow", true);
+ }
return button;
}
@@ -118,3 +122,12 @@ void KToolBarPopupAction::setStickyMenu(bool sticky)
d->stickyMenu = sticky;
}
+bool KToolBarPopupAction::hasMenuIndicator() const
+{
+ return d->menuIndicator;
+}
+
+void KToolBarPopupAction::setMenuIndicator(bool menuIndicator)
+{
+ d->menuIndicator = menuIndicator;
+}
diff --git a/src/ktoolbarpopupaction.h b/src/ktoolbarpopupaction.h
index 200391b..965a914 100644
--- a/src/ktoolbarpopupaction.h
+++ b/src/ktoolbarpopupaction.h
@@ -114,6 +114,24 @@ public:
*/
void setStickyMenu(bool sticky);
+ /**
+ * Returns false if the created widget will have a property set hinting
+ * that a menu indicator should not be drawn.
+ * Default: true.
+ * @see setMenuIndicator()
+ * @since 5.58
+ */
+ bool hasMenuIndicator() const;
+ /**
+ *
+ * If set to false, the widget created by this action will have a property set
+ * that hints the style to disable drawing of the menu indicator. This is useful
+ * for navigation type popup actions.
+ * Default: true
+ * @since 5.58
+ */
+ void setMenuIndicator(bool menuIndicator);
+
/**
* Reimplemented from QWidgetAction.
*/
--
2.21.0