Results 1 to 5 of 5

Thread: Database Master-Detail Entry Form

  1. #1
    Join Date
    Dec 2006
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Database Master-Detail Entry Form

    HI,

    I am new to QT and is learning QT 4.2.3 in order to do Database programming using QT4

    I have read thro all the QtSql and managed to do all the following:-

    1. connect to database
    2. add, delete database from database
    3. create model on the database using QSqlTableModel and view it via QTableView
    4. Access database data using QSqlquery for validation check

    However, all the above is being done on a single table.

    I want to do master details database access such as empoyee [header] and address [details]. I know i need to use QSqlrelation, however i notice that all those still talk about single table. Can any one help me on this but showing me how to go about doing master - detail database accesss such as sales invoices screen [customer ->master ] and items sold [at details].

    Thanks in advance


    Phan Sin Tian

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Database Master-Detail Entry Form

    You need two table views, two models and a piece of code to connect them.

    Few helpful methods:

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

    Default Re: Database Master-Detail Entry Form

    Hi, Jacek,

    Thank you for your advice, do you have any sample with you so that i can see how you do it , Don mind if you can send me some sample.

    Thanks

  4. #4
    Join Date
    Dec 2006
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Database Master-Detail Entry Form

    I have also read about QDataWidgetMapper, do i need to make use of this as well for Master Detail Screen?

    Regards

    Phan Sin Tian

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Database Master-Detail Entry Form

    Quote Originally Posted by Phan Sin Tian View Post
    I have also read about QDataWidgetMapper, do i need to make use of this as well for Master Detail Screen?
    You can, but you don't have to. All depends on the way you want to display data. QDataWidgetMapper is helpful if you display a single record in a form, instead of QTableView or similar widget.

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.