×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    210

    Loading SelectionListItem list model dynamically

    Well after taking a long hiatus I have decided to pick up Qt again and check out the new Qt quick!
    I am trying to use the Qt quick components to make a conversion component for an app I am working on. Here is an example of the approach I am trying to take:
    Code:
    import QtQuick 1.0
    import com.nokia.symbian 1.0
    import Qt.labs.components 1.0
    
    Rectangle {
        id: window
        width: 300
        height: 300
        color: "silver"; radius: 10
        anchors.fill: parent
        Column{
            id: box
            anchors.fill: parent
            spacing: 5
            SelectionListItem {
                id: conversionTpe
                title: "Conversion Type";
                subTitle: selectionDialog.selectedIndex >= 0
                          ? selectionDialog.model.get(selectionDialog.selectedIndex).name
                          : "Please select"
                onClicked: selectionDialog.open();
    
                SelectionDialog {
                    id:selectionDialog
                    titleText: "Type of conversion?";
                    selectedIndex: -1
    
                    model: ListModel {
                        ListElement {name: "Temperature"}
                        ListElement {name: "Distance"}
                        ListElement {name: "Angles"}
                        ListElement {name: "Area"}
                        ListElement {name: "Volume"}
                    }
                }
            }
            SelectionListItem {
                id: from
                subTitle: from1.selectedIndex >= 0
                          ? from1.model.get(from1.selectedIndex).name
                          : "Please select"
                onClicked: from1.open();
                SelectionDialog {
                    id:from1
                    titleText: "Convert from?";
                    selectedIndex: -1
                    model: ListModel {       //this list needs to be loaded based on the input of conversionTpe
                        ListElement {name: "Celcius"}
                        ListElement {name: "Farenheit"}
                        ListElement {name: "Kelvin"}
                    }
                }
            }
        }
    }
    Obviously these are 2 separate controls working independently. Can anyone steer me in the right direction on the best practice to dynamically load the second SelectionListItem with the appropriate list model for the item selected from the first component?
    There must be a way to have numerous list models that can be loaded into the SelectionListItem dynamically when needed? Like a standard Qt ComboBox widget.
    It seems like this should be quite simple, I must have a mental block... Among other things...
    I have looked through the documentation carefully as well as looked for examples and have come up with nothing that helped...
    Any help is appreciated!
    Cheers,
    Jon

  2. #2
    Registered User
    Join Date
    Sep 2011
    Location
    Moscow, Russian Federation
    Posts
    19

    Re: Loading SelectionListItem list model dynamically

    I think the link below is a good starting point for you:
    http://www.developer.nokia.com/Commu...using_ListView

Similar Threads

  1. loading the Drop Down list Dynamically
    By yanamaddinaveen in forum Symbian User Interface
    Replies: 1
    Last Post: 2011-09-23, 10:57
  2. Replies: 5
    Last Post: 2009-11-17, 16:05
  3. Replies: 4
    Last Post: 2008-11-07, 15:32
  4. How to Get Model Name dynamically?
    By abhrodeep.nag in forum Symbian
    Replies: 2
    Last Post: 2008-05-05, 09:53
  5. Loading a DLL dynamically
    By cl_bonesbb in forum Symbian
    Replies: 1
    Last Post: 2001-12-03, 20:07

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×