dolphin/src
Scott Harvey e0f7fe87bd Fix alignment of icons in Places panel and Compact view mode
Summary:
Adjust calculation of icon pixmap Y value; now based off center of text label bounding rectangle. Previously, icons appeared top-aligned when text size was larger than icon size.

Centering is done by obtaining the center point of the text frame (`m_textRect.center().y()`) and setting the top `Y` point of the icon to one-half of the scaled icon height (`m_scaled_PixmapSize.height()`)  Division is done by `2.0`, to ensure calculations are done with floating-point math, in keeping with `QPointF`, which returns floating-point values.

Also includes an adjustment named `midlineShift` (contributed by @zzag), which takes into account the font's midline in respect to the center of the text frame. Certain fonts (i.e. Noto Sans) can have a slightly offset midline, resulting in imperfect alignment of the icon. This small adjustment resolves that potential issue.

See before and after screenshots.
{F5764918}
Before, showing misalignment (with and without debugging wireframes)

{F5764920}
After, showing correction

BUG: 390771

Test Plan:
-- Compile Dolphin with patch
-- Increase system font size by several points (i.e. 15pt)
-- Check that Places panel icons remain centered with the text label
-- Select Compact View mode
-- Adjust icon size slider to minimum
-- Ensure that icons also remain centered in file listing
-- Check several combinations of icon size & font size to ensure centering is consistent

Reviewers: #dolphin, ngraham, cfeck, elvisangelaccio

Reviewed By: #dolphin, ngraham, elvisangelaccio

Subscribers: zzag, elvisangelaccio, #dolphin

Differential Revision: https://phabricator.kde.org/D11650
2018-03-29 16:29:51 -06:00
..
filterbar Remove unused #include 2018-03-04 21:00:47 +03:00
icons Add application icon for Mac and MS Windows. 2016-11-22 18:15:42 +01:00
kitemviews Fix alignment of icons in Places panel and Compact view mode 2018-03-29 16:29:51 -06:00
panels Introduce singleton for KFilePlacesModel 2018-03-19 09:57:24 +01:00
search Remove unused #include 2018-03-04 21:00:47 +03:00
settings SVN_SILENT made messages (.desktop file) - always resolve ours 2018-03-13 05:14:09 +01:00
statusbar Remove unused #include 2018-03-04 21:00:47 +03:00
tests Removed unused variables spotted by clazy 2018-03-11 17:14:07 +01:00
trash Fix compilation with -DQT_NO_URL_CAST_FROM_STRING 2018-03-21 15:30:51 +01:00
views Remove unused #include 2018-03-04 21:00:47 +03:00
CMakeLists.txt Fix compilation with -DQT_NO_URL_CAST_FROM_STRING 2018-03-21 15:30:51 +01:00
config-baloo.h.cmake Port Dolphin to Baloo 2014-02-06 20:29:09 +01:00
config-dolphin.h.cmake KF5ify Dolphin. 2014-06-29 01:35:37 +02:00
config-X11.h.cmake Merged very early alpha-version of Dolphin 2.0 2011-07-30 20:13:41 +02:00
dbusinterface.cpp Remove unused #include 2018-03-04 21:00:47 +03:00
dbusinterface.h Add dbus interface to dolphin 2015-04-22 18:59:39 +05:30
dolphin.qrc Bundle the XMLGUI files into qrc resources. 2017-07-25 11:39:57 +02:00
dolphincontextmenu.cpp [DolphinContextMenu] Fix excluding ourself from Open With menu 2018-03-24 11:24:24 +01:00
dolphincontextmenu.h Remove unused #include 2018-03-04 21:00:47 +03:00
dolphindebug.cpp Replace kDebug/kWarning by categorized logging (org.kde.dolphin) 2015-02-24 13:07:35 +01:00
dolphindebug.h Replace kDebug/kWarning by categorized logging (org.kde.dolphin) 2015-02-24 13:07:35 +01:00
dolphindockwidget.cpp Modernize: Use override where possible 2017-11-20 23:25:48 +01:00
dolphindockwidget.h Modernize: Use nullptr everywhere 2017-11-21 10:53:12 +01:00
dolphinmainwindow.cpp Introduce singleton for KFilePlacesModel 2018-03-19 09:57:24 +01:00
dolphinmainwindow.h Add "Show Target" into symlink context menu and file menu 2018-03-18 15:08:36 +03:00
dolphinnewfilemenu.cpp [CLAZY] Fixed all level 1 and level 2 warnings with small exceptions 2016-03-16 22:17:37 +01:00
dolphinnewfilemenu.h Remove unused #include 2018-03-04 21:00:47 +03:00
dolphinpart.cpp Remove unused #include 2018-03-04 21:00:47 +03:00
dolphinpart.desktop SVN_SILENT made messages (.desktop file) - always resolve ours 2018-01-09 04:56:51 +01:00
dolphinpart.h Remove unused #include 2018-03-04 21:00:47 +03:00
dolphinpart.qrc Bundle the XMLGUI files into qrc resources. 2017-07-25 11:39:57 +02:00
dolphinpart.rc Port to KStandardAction::RenameFile 2017-08-09 22:59:38 +02:00
dolphinpart_ext.cpp Remove unused #include 2018-03-04 21:00:47 +03:00
dolphinpart_ext.h Remove unused #include 2018-03-04 21:00:47 +03:00
dolphinplacesmodelsingleton.cpp Introduce singleton for KFilePlacesModel 2018-03-19 09:57:24 +01:00
dolphinplacesmodelsingleton.h Introduce singleton for KFilePlacesModel 2018-03-19 09:57:24 +01:00
dolphinrecenttabsmenu.cpp Remove unused #include 2018-03-04 21:00:47 +03:00
dolphinrecenttabsmenu.h Remove unused #include 2018-03-04 21:00:47 +03:00
dolphinremoveaction.cpp Remove unused #include 2018-03-04 21:00:47 +03:00
dolphinremoveaction.h Remove unused #include 2018-03-04 21:00:47 +03:00
dolphintabbar.cpp Remove unused #include 2018-03-04 21:00:47 +03:00
dolphintabbar.h Modernize: Use override where possible 2017-11-20 23:25:48 +01:00
dolphintabpage.cpp Remove unused #include 2018-03-04 21:00:47 +03:00
dolphintabpage.h Remove unused #include 2018-03-04 21:00:47 +03:00
dolphintabwidget.cpp Revert "Fix some compile warnings" 2018-03-05 21:56:15 +01:00
dolphintabwidget.h Modernize: Use override where possible 2017-11-20 23:25:48 +01:00
dolphinui.rc Add "Show Target" into symlink context menu and file menu 2018-03-18 15:08:36 +03:00
dolphinviewcontainer.cpp Introduce singleton for KFilePlacesModel 2018-03-19 09:57:24 +01:00
dolphinviewcontainer.h Show "Empty Trash" button inside trash directory 2018-03-18 13:46:06 +03:00
global.cpp Remove unused #include 2018-03-04 21:00:47 +03:00
global.h Pass application name and icon to KRun 2017-03-08 16:52:15 +01:00
main.cpp Remove unused #include 2018-03-04 21:00:47 +03:00
Messages.sh Minor 2010-10-19 07:38:50 +00:00
middleclickactioneventfilter.cpp Support middle clicking of Back/Forward/Up/Home toolbar buttons 2017-08-24 15:45:28 +02:00
middleclickactioneventfilter.h Fix all 'explicit constructor' krazy warnings 2018-02-03 22:21:30 +01:00
org.kde.dolphin.appdata.xml GIT_SILENT made messages (after extraction) 2017-12-31 05:22:08 +01:00
org.kde.dolphin.desktop SVN_SILENT made messages (.desktop file) - always resolve ours 2018-03-03 05:23:49 +01:00