optionselector does not display image correctly

Bug #1556757 reported by XiaoGuo, Liu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ubuntu-ui-toolkit (Ubuntu)
New
Undecided
Unassigned

Bug Description

I have developed a sample code at https://developer.ubuntu.com/api/apps/qml/sdk-15.04.1/Ubuntu.Components.OptionSelector/. My example code is at:

https://github.com/liu-xiao-guo/optionselector

The following part of the code has problems:

                Component {
                    id: selectorDelegate
                    OptionSelectorDelegate { text: name; subText: description;
                        iconSource: {
                            return Qt.resolvedUrl(image)
                        }
                    }
                }
                ListModel {
                    id: customModel
                    ListElement { name: "Name 1"; description: "Description 1"; image: "images/icon2.jpg" }
                    ListElement { name: "Name 2"; description: "Description 2"; image: "images/icon2.jpg" }
                    ListElement { name: "Name 3"; description: "Description 3"; image: "images/icon2.jpg" }
                    ListElement { name: "Name 4"; description: "Description 4"; image: "images/icon2.jpg" }
                }

The images are defined in the qrc files. However, when I run the app, the image is shown as black. Attached please find the captured picture.

Thanks & best regards,
XiaoGuo

Revision history for this message
XiaoGuo, Liu (liu-xiao-guo) wrote :
Revision history for this message
Zsombor Egri (zsombi) wrote :

If your images are in QRC then you should say that to the OptionSelector somehow. Like "qrc://images/icon2.jpg"

Changed in ubuntu-ui-toolkit (Ubuntu):
status: New → Invalid
Revision history for this message
XiaoGuo, Liu (liu-xiao-guo) wrote :

If I change it to qrc://images/icon2.jpg, I will have the follow errors:

QML debugging is enabled. Only use this in a safe environment.
file:///usr/ubuntu-sdk-dev/qml/Ubuntu/Components/1.3/OptionSelectorDelegate.qml:297:9: QML QQuickImage: Request for opening non-local file qrc://images/icon2.jpg
file:///usr/ubuntu-sdk-dev/qml/Ubuntu/Components/1.3/OptionSelectorDelegate.qml:297:9: QML QQuickImage: Request for opening non-local file qrc://images/icon2.jpg
file:///usr/ubuntu-sdk-dev/qml/Ubuntu/Components/1.3/OptionSelectorDelegate.qml:297:9: QML QQuickImage: Request for opening non-local file qrc://images/icon2.jpg
file:///usr/ubuntu-sdk-dev/qml/Ubuntu/Components/1.3/OptionSelectorDelegate.qml:297:9: QML QQuickImage: Request for opening non-local file qrc://images/icon2.jpg

The usage for [image: "images/icon2.jpg"] should be right since it does not complain anything about it.

Best regards,
XiaoGuo

Changed in ubuntu-ui-toolkit (Ubuntu):
status: Invalid → New
Revision history for this message
Mateo Salta (mateo-salta) wrote :

use - colourImage: true
otherwise they are converted to greyscale - also I had to manually size the images, otherwise they overlap

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.