Results 1 to 2 of 2

Thread: Database Widgets - problem

  1. #1
    Join Date
    Jul 2012
    Posts
    1

    Default Database Widgets - problem

    I have problem with coding database controls (viz. widgets), which enables to make simple database applications without writing the code (viz. putting controls on QtDesigner's form and appropriately connecting them via signals and slots and appropriately filling their properties in - it will give the working database application). I am going to make three exemplary applications with my widgets :
    1. three QLineEdits for name, surname and id from table Person and "next" and "previous" buttons - viz. browsing the consecutive and preceding records of the table;
    2. displaying the whole table Person;
    3. three QLineEdits for name, surname and id from table Person and "next" and "previous" buttons - viz. browsing the consecutive and preceding records of the table and also displaying from different table (or the same) - another date connected with this record -> also in QLineEdits.

    I am in the course of writing two such controls :
    1. QDatabase - it has driver property (choice : SQLITE or MYSQL), database (the name of the database or its path), host, user, password;
    2. QDatabaseModel - it has model property (choice : QSqlQueryModel, QSqlTableModel, QSqlRelationalTableModel) and table (the name of the table);

    I. The controls are done in one project robiÄ™ (viz. "Other Project->Qt Custom Designer Widget" - viz. treated as the plugins);
    II. from the beginning I am trying to realise the second exemplary scenario of database application - viz. putting QDatabase and QDatabaseModel on the form and connecting them with signals and slots and filling their properties in. And here I have the problem - how to do it so that they will communicate with each other - viz. QDatabase sends data about database to QDatabaseModel and QDatabaseModel displays the table. I have read somewhere in the Internet that it must works as Model/view concept (viz. the widgets are the views, so it is needed one class working as the model, from which the controls take the data).
    Attached Files Attached Files
    Last edited by psad; 22nd July 2012 at 13:27.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Database Widgets - problem

    So what is your question?
    Is it how to use signals and slots?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 0
    Last Post: 30th April 2012, 15:17
  2. Replies: 2
    Last Post: 30th March 2011, 20:20
  3. [SOLVED] database opened .. database not open
    By kapitanluffy in forum Qt Programming
    Replies: 1
    Last Post: 27th February 2011, 10:39
  4. Replies: 2
    Last Post: 16th December 2010, 11:52
  5. Replies: 5
    Last Post: 18th April 2010, 23:31

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.