Theme.createStyleComponent deprecation useless warnings are displayed

Bug #1457528 reported by Sebastien Bacher
18
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
Zoltan Balogh
ubuntu-ui-toolkit (Ubuntu)
Fix Released
High
Cris Dywan
Vivid
New
Undecided
Unassigned

Bug Description

Take that example

"import QtQuick 2.0
import Ubuntu.Components 0.1

Item {
    Button {
        text: "click"
    }
}"

run it on wily, you get those warnings

"QML Button: Theme.createStyleComponent() is deprecated. Use ThemeSettings instead."

the warning is not helpful, it warns about a standard component issue (so something in the responsability of the uitk team, not the code writer), lists the issue on something you are not using (what is "Theme.createStyleComponent()" that's not used in the code example?), it's just confusing...

Related branches

Tim Peeters (tpeeters)
Changed in ubuntu-ui-toolkit (Ubuntu):
status: New → Confirmed
assignee: nobody → Zsombor Egri (zsombi)
Revision history for this message
Tim Peeters (tpeeters) wrote :

<seb128> timp, the warning goes away if you update the import version to e.g 1.1, so I guess that's what needs to be changed, but the warning hint is not helpful in this case

If updating the import version is supposed to fix the warning, we should say that in the printed message to help the app developers figure out what's wrong.

Revision history for this message
Zsombor Egri (zsombi) wrote :

If the warning disappears with 1.1 import then we're in trouble. It should be displayed with 1.1 as well. It should be displayed till Theme is used instead of theme. So if 1.3 import uses Theme, it will show a warning.

Revision history for this message
Zsombor Egri (zsombi) wrote :

I've checked the test with staging, and I get warnings for 0.1, 1.0, 1.1 and 1.2 imports. So seems staging has some fix which makes the warning to be printed everywhere but 1.3.

About the logs, staging (and I think overlay PPA will get it soon) has more info on where the problem relies. I am getting the following log: "test.qml:5:5: QML Button: Theme.createStyleComponent() is deprecated. Use ThemeSettings instead."

Theme is a context property. Context properties and Singletons are impossible to know from which QML file are invoked. So we cannot really display any meaningful information on where the component is used. We cannot know whether the functionality is called from a toolkit component or from an application or custom component based on toolkit. As seen above, the staging which is also planned to be released, has more information on Theme.createStyleComponent(), but that is the only one can give valuable information. Theme.palette or Theme.name will not know the caller context, and will not be able to specify from what document it is addressed.

Changed in ubuntu-ui-toolkit (Ubuntu):
status: Confirmed → Fix Committed
Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit (Ubuntu):
status: Fix Committed → Confirmed
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, but as discussed on IRC as a code writer it doesn't help me much, see the example in the bug description, it's trivial and doesn't use "Theme", I don't even know how Theming work. The warning should point that possible reasons include use of outdated components

Cris Dywan (kalikiana)
Changed in ubuntu-ui-toolkit (Ubuntu):
importance: Undecided → High
Cris Dywan (kalikiana)
Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: Zsombor Egri (zsombi) → Christian Dywan (kalikiana)
status: Confirmed → In Progress
Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Alberto Mardegan (mardy) wrote :

I'm also affected by this. Looking up for more info, I didn't find any mention in developer.ubuntu.com that Theme is deprecated:

https://developer.ubuntu.com/api/apps/qml/sdk-15.04/Ubuntu.Components.Theme/

and no mention of ThemeSettings at all. Aren't you speeding up the deprecation process a bit too much? :-)

Revision history for this message
Alberto Mardegan (mardy) wrote :

Actually, my problem is slightly different: I *am* using the Theme component in my application, but it's an application using Ubuntu.Components 1.0 and the 14.10 framework.

In that version, Theme *is not deprecated*, therefore I shouldn't see any warnings.

That should be the case up to 1.2, where Theme is still documented as not being deprecated.

Please tell me if you are going to reopen this bug, or if you prefer a different one to be filed.

Revision history for this message
Tim Peeters (tpeeters) wrote :
Revision history for this message
Alberto Mardegan (mardy) wrote :

Actually as it appears from the discussion of bug 1467851, I'm afraid that the fix for this bug will completely remove the warning, because the QML context is always null (I have an application actively using the "theme" context property, and yet the context is empty for it, too).

Anyway, looking forward for the fix to land in vivid :-)

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-ui-toolkit - 1.3.1534+15.10.20150625-0ubuntu1

---------------
ubuntu-ui-toolkit (1.3.1534+15.10.20150625-0ubuntu1) wily; urgency=medium

  [ Christian Dywan ]
  * Use TextField.write rather than keyboard.type.
  * Update normal.backgroundText in SuruDark to #5D5D5D. Fixes LP: #1413801.
  * Fix "runtest.sh: line 78: [: -eq: unary operator expected]".
  * Consider caret visibility to decide text menu anchor. Fixes LP: #1462419.
  * Remove text from header textinput AP test QML. Fixes LP: #1459632.
  * No deprecation notes for our own components. Fixes LP: #1457528.

  [ Leonardo Arias Fonseca ]
  * Add url protocols to the fake application.
  * Adds a dependency to url-dispatcher-tools in ubuntu-ui-toolkit-autopilot.
  * Use the test launcher for all the toolkit autopilot tests.

  [ Zsombor Egri ]
  * Remove property bindings before property write does it. Fixes LP: #1462738.
  * Introducing StyleHints to provide style specific property changes.
  * Remove ThemeSettings.createStyleComponent() and add styleName to StyledItem.
    Fixes LP: #1458845.

  [ Loïc Molinari ]
  * [UbuntuShape] Computed dfdt factors based on window content orientation.
  * Previous logic was based on screen orientation which is not in sync with
    OrientationHelper.qml. Fixes LP: #1455567.

  [ Timo Jyrinki ]
  * Change -html documentation runtime dependencies into Suggests only to limit
    ubuntu-sdk download size. We're switching to offering only .qch offline
    documentation in SDK (inside of it), and they're being added to the seed.
    Fixes LP: #1461034.
  * Licensecheck started complaining about a person name, change to Canonical.
    Fixes LP: #1464549

  [ Andrea Bernabei ]
  * Modify ListItem.Caption label margins. Fixes LP: #1314672.

  [ Tim Peeters ]
  * Introduce IconButtonStyle.

 -- CI Train Bot <email address hidden> Thu, 25 Jun 2015 04:37:52 +0000

Changed in ubuntu-ui-toolkit (Ubuntu):
status: Fix Committed → Fix Released
Bill Filler (bfiller)
Changed in canonical-devices-system-image:
milestone: none → ww34-2015
assignee: nobody → Zoltan Balogh (bzoltan)
importance: Undecided → High
Bill Filler (bfiller)
Changed in canonical-devices-system-image:
status: New → Fix Committed
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
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

Remote bug watches

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