Support icons from local files in buttons

Authored by nicolasfella on Jan 17 2019, 10:02 PM.

Description

Support icons from local files in buttons

Summary:
Trying to assign an icon from a file to a button like in

import QtQuick 2.2
import QtQuick.Controls 2.4

Button {
    icon.source: "/usr/share/icons/breath/emotes/22/face-smirk.svg"
}

results in no icon being shown. The current code interprets the filename as QString and tries to load an icon with that name from the theme, which obviously doesn't exist. This patch checks whether the icon points to a local file
and if it is loads it. If not it falls back to loading it from the theme.

Test Plan:
Above code now correctly displays a face.
Ran systemsettings, checked QML KCMs' buttons for icons

Reviewers: Plasma, mart

Reviewed By: Plasma, mart

Subscribers: broulik, plasma-devel

Tags: Plasma

Differential Revision: https://phabricator.kde.org/D18341

Details