Results 1 to 2 of 2

Thread: Autoupdate QTableView

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Lightbulb Autoupdate QTableView

    How can I manage to somehow autoupdate a QTableView that returns data from a MySQL Table trough a QSqlQueryModel.
    I add the data into the database from two QlineEdit.

    Qt Code:
    1. //casuta dreapta jos
    2. QLabel *added_table_label = new QLabel(tr("Lista websiteuri"));
    3. QTableView *added_sites = new QTableView;
    4. QSqlQueryModel *inputlista = db.show_table_sites();
    5. added_sites->setFixedWidth(500);
    6. added_sites->setModel(inputlista);
    7. added_sites->setColumnWidth(0,245);
    8. added_sites->setColumnWidth(1,245);
    9. added_sites->show();
    10. QVBoxLayout *lista_websiteuri = new QVBoxLayout;
    11. lista_websiteuri->addWidget(added_table_label);
    12. lista_websiteuri->addWidget(added_sites);
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void window::addsite()
    2. {
    3. web_address = this->website_add->text();
    4. email_address = this->email_add->text();
    5. string adresaw=web_address.toStdString();
    6. const char *argument_site=adresaw.c_str();
    7. string adresae=email_address.toStdString();
    8. const char *argument_email=adresae.c_str();
    9. db.addtolist(contorsite, argument_site, argument_email);
    10. website_add->clear();
    11. email_add->clear();
    12. contorsite++;
    13. }
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

Similar Threads

  1. Replies: 2
    Last Post: 26th November 2009, 04:45
  2. QTableView
    By jamesjara in forum Newbie
    Replies: 5
    Last Post: 26th June 2009, 06:37
  3. Replies: 0
    Last Post: 20th January 2009, 02:37
  4. QTableView
    By dragon in forum Qt Programming
    Replies: 0
    Last Post: 22nd September 2008, 16:53
  5. Filter Proxy Model to Autoupdate View
    By Big Duck in forum Qt Programming
    Replies: 1
    Last Post: 1st June 2006, 20:32

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.