Results 1 to 5 of 5

Thread: best way to manage forms?

  1. #1
    Join Date
    Oct 2007
    Posts
    65
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question best way to manage forms?

    Hello,
    i have been reading about qdatawidgetmapper and qsqltablemodel or qsqltablerelationalmodel but i am not sure any combination of them can fills my needs or if i could do in a better way.

    For an example form that i would need to manage i have a customer table and an address table (because for every customer they can have > 1 addresses) so in the same form i would like to edit all the possible data of the customer.

    I would like to do without using tables for the fields (well to select the address to edit i can use a table but only to populate the data in the correct widgets), QSqlTableModel or QSqlRelationalTableModel dont seems to fit very well in this scenario, am i supposed to create two different QSqlTableModel and other two different QDataWidgetMapper (one for every table implicated)?, and if i want to select the customer searching for it how could i do?, setting a filter in the two models? i am not interested in next or previous buttons and qdatawidgetmapper seems to be all about them.

    It is this the best way to create database forms with qt? I am using PyQt now, i have been thinking about use SQLAlchemy to do this but i would like to go only with qt if it is possible because in the future maybe i will port the application to c++

    Sorry if anything is not clear, my english is not very good
    Last edited by skuda; 27th January 2009 at 22:55.

  2. #2
    Join Date
    Oct 2007
    Posts
    65
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: best way to manage forms?

    please anyone can give me any insights on this?

  3. #3
    Join Date
    Mar 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: best way to manage forms?

    hi,


    i've the same reflexion betwin QtSql module and sqlAlchemy

    could you same me your choise, and if possible, your reason ( objective or subjective ) ??


    thx


    Kermit

  4. #4
    Join Date
    Oct 2007
    Posts
    65
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: best way to manage forms?

    Hi,
    i finally created a configurable sql model where you can use complex queries (with joins for example), define to what table belongs every column and later start doing changes (in a tableview or in widgets connected with qdatawidgetmapper to the same model) and in submit the model create and execute the correct update or insert query to the changes (changes to the data are in an internal cache for the model).

    For populate the data of qdatawidgetmapper i use a select with the correct primary key (although i let use the arrows to change between i get the value of the next value and load directly) because i have any tables really large and do the initial load was memory and time intensive.

    Regards,
    Miguel Angel.

  5. #5
    Join Date
    Mar 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Smile Re: best way to manage forms?

    hi,

    thank you for your answer

    in fact, between my post and your answer, i've decide to create a custom model ( with the help of QSqlRelationalTableModel c++ source code)

    your answer confort my decision

    thx

    Kermit

Similar Threads

  1. Filling forms with QWebKit
    By physicistjedi in forum Qt Programming
    Replies: 1
    Last Post: 4th December 2008, 18:50
  2. using functions in different forms
    By vishnu5 in forum General Programming
    Replies: 1
    Last Post: 4th February 2008, 19:37
  3. Custom shaped forms and controls
    By AlbertGoodwill in forum Qt Programming
    Replies: 1
    Last Post: 19th October 2007, 06:35
  4. pass variables between 2 forms
    By restiz in forum Qt Programming
    Replies: 7
    Last Post: 17th June 2006, 16:13
  5. How to toggle between 2 forms
    By safknw in forum Qt Programming
    Replies: 2
    Last Post: 13th May 2006, 10:34

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.