Results 1 to 20 of 22

Thread: Object::connect: No such slot MainWindowImpl::rowClicked(QModelindex)

Hybrid View

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

    Default Re: Object::connect: No such slot MainWindowImpl::rowClicked(QModelindex)

    Quote Originally Posted by JeanC View Post
    What I think you mean is that you somehow get a pointer from the table to an instance of QItemSelectionModel?
    Then what do you do with that pointer, can it be used to create a signal/slot to connect() to a callback?
    You already know what to do (see post #15), just make sure you invoke selectionModel() after you have set the model (otherwise it will return a null pointer).

  2. #2
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Thanks
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Object::connect: No such slot MainWindowImpl::rowClicked(QModelindex)

    Still don't get it.
    I understand I have to call table->setSelectionModel(); table is the QTableView
    But where is the damn QItemSelectionModel that goes in there?

    No I'm not frustrated, just a bit sad.

    Quote Originally Posted by jacek View Post
    You already know what to do (see post #15), just make sure you invoke selectionModel() after you have set the model (otherwise it will return a null pointer).

  3. #3
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Thanks
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Object::connect: No such slot MainWindowImpl::rowClicked(QModelindex)

    I have
    connect(table->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(changed(QModelIndex,QModelIndex)));

    and

    QItemSelection *selection = new QItemSelectionModel(model);
    table->setSelectionModel(selection);

    But the event does nothing. Still the null pointer.

  4. #4
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Thanks
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Object::connect: No such slot MainWindowImpl::rowClicked(QModelindex)

    Got it working.
    The connect() should come after selection is created.

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

    Default Re: Object::connect: No such slot MainWindowImpl::rowClicked(QModelindex)

    Quote Originally Posted by JeanC View Post
    But where is the damn QItemSelectionModel that goes in there?
    QTableView will create one as soon as you assign a model to it with QTableView::setModel(). Therefore you have to create the connection after a call to setModel().

Similar Threads

  1. How to declare SLOT as a parameter to member function?
    By QPlace in forum Qt Programming
    Replies: 2
    Last Post: 17th July 2018, 00:41
  2. Replies: 2
    Last Post: 8th October 2007, 15:02
  3. Signal / Slot with specific argument and threads
    By tpf80 in forum Qt Programming
    Replies: 3
    Last Post: 14th September 2007, 23:43
  4. Example HowTo create custom view
    By dexjam in forum Newbie
    Replies: 6
    Last Post: 12th July 2006, 11:06
  5. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18:52

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
  •  
Qt is a trademark of The Qt Company.