×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    5

    Get data from a TextEdit in a ListView

    Hallo there,
    I have a problem and I can't find a solution to it, I hope you to find it here: I did a ListView with its model and its delegate and so on, like this:

    Code:
    Item {
        id: creation;   width: parent.width ; height: parent.height
       .....
        ListView {
                id: mainViewLiist
                model: CreationModel {id: modelCreation}
                delegate: delegateCreation
                width: parent.width; height: parent.height;  x: -(screen.width * 1.5);
                cacheBuffer: 100;
            }
    }
    the delegate includes Text, TextEdit, etc.... something like this:

    Code:
    Component {
        id: creationDelegate
        Item {
            id: itemCreate
           ....
             Row {
                        id: rowSerie
                        spacing: 5
                        Text {
                            id: seriesLabel
                            text: "Series:"
                            ....
                        }
    
                        TextEdit {
                            id: seriesTextEdit
                            text: ""
                            ....
                          }
                   }
             .... 
           }
     ....
    }
    Inside the same Item, "creation", there is also a ToolBar with two Buttons, something like this:

    Code:
    ToolBar { id: toolBarCreation; height: 40;
            width: parent.width;
            opacity: 1.0
            button1Label: "Back"
            button2Label: "Create"
            onButton1Clicked:
            {
              ...
            }
            onButton2Clicked:
            {
                ...
            }
     }
    What I want is this: when I click on the second button, "Create", I want simply to show with console.log(arg1,...) what is written in the TextEdit called "seriesTextEdit" of every item in the listView. For example, if my listview contains 10 items and the user insert a valued in all the TexTedit of all the item, how can I access to those data?
    Thank you very much,
    Giammarco

  2. #2
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: Get data from a TextEdit in a ListView

    Hi,

    If you have mapping of the TextEdit that you have in delegate back to the model, then you can access it -

    for(var i = 0; i < myModel.count; ++i) {
    console.log(myModel.get(i).text1);
    }

    Also please see this link, though not exactly same query.

  3. #3
    Registered User
    Join Date
    Apr 2012
    Posts
    5

    Re: Get data from a TextEdit in a ListView

    Hi there and thank you for your answer,
    Yes I have thought it but how can I assign a value to text1 in my delegate TextEdit?

Similar Threads

  1. navigating listview is too slow when having lot of data
    By Rondo23 in forum [Archived] Qt Quick
    Replies: 2
    Last Post: 2011-12-13, 13:04
  2. How to access ListView current item data?
    By Sasler in forum [Archived] Qt Quick
    Replies: 1
    Last Post: 2011-11-03, 15:11
  3. ListView inside ListView
    By hassan kassem in forum [Archived] Qt Quick
    Replies: 2
    Last Post: 2011-10-20, 10:53
  4. how to get listview data from another qml page
    By web_tur in forum Nokia N9
    Replies: 5
    Last Post: 2011-09-14, 19:05
  5. QSyntaxHighlighter on a TextEdit
    By gravity0 in forum Qt
    Replies: 2
    Last Post: 2010-09-07, 12:17

Posting Permissions

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