Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML - ListModel

QML - ListModel

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 4 Posters 4.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FlyingFish
    wrote on last edited by
    #1

    Hi! I've been trying to use mouseArea in ListElement and have been failing miserably. Is it even possible? Thanks!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sfjam
      wrote on last edited by
      #2

      as far as i know,it cann't define mouse event in ListElevent!

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Chuck Gao
        wrote on last edited by
        #3

        Try to use it with your view delegate

        Chuck

        1 Reply Last reply
        0
        • F Offline
          F Offline
          FlyingFish
          wrote on last edited by
          #4

          I can't do it. I think I'm doing it wrong. :(

          1 Reply Last reply
          0
          • T Offline
            T Offline
            thisisbhaskar
            wrote on last edited by
            #5

            You can not have a MouseArea inside your ListElement. The only way you should do it is inside the delegate item.

            When you say you can not do it..

            1. You can not add MouseArea inside ListElement ??? or
            2. You can not add MouseArea inside your delegate???
            1 Reply Last reply
            0
            • F Offline
              F Offline
              FlyingFish
              wrote on last edited by
              #6

              [quote author="Vijay Bhaska Reddy" date="1309622310"]You can not have a MouseArea inside your ListElement. The only way you should do it is inside the delegate item.[/quote]

              Can you give me an example? :D

              1 Reply Last reply
              0
              • T Offline
                T Offline
                thisisbhaskar
                wrote on last edited by
                #7

                @ import QtQuick 1.0

                ListModel {
                id: myListModel
                ListElement {
                name: "Bill Smith"
                number: "555 3264"
                }
                ListElement {
                name: "John Brown"
                number: "555 8426"
                }
                ListElement {
                name: "Sam Wise"
                number: "555 0473"
                }
                }

                import QtQuick 1.0

                ListView {
                width: 180; height: 200

                 model: myListModel
                 delegate: Text {
                     text: name + ": " + number
                     MouseArea {
                     /// add your mouse area code here...
                     }
                 }
                

                @

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  FlyingFish
                  wrote on last edited by
                  #8

                  [quote author="Vijay Bhaska Reddy" date="1309622586"]@ import QtQuick 1.0

                  ListModel {
                  id: myListModel
                  ListElement {
                  name: "Bill Smith"
                  number: "555 3264"
                  }
                  ListElement {
                  name: "John Brown"
                  number: "555 8426"
                  }
                  ListElement {
                  name: "Sam Wise"
                  number: "555 0473"
                  }
                  }

                  import QtQuick 1.0

                  ListView {
                  width: 180; height: 200

                   model: myListModel
                   delegate: Text {
                       text: name + ": " + number
                       MouseArea {
                       /// add your mouse area code here...
                       }
                   }
                  

                  @

                  [/quote]

                  Damn, I still can't get it .

                  I even tried editing this http://projects.developer.nokia.com/QMLTemplates/wiki/WikiStart#accordionlist I need to study more I guess. :(

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved