Results 1 to 6 of 6

Thread: I can't assign TableView signals...

  1. #1
    Join Date
    Jan 2006
    Location
    Poznań, Poland
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy I can't assign TableView signals...

    Hi!
    I am trying to tie a signal to a slot in another thread, but in vain. The code compiles with no errors, but I get the message "entered signal error" and the link doesn't work. Could anyone help?
    Creating the thread and assigning the signal to the slot:
    Qt Code:
    1. fetchThread = new FetchThread;
    2. model = new FeedModel;
    3. bool result;
    4. tableView->setModel(model);
    5. emit log("Jest model");
    6. [B] result = connect(tableView, SIGNAL(activated(const QModelIndex&)),
    7. fetchThread, SLOT(update(const QModelIndex&)));
    8. if (!result) {
    9. emit log("entered signal error");
    10. }
    11. [/B] fetchThread->setModel(model);
    12. fetchThread->start();
    To copy to clipboard, switch view to plain text mode 
    The update slot:
    Qt Code:
    1. void FetchThread::update(QModelIndex &index)
    2. {
    3. log("Updating element: " + QString::number(index.row()) + ":" + QString::number(index.column()));
    4. QString str = index.data(Qt::DisplayRole).toString();
    5. model->setData(index, str+ "!");
    6. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I can't assign TableView signals...

    Does your program output anything to the console (on windows you will have to add "CONFIG += console" to your .pro file)?

  3. #3
    Join Date
    Jan 2006
    Location
    Poznań, Poland
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I can't assign TableView signals...

    I turned on the console and it doesn't show anything.
    log(QString) is my signal assigned with a slot in the main window showing some text in a textbrowser.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I can't assign TableView signals...

    Quote Originally Posted by tomek
    I turned on the console and it doesn't show anything.
    Do you compile your program in debug mode ("CONFIG += debug")? If there is some problem with connection, Qt should write information on the console about it.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: I can't assign TableView signals...

    Looks like those two signatures don't match:

    Qt Code:
    1. SLOT(update(const QModelIndex&)));
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void FetchThread::update(QModelIndex &index)
    To copy to clipboard, switch view to plain text mode 

    Note the lack of the "const" modifier in the second signature.

  6. #6
    Join Date
    Jan 2006
    Location
    Poznań, Poland
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Smile Re: I can't assign TableView signals...

    Thank you! I created the debug libraries now and found my error. It dealed with types, indeed.
    Regards!

Similar Threads

  1. Signals are delayed on X11?
    By Cruz in forum Qt Programming
    Replies: 13
    Last Post: 18th February 2009, 12:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.