mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-26 20:04:12 +02:00
Give icons a hover state through a proxy style
Hovering a tool button changed only its frame, and on the dark palette Fusion's hover frame is too faint to notice, so nothing told the user which button was under the pointer (GitHub #870, PR 3 of the plan). QETStyle wraps the running style. For QIcon::Active it returns line-art icons tinted in the palette's highlight color, lightened until the tint reads at 3:1 on the Light role, which is the top of Fusion's hover gradient. Colored icons keep their colors, using the same line-art rule as misc/make_icon_themes.py. Every other mode goes to the base style. Fusion also asks for QIcon::Active for the icon of a highlighted menu item and paints it on the highlight bar, where the tint would vanish. The generated pixmap is cached per icon and cannot tell a menu from a toolbar, so drawControl(CE_MenuItem) hands the base style an icon whose Active pixmap is in the HighlightedText color instead. QETApp::initStyle() installs the proxy on every platform, keeping the base style's object name so the Fusion checks still match. tests/qttest/tst_qeticons: hovering changes the icon ink to the tint and stays at 3:1 on both palettes, on a raised button and on a checked one drawn sunken, where the frame gives no hover cue at all; a colored icon is unchanged on hover; a highlighted menu item's icon reads at 3:1 on the highlight bar. inkcontrast.h gains background() and ink() helpers for those checks.
This commit is contained in:
@@ -250,6 +250,8 @@ set(QET_SRC_FILES
|
||||
${QET_DIR}/sources/qeticons.h
|
||||
${QET_DIR}/sources/qetpalette.cpp
|
||||
${QET_DIR}/sources/qetpalette.h
|
||||
${QET_DIR}/sources/qetstyle.cpp
|
||||
${QET_DIR}/sources/qetstyle.h
|
||||
${QET_DIR}/sources/qetinformation.cpp
|
||||
${QET_DIR}/sources/qetinformation.h
|
||||
${QET_DIR}/sources/qetmainwindow.cpp
|
||||
|
||||
Reference in New Issue
Block a user