PDA

View Full Version : Database Widgets - problem



psad
22nd July 2012, 11:44
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).

high_flyer
25th July 2012, 12:04
So what is your question?
Is it how to use signals and slots?