Home
Phabricator
Search
Log In
Files
F6773036
0001-Add-hasMenuIndicator-and-setMenuIndicator-to-KToolBa.patch
hallas (David Hallas)
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Author
hallas
Created
Apr 14 2019, 5:48 PM
Size
2 KB
Mime Type
text/x-diff
Engine
blob
Format
Raw Data
Handle
4268938
Attached To
D20867: Add Property to disable drawing of menu arrow indicators
D19311: Add navigation history to forward/back buttons
0001-Add-hasMenuIndicator-and-setMenuIndicator-to-KToolBa.patch
View Options
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
Log In to Comment