Results 1 to 8 of 8

Thread: selectionChanged() signal in qtableview

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2011
    Location
    India
    Posts
    22
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default selectionChanged() signal in qtableview

    I am trying to get an item from qtableview or specifically a column from the selected row when a raw selected.

    this is my code

    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    2. db.setDatabaseName("memory");
    3. if (!db.open()) {
    4. QMessageBox::critical(0, qApp->tr("Cannot open database"),
    5. qApp->tr("Unable to establish a database connection.\n"
    6. "This example needs SQLite support. Please read "
    7. "the Qt SQL driver documentation for information how "
    8. "to build it.\n\n"
    9. "Click Cancel to exit."), QMessageBox::Cancel);
    10. //return false;
    11. }
    12.  
    13. model->setTable("person");
    14. model->select();
    15. model->setHeaderData(0, Qt::Horizontal, tr("ID"));
    16. model->setHeaderData(1, Qt::Horizontal, tr("Name"));
    17. model->setHeaderData(2, Qt::Horizontal, tr("House Name"));
    18. ui->tableView->setModel(model);
    19. ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
    20. ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
    21. ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    22. ui->tableView->show();
    23. connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged()), this, SLOT(on_tableViewSelection()));
    To copy to clipboard, switch view to plain text mode 

    error shown is
    "QObject::connect: No such signal QItemSelectionModel::selectionChanged() in ../CDMS/cdms.cpp:43
    QObject::connect: (receiver name: 'CDMS')"
    Last edited by breakthecode; 18th March 2015 at 00:02.

Similar Threads

  1. Detect when the content of a cell of QTableView is changed
    By qt_developer in forum Qt Programming
    Replies: 5
    Last Post: 21st August 2021, 16:00
  2. Replies: 1
    Last Post: 29th May 2014, 05:16
  3. Value changed in a QTableView field
    By nittalope in forum Newbie
    Replies: 4
    Last Post: 12th August 2009, 09:21
  4. problem with changed() signal emitted by QGraphicsScene
    By sanjayshelke in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2009, 13:55
  5. Replies: 9
    Last Post: 23rd November 2006, 11:39

Tags for this Thread

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.