Add Property to disable drawing of menu arrow indicators
Needs ReviewPublic

Authored by hallas on Apr 27 2019, 1:57 PM.

Details

Reviewers
ngraham
Summary

Add Property to disable drawing of menu arrow indicators. This is useful
for navigation type Tool Buttons.

Diff Detail

Repository
R31 Breeze
Branch
add_property_to_disable_drawing_of_menu_arrow_indicator (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 13325
Build 13343: arc lint + arc unit
hallas created this revision.Apr 27 2019, 1:57 PM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 27 2019, 1:57 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
hallas requested review of this revision.Apr 27 2019, 1:57 PM

There shouldn't be any Breeze specific code in client apps. It's a sign of something being wrong.

What's a navigation style toolbutton and where do you want to use this?

There shouldn't be any Breeze specific code in client apps. It's a sign of something being wrong.

What's a navigation style toolbutton and where do you want to use this?

It is this patch D19311 that has been driving this change. If you have suggestions for a better way to solve this it would be more than welcome :D

QToolButton::setArrowType?

QToolButton::setArrowType?

I just tried that, but it doesn't seem like Breeze honors this property - at least not for the QToolButton produced by KToolBarPopupAction. So adding

button->setArrowType(Qt::ArrowType::NoArrow);

to

QWidget *KToolBarPopupAction::createWidget(QWidget *_parent)

still display the arrows :/ Or am I doing something wrong?

QToolButton::setArrowType?

After reading the documents and experimenting a bit, I think that this property is not what we are looking for. The Arrow Type property is to display the Tool Button as an arrow instead of an icon and this is not what we use to draw the down arrow indicator on Tool Buttons with a popup menu, instead this is drawn "directly" by Breeze.

mart added a subscriber: mart.May 6 2019, 9:20 AM

QToolButton::setArrowType?

I just tried that, but it doesn't seem like Breeze honors this property - at least not for the QToolButton produced by KToolBarPopupAction. So adding

That's probably a breeze bug and that's where it should be addressed.
an application can't link to breeze, especially if is private api. (and would explode dependencies in distros package managers)

hallas added a comment.May 6 2019, 5:27 PM
In D20867#461499, @mart wrote:

QToolButton::setArrowType?

I just tried that, but it doesn't seem like Breeze honors this property - at least not for the QToolButton produced by KToolBarPopupAction. So adding

That's probably a breeze bug and that's where it should be addressed.
an application can't link to breeze, especially if is private api. (and would explode dependencies in distros package managers)

@mart - I am not sure I follow? I think the QToolButton::ArrowType is intended for something else then what we are trying to do here. I am not trying to make any application depend directly on breeze. Instead these properties are loosely coupled, so an application setting a property doesn't impose that the application needs to link with breeze. It is simply a hint to the style.

With that being said, I am certainly open to other ways of solving this problem, so feel free to pinch in ;)

Hi @ngraham - any update on this one? Should we move forward with this approach or should we do something else?

ngraham requested changes to this revision.Jun 20 2019, 9:57 PM

This patch doesn't seem to make the back and forward buttons lose their arrows once I've applied D19311, and it also makes all KDE apps crash like so:

(gdb) bt
#0  QObject::property (this=0x0, 
    name=0x7fffe0ab28d0 <Breeze::PropertyNames::toolButtonNoMenuArrow> "_kde_toolButton_noMenuArrow") at kernel/qobject.cpp:3961
#1  0x00007fffe0a8cd3f in BreezePrivate::hasInlineIndicator (
    toolButtonOption=0x555555c2e9e0, toolButton=<optimized out>)
    at /home/dev/kde/src/breeze/kstyle/breezestyle.cpp:160
#2  0x00007fffe0a8df30 in Breeze::Style::toolButtonSizeFromContents (
    this=<optimized out>, option=<optimized out>, contentsSize=..., 
    widget=<optimized out>) at /home/dev/kde/src/breeze/kstyle/breezestyle.cpp:2739
This revision now requires changes to proceed.Jun 20 2019, 9:57 PM

Actually maybe it just needs a rebase on master...

Actually maybe it just needs a rebase on master...

Let me give it a rebase then :D

hallas updated this revision to Diff 60699.Jun 26 2019, 4:05 PM

Rebased

Hi @ngraham - I have looked into this patch set and it is a little tedious to test, you have to do the following:

  1. Apply the following patch to KWidgetAddons F6773036 then build and install it
  2. Apply this patch to breeze then build and install it
  3. Apply D19311 to Dolphin
  4. Then make the following changes to Dolphin:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ef0e28e76..a86256950 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,6 +65,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
     Notifications
     Crash
     WindowSystem
+    WidgetsAddons
 )
 find_package(KF5 ${KF5_MIN_VERSION} OPTIONAL_COMPONENTS
     Activities
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8a025e584..80a767aa9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -148,6 +148,7 @@ target_link_libraries(
     KF5::ConfigCore
     KF5::NewStuff
     KF5::Parts
+    KF5::WidgetsAddons
     KF5::WindowSystem
 )
 
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 1f1c1cea6..80db0bbe9 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -1292,6 +1292,7 @@ void DolphinMainWindow::setupActions()
     }
     m_backAction->setDelayed(true);
     m_backAction->setStickyMenu(false);
+    m_backAction->setMenuIndicator(false);
     connect(m_backAction, &QAction::triggered, this, &DolphinMainWindow::goBack);
     connect(m_backAction->menu(), &QMenu::aboutToShow, this, &DolphinMainWindow::slotAboutToShowBackPopupMenu);
     connect(m_backAction->menu(), &QMenu::triggered, this, &DolphinMainWindow::slotGoBack);
@@ -1327,6 +1328,7 @@ void DolphinMainWindow::setupActions()
     }
     m_forwardAction->setDelayed(true);
     m_forwardAction->setStickyMenu(false);
+    m_forwardAction->setMenuIndicator(false);
     connect(m_forwardAction, &QAction::triggered, this, &DolphinMainWindow::goForward);
     connect(m_forwardAction->menu(), &QMenu::aboutToShow, this, &DolphinMainWindow::slotAboutToShowForwardPopupMenu);
     connect(m_forwardAction->menu(), &QMenu::triggered, this, &DolphinMainWindow::slotGoForward);

then build and install Dolphin, and then (phew) you should be able to see that the arrows are gone :D

I have also rebased this patch.

But if we agree to how this feature is implemented, I would suggest that we get this patch merged, then merge the patch for KWidgetAddons, and then when those two has been released, we merge the patch for Dolphin.

What do you think?

Here is a screenshot of how it looks with everything applied:

Sorry for the delayed response! Let me block out some time to give it a whirl. I am left wondering if there's any simpler way we can do it though. KWidgetsAddons, Breeze, and Dolphin each have different release cycles, so making sure everything gets in at the right time and things work without other bits already present may be challenging.