[solved] Connect from a QListView doesn't work



  • Hi,

    I have the following line of code:
    @
    connect(qListView, SIGNAL(clicked()), controller, SLOT(updateActivity()));
    @

    My class controller contains a function updateActivity() en het controller.h file contains the function in the public slot. But still this doesn't work.
    I get the errormessage:
    Object::connect: No such signal QListView::clicked(QListViewItem *) in ....

    Any1 got an idea?

    Thanks in advance


  • Moderators

    Is your connect statement show above complete as you have it in your code?



  • I think so, got some other connect statements defined in the same way and those doesn't give any errors.



  • QListView doesn't have QListViewItems. QListWidget does have QListWidgetItems though. You should monitor the selection (QListView::selectionModel()), to achieve what you want.


  • Moderators

    your error message sais that you are trying to connect to another signal
    [quote author="ebruurs" date="1305713275"]
    Object::connect: No such signal QListView::clicked(QListViewItem *) in ....
    [/quote]

    that would mean that you have a statement:
    @
    connect(qListView, SIGNAL(clicked(QListViewItem *)), controller, SLOT(updateActivity(QListViewItem *)));
    @

    in your code.



  • [quote author="ebruurs" date="1305713275"]Hi,
    I get the errormessage:
    Object::connect: No such signal QListView::clicked(QListViewItem *) in ....
    [/quote]

    QListView has not signal clicked()
    try next:
    @connect(qListView, SIGNAL(clicked(const QModelIndex&)), controller, SLOT(updateActivity()));@



  • Thank you all for your replies. The const QModelIndex& solution worked well for me.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.