Results 1 to 7 of 7

Thread: QTableView doubleclicked event not working

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2007
    Posts
    29
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QTableView doubleclicked event not working

    I am developing this using QT4.3.1 and on a Mac OS X with intel processor.

    Let me preface by saying I have read the posts:
    http://www.qtcentre.org/forum/faq.php?faq=qt_signalslot
    as well as
    http://www.qtcentre.org/forum/f-qt-p...odel-5276.html
    and that i get no compiling errors. I have also changed the doubleclicked(QModelIndex) to doubleclicked(QModelIndex&) and doubleclicked(QModelIndex &) and still no luck.

    My end objective is to have a user double click any row or cell within a QTableView and have some action as a result. But right now it appears that the double-click event is not working.

    I have a QTableView which is working because I can set it's model and display data.

    Right now all I expect to see is a message window, but I get nothing.

    Here is my code:

    Qt Code:
    1. void Gui::showAtriumForm()
    2. {
    3. atriumForm = new QMainWindow;
    4. AtriumForm = new Ui_AtriumForm;
    5. AtriumForm->setupUi(atriumForm);
    6. atriumForm->show();
    7.  
    8. connect(AtriumForm->collectionsView, SIGNAL(doubleclicked(QModelIndex)), this, SLOT(rowDoubleClicked(QModelIndex)));
    9. }
    10.  
    11.  
    12. void Gui::rowDoubleClicked(QModelIndex indx)
    13. {
    14. QMessageBox::information(NULL, "here", "Row was double clicked");
    15. }
    To copy to clipboard, switch view to plain text mode 

    The model type sholdn't matter, correct? Here is where I set it.
    Qt Code:
    1. model->setQuery("SELECT * FROM collection AS co LEFT JOIN collectors AS c ON co.Collector_ID=c.Collector_ID");
    2. gui->AtriumForm->collectionsView->setModel(model);
    To copy to clipboard, switch view to plain text mode 


    All help is appreciated!
    Sean
    Last edited by jpn; 15th March 2009 at 10:41. Reason: missing [code] tags

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.