Bug 366418 - Config entries of type "Enum" do not work with "property alias cfg_entryName: comboBox.currentIndex"
Summary: Config entries of type "Enum" do not work with "property alias cfg_entryName:...
Status: REPORTED
Alias: None
Product: libplasma
Classification: Frameworks and Libraries
Component: libplasma (other bugs)
Version First Reported In: 5.24.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-04 18:24 UTC by Friedrich W. H. Kossebau
Modified: 2021-07-29 17:15 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Friedrich W. H. Kossebau 2016-08-04 18:24:16 UTC
When using a config entry of type Enum, e.g. like this:
--- 8< --- main.xml
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
      http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
  <kcfgfile name=""/>

  <group name="General">
    <entry name="projection" type="Enum">
        <choices>
          <choice name="Equirectangular" />
          <choice name="Mercator" />
        </choices>
        <default>Equirectangular</default>
    </entry>
  </group>

</kcfg>
--- 8< --- main.xml
then using an alias property binding like the following does not work:
--- 8< --- config.qml
    // [...]
    property alias cfg_projection: projectionComboBox.currentIndex
    // [...]
        QtControls.ComboBox {
            id: projectionComboBox
            model: [
                i18n("Equirectangular"),
                i18n("Mercator")
            ]
        }
    // [...]
--- 8< --- config.qml
Which would be nice to have, as that alias-binding just works nicely for config entries of type "int". 

Even more, as the following work-around does work, and just seems the explicit version of the alias:
--- 8< --- config.qml
    // [...]
    property int cfg_projection: plasmoid.configuration.projection
    // [...]
        QtControls.ComboBox {
            id: projectionComboBox
            model: [
                i18n("Equirectangular"),
                i18n("Mercator")
            ]
            onCurrentIndexChanged: {
                cfg_projection = currentIndex;
            }
            Component.onCompleted: {
                currentIndex = plasmoid.configuration.projection;
            }
        }
    // [...]
--- 8< --- config.qml


Reproducible: Always