Failure to load images with @ suffix when images loaded before import Ubuntu.Components

Bug #1100795 reported by Ugo Riboni
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Ubuntu UI Toolkit
Invalid
High
Unassigned

Bug Description

Given the following simple 3 files, you get the following error when running Main.qml in qmlscene:

file:///usr/share/themes/Ambiance/qmltheme/ScrollbarDelegate.qml:449:13: QML Image: Cannot open: file:///usr/share/themes/Ambiance/qmltheme/artwork/ScrollbarBottomIdle.png
file:///usr/share/themes/Ambiance/qmltheme/ScrollbarDelegate.qml:445:13: QML Image: Cannot open: file:///usr/share/themes/Ambiance/qmltheme/artwork/ScrollbarTopIdle.png

(repeated several times)

Here's the files:

==== Main.qml ====

import QtQuick 2.0
Item {
    height: 100
    width: 400
    ImageItem {}
    TextItem {}
}

==== ImageItem.qml ====

import QtQuick 2.0
Image {}

==== TextItem.qml ====

import QtQuick 2.0
import Ubuntu.Components 0.1

TextArea {}

====================

If you switch the order of ImageItem and TextItem in Main.qml or "import Ubuntu.Components 0.1" from Main.qml, then the error doesn't appear anymore

tags: added: theming
Changed in ubuntu-ui-toolkit:
importance: Undecided → High
Changed in ubuntu-ui-toolkit:
assignee: nobody → Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit:
importance: High → Critical
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

Why is this bug critical? Sure it is not nice, but does it block or break anything?

Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit:
status: New → Confirmed
Revision history for this message
Zsombor Egri (zsombi) wrote :

Ubuntu.Components must be imported in ImageItem as that provides scaling support for images. Seems that QML backend does not keep two Image components in the cache (one for ImageItem where Ubultu Components' scaling support is not used and one for ScrollbarDelegate), therefore the Image elements from ScrollBarDelegate won't have support for scaling.

The following actions will prove this:
0. Having the order specified in the attached test code, UCQQuickImageExtension::reloadSource() is never called.
1. Switching ImageItem with TextItem makes UCQQuickImageExtension::reloadSource() to be called.
2. Adding import Ubuntu.Components 0.1 to either Main.qml or ImageItem.qml results in UCQQuickImageExtension::reloadSource() to be called.

Changed in ubuntu-ui-toolkit:
assignee: Zsombor Egri (zsombi) → Florian Boucault (fboucault)
Changed in ubuntu-ui-toolkit:
importance: Critical → High
summary: - Failure to load theme when images loaded before SDK components
+ Failure to load images with @ suffix when images loaded before import
+ Ubuntu.Components
tags: removed: theming
Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit:
status: Confirmed → Invalid
Revision history for this message
Florian Boucault (fboucault) wrote :

Why was this marked as Invalid?

Changed in ubuntu-ui-toolkit:
assignee: Florian Boucault (fboucault) → nobody
status: Invalid → Confirmed
Revision history for this message
Loïc Molinari (loic.molinari) wrote :

While debugging #1308453 [1], I realized it's actually a dup of that one. The source of the bug comes from the use of qmlRegisterExtendedType() to extend QQuickImageBase, it seems that if a QQuickImageBase class has been instantiated before the registration, the registration doesn't work.

A workaround for that is to make the registration happen early enough by importing Ubuntu.Components as soon as possible.

[1] https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1308453

Revision history for this message
Loïc Molinari (loic.molinari) wrote :

In my previous comment, by "early enough", I actually mean before the first Image item is used.

Revision history for this message
Cris Dywan (kalikiana) wrote :

All apps should be using a MainView which would prevent this issue. Beyond that there's nothing we can do because the import is the only point at which types are registered… the only way to solve this would be to implement a plugin system for image loaders that is separate from QML plugins.

Changed in ubuntu-ui-toolkit:
status: Confirmed → Invalid
Revision history for this message
Florian Boucault (fboucault) wrote : Re: [Bug 1100795] Re: Failure to load images with @ suffix when images loaded before import Ubuntu.Components

The fact we have no simple fix does not make the bug invalid.
On Oct 1, 2014 7:55 AM, "Christian Dywan" <email address hidden> wrote:

> All apps should be using a MainView which would prevent this issue.
> Beyond that there's nothing we can do because the import is the only
> point at which types are registered… the only way to solve this would be
> to implement a plugin system for image loaders that is separate from QML
> plugins.
>
> ** Changed in: ubuntu-ui-toolkit
> Status: Confirmed => Invalid
>
> --
> You received this bug notification because you are subscribed to Ubuntu
> UI Toolkit.
> https://bugs.launchpad.net/bugs/1100795
>
> Title:
> Failure to load images with @ suffix when images loaded before import
> Ubuntu.Components
>
> Status in Ubuntu UI Toolkit:
> Invalid
>
> Bug description:
> Given the following simple 3 files, you get the following error when
> running Main.qml in qmlscene:
>
> file:///usr/share/themes/Ambiance/qmltheme/ScrollbarDelegate.qml:449:13:
> QML Image: Cannot open:
> file:///usr/share/themes/Ambiance/qmltheme/artwork/ScrollbarBottomIdle.png
> file:///usr/share/themes/Ambiance/qmltheme/ScrollbarDelegate.qml:445:13:
> QML Image: Cannot open:
> file:///usr/share/themes/Ambiance/qmltheme/artwork/ScrollbarTopIdle.png
>
> (repeated several times)
>
> Here's the files:
>
> ==== Main.qml ====
>
> import QtQuick 2.0
> Item {
> height: 100
> width: 400
> ImageItem {}
> TextItem {}
> }
>
> ==== ImageItem.qml ====
>
> import QtQuick 2.0
> Image {}
>
> ==== TextItem.qml ====
>
> import QtQuick 2.0
> import Ubuntu.Components 0.1
>
> TextArea {}
>
> ====================
>
> If you switch the order of ImageItem and TextItem in Main.qml or
> "import Ubuntu.Components 0.1" from Main.qml, then the error doesn't
> appear anymore
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1100795/+subscriptions
>

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

Duplicates of this bug

Other bug subscribers