Results 1 to 4 of 4

Thread: Custom SQL in QSqlTableModel/QTableView

  1. #1
    Join Date
    Jan 2008
    Location
    Brasil
    Posts
    131
    Thanks
    18
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Lightbulb Custom SQL in QSqlTableModel/QTableView

    Good day, lords of the QT's!

    I'm using QSqlTableModel and QTableView, I wonder: this is the best way whether custom the SQL, making select between two or more tables? Can use submitAll? I think not, what can I do?

    Thanks,

    Marcelo E. Geyer

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Custom SQL in QSqlTableModel/QTableView

    Use QSqlQueryModel or QSqlRelationalTableModel if the main table contains foreign keys to other tables and you simply want to subsitute them with a column from a related table.

    Note that QSqlQueryModel is a read-only model.

  3. #3
    Join Date
    Jan 2008
    Location
    Brasil
    Posts
    131
    Thanks
    18
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom SQL in QSqlTableModel/QTableView

    Sure, QSqlQueryModel can not use because I will need to change the information. I still I have a QSpinBox (not delegate), which put the value in a certain field. Any suggestions?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Custom SQL in QSqlTableModel/QTableView

    Have a look at QDataWidgetMapper.

Similar Threads

  1. Custom widget
    By zorro68 in forum Qt Programming
    Replies: 7
    Last Post: 28th January 2008, 14:06
  2. Custom proxy model issue
    By Khal Drogo in forum Qt Programming
    Replies: 13
    Last Post: 30th November 2007, 12:41
  3. custom plug-in widget in another custom plug-in widget.
    By MrGarbage in forum Qt Programming
    Replies: 6
    Last Post: 27th August 2007, 15:38
  4. Replies: 1
    Last Post: 5th March 2007, 20:50
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.