Results 1 to 4 of 4

Thread: QSqlQueryModel edit table & direct query to the database

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Apr 2009
    Posts
    75
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSqlQueryModel edit table & direct query to the database

    Thanks!
    That what I'm saing!


    Allmost

    I'ld like to excecute any query, so I've:
    Qt Code:
    1. model = new EditableSqlModel;
    2. model->setQuery("SELECT ID_t, ID_podmiot, ID_oddzial, Numer, Numer_zleceniodawcy FROM m_transporty LIMIT 0 , 30");
    To copy to clipboard, switch view to plain text mode 
    but in example there is:

    Qt Code:
    1. void EditableSqlModel::refresh()
    2. {
    3. setQuery("select * from person");
    4. setHeaderData(0, Qt::Horizontal, QObject::tr("ID"));
    5. setHeaderData(1, Qt::Horizontal, QObject::tr("First name"));
    6. setHeaderData(2, Qt::Horizontal, QObject::tr("Last name"));
    7. }
    To copy to clipboard, switch view to plain text mode 

    I'd like to change query in setQuery automatyicly. I've tried use to
    Qt Code:
    1. setQuery(this->query().executedQuery());
    To copy to clipboard, switch view to plain text mode 
    but it's empty
    Last edited by TomASS; 2nd October 2011 at 14:02.

Similar Threads

  1. Edit table for my own table-widget
    By MasterMatrix in forum Qt Programming
    Replies: 0
    Last Post: 1st December 2010, 07:05
  2. Replies: 5
    Last Post: 3rd April 2010, 04:07
  3. QSqlite database lock + Delegate + QSqlQueryModel
    By NoRulez in forum Qt Programming
    Replies: 0
    Last Post: 13th October 2009, 11:52
  4. Replies: 1
    Last Post: 26th March 2009, 15:25
  5. View/edit database in a table and in a form
    By igorko in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2006, 09:09

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.