Closed mojtaba82 closed 3 years ago
I already have background opacity animations, so making a reveal on hover animation isn't too difficult. The hard part is having the entire menu drawn in sync as the current bg hover animation is per button. I will need another QAnimation
, probably in AppMenuButtonGroup
. I'll also need to rename the existing opacity
property to backgroundOpacity
, or hoverTween
as the foreground color was also mixed on hover.
This code snippet will make all buttons transparent, and reveal just 1 button on hover.
QColor AppMenuButton::foregroundColor() const
{
// ...
} else {
QColor hoverColor = Button::foregroundColor();
QColor normalColor = QColor(hoverColor);
normalColor.setAlphaF(0);
return KColorUtils::mix(
normalColor,
hoverColor,
opacity());
}
}
I also need to determine if the menu should be revealed if the caption area is hovered, or if anywhere in the titlebar is hovered. If the latter, then the hover events need to be handled in Decoration
. I can still keep the new opacity property in AppMenuButtonGroup
though.
can we have this without any animation?
I'm also interested on this, even without animations
The menuonhover
branch has this feature. I now need to add a config option.
I need to figure out how I want to handle the caption. It currently "dodges" the menu which isn't needed when the menu is hidden.
I should probably do a comprehensive alignment option like Breeze.
Hmm. According to the Unity video https://youtu.be/nzFXRz-b3Ns?t=40
I fork this nice decoration. and add a branch named captionmenufeatcher and merge caption and menu like unity lim. It work but I'm not professional in programming. I would be glad if you test it. Thanks
hey adding to this, could we have the title of the window instead of empty space?
so on no hover -> title
on hover -> menu
@nicman23
hey adding to this, could we have the title of the window instead of empty space? so on no hover -> title on hover -> menu
I implement this feature you want. you can compile and test it. https://github.com/mojtaba82/material-decoration
I've merged this feature and titlebar alignment to the master
branch.
https://user-images.githubusercontent.com/416367/107437606-3e559b80-6afd-11eb-93a4-81d6525b715d.mp4
small bug report, the menu is visible on window creation not the title
Thanks for reporting the bug @nicman23. I fixed that bug and made the titlebar repaint when toggling always show.
I have same problem occasionally.
The hover animation isn't checking if the menu is open atm. I did experience that once, but it rarely happens with Breeze's contextmenu.
Looks like I need to check (m_currentIndex != -1)
in the updateOpacity
func.
setOpacity(m_alwaysShow || m_hovered ? 1 : 0);
To reproduce it, you need to click at points sit at the lower-half part of buttons...
To reproduce it, you need to click at points sit at the lower-half part of buttons...
I cinfirm this.
Should be fixed with https://github.com/Zren/material-decoration/commit/d0267814ec81be025f732e9ef85a28076f56a813 and https://github.com/Zren/material-decoration/commit/8873774202153d793936e75437b7924a9cf43198.
Thanks @trmdi for your PR #34. I expanded on it to add a bool showing
property which represents the alwaysShow || hovered || isMenuOpen()
.
Hi. Thank you fot this nice decortion. Please add feature to show menu only when hover on title bar.