Bug 427449 - QQC2-Desktop-Style causes RDM to not show toolbar buttons
Summary: QQC2-Desktop-Style causes RDM to not show toolbar buttons
Status: RESOLVED FIXED
Alias: None
Product: frameworks-qqc2-desktop-style
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.73.0
Platform: Other FreeBSD
: NOR normal
Target Milestone: ---
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-08 13:52 UTC by groot
Modified: 2020-10-09 16:55 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.76
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description groot 2020-10-08 13:52:17 UTC
SUMMARY

Redis Desktop Manager does not show toolbar icons under QQC2-Desktop-Style, but doesshow them under Material style, or with no style set.


STEPS TO REPRODUCE
1. Build Redis Desktop Manager. There are instructions at http://docs.redisdesktop.com/en/latest/install/ ; there's also a snap which might make things easier to test (I don't know how snap interacts with styles -- installing the snap via discover on KDE neon does **not** reproduce the problem, but it's also styled differently from the rest of my desktop)
2. Run it (e.g. if you've just built it in src/, then `../bin/linux/release/rdm`). Take a screenshot, then close it -- you don't actually need Redis anywhere.
3. Run it again, but with a different style, `QT_QUICK_CONTROLS_STYLE=Material ../bin/linux/release/rdm` . Take a screenshot.
4. Run it again, `( unset KDE_FULL_SESSION ; unset XDG_CURRENT_DESKTOP ; unset DESKTOP_SESSION ; ../bin/linux/release/rdm  )` and take a screenshot.


OBSERVED RESULT

- With QQC2-Desktop-Style, no icons show up on the toolbar buttons
- With Material style, icons show up but are very small
- With no style, icons show up as normal.


EXPECTED RESULT

I expect the buttons to show up the same in all styles (unless there's something silly in the RDM QML, which is *also* a possibility).

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 groot 2020-10-08 14:05:54 UTC
Notes for build-from-source on KDE neon:

- git clone --recursive https://github.com/uglide/RedisDesktopManager.git -b 2020 rdm
- cd rdm/src ; qmake . ; make -j2

Needs libqt5charts5-dev (and more qt development stuff)
Comment 2 Noah Davis 2020-10-08 16:48:54 UTC
From my own testing with GammaRay, the problem seems to be that qrc:/ urls are not working with qqc2-desktop-style's StyleItem element.
If you use a hard coded path like `/home/<user>/src/RedisDesktopManager/src/resources/images/help.svg`, an icon will show.
If you use a theme icon like `go-next`, an icon will show.

I believe the problem is at lines 185 and 186 of qqc2-desktop-style/plugin/kquickstyleitem.cpp:

 182   │         const QVariant icon = m_properties[QStringLiteral("icon")];
 183   │         if (icon.canConvert<QIcon>()) {
 184   │             opt->icon = icon.value<QIcon>();
>185   │         } else if (icon.canConvert<QUrl>() && icon.value<QUrl>().isLocalFile()) {
>186   │             opt->icon = QIcon(icon.value<QUrl>().toLocalFile());
 187   │         } else if (icon.canConvert<QString>()) {
 188   │             opt->icon = m_theme->iconFromTheme(icon.value<QString>(), m_properties[QStringLiteral("iconColor")].value<QColor>());
 189   │         }
Comment 3 Noah Davis 2020-10-08 17:09:21 UTC
By the way, if you are trying to build the project from source, you must edit 3rdparty.pri if you get the following error:

g++: error: /media/noah-ihdd/src/RedisDesktopManager/3rdparty/lz4//build/cmake/liblz4.a: No such file or directory

Here's what you must change:

Line 33:
-LZ4DIR = $$PWD/lz4/
+LZ4DIR = $$PWD/lz4

Line 59:
-    LIBS += -lz $$LZ4DIR/build/cmake/liblz4.a
+    LIBS += -lz $$LZ4DIR/lib/liblz4.a
Comment 4 groot 2020-10-08 17:25:02 UTC
Notes for build-from-source on KDE neon:

- ensure you have a viable development environment. You will need to install gcc, g++, make, git, ...
- you will need Qt5 development environment things as well, look for -dev packages
- sudo apt install libqt5charts5-dev liblz4-dev qml-module-qtcharts qml-module-qt-labs-qmlmodels
- git clone --recursive https://github.com/uglide/RedisDesktopManager.git -b 2020 rdm
- cd rdm/src ; qmake . ; make -j2
- the build will fail, eventually, with a message like `src/RedisDesktopManager/3rdparty/lz4//build/cmake/liblz4.a: No such file or directory` . Edit the Makefile, and in the line that sets the `LIBS` variable (around line 43), replace the full path of liblz4.a there -- which is pointing into the source directory -- with a full path of the system's liblz4.a. That is somewhere under /usr .. Debian multilib gets me down.
- run make again to complete the build
- ../bin/linux/release/rdm (this will show you the problem where no icons show up on the buttons)

From here, the behavior of the application is the same on KDE neon Linux as on FreeBSD: no icons on buttons, or tiny icons (in Material style) or regular icons when the session and XDG things are turned off.

If the application doesn't start, check the console output: I may not have listed all of the QML dependencies it needs.
Comment 5 Bug Janitor Service 2020-10-09 02:22:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/35
Comment 6 Noah Davis 2020-10-09 14:08:44 UTC
Git commit 015891bf58b5f96ae142920bba48b92fe31ea0e4 by Noah Davis.
Committed on 09/10/2020 at 02:25.
Pushed by ndavis into branch 'master'.

Add support for qrc icons to StyleItem

FIXED-IN: 5.76

M  +37   -24   plugin/kquickstyleitem.cpp
M  +1    -0    plugin/kquickstyleitem_p.h

https://invent.kde.org/frameworks/qqc2-desktop-style/commit/015891bf58b5f96ae142920bba48b92fe31ea0e4