0

I'm making an app and I have a listview, and I want there is a button that when pressed, make a triggered a random item listview, to the second page I have this button, but it does not work

Button{
                                                 text:qsTr("Random")

                                                 onClicked: {
                                                     size = groupDataModel.size();
                                                     rand = Math.ceil(Math.random()*size); //can also use randInt(0, size);
                                                     listview.triggered(rand);
                                                }

                                             }//Boton Random

Here's the full code http://paste2.org/eea0IkjC

thanks

Marc Plano-Lesay
  • 6,808
  • 10
  • 44
  • 75
skyfrox
  • 3
  • 2

1 Answers1

0

triggered is the name of the C++ signal. You should call listview.onTriggered(rand); if you want your onTriggered slot called. However, I'm not sure it's expecting an integer.

Marc Plano-Lesay
  • 6,808
  • 10
  • 44
  • 75