Newbie at Qt looking for some advice



  • Hi everyone,

    I have started using Qt and C++ quite recently in order to complete my project for my final year of computing at college. As I am new, I am a bit unsure on what I can do, cant do and sometimes how to do it.

    I am using Qt creator and, at the moment, SQLite Manager as I need to use a database in my project but don't have MS access.

    I don't have any examples, but I was wondering if anyone may be able to answer some of my questions, or could show me where to go in order to find the answers I need.

    Any help with either SQLite or Qt would be very much appreciated!

    Thanks very much!



  • @joeshmo
    I am also a newbie, and working with qt around three weeks. I am following tutorials on youtube!



  • @asif_cse cool, any chance you could suggest which ones?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    For Qt + SQLite, you can take a look at Qt's documentation, examples and demos more specifically the Qt Sql module and the SQL Programming chapter. You already have there a valuable source of information to get started.

    For other questions, you should be more specific e.g. what's your project purpose, your application purpose etc.



  • For a more powerful database consider PostgreSQL or MySQL, both are free and Qt have drivers for both. For simple databases SQLite is good enough.

    I recently stumbled upon this youtube channel, perhaps you will find some useful tutorials there.



  • @TheBadger
    Thanks, I've found the same channel and think he's pretty good.

    Thanks for the recommendations, I'll check them out.
    I would like to link tables in relationships (1 to many etc) like in access, are the 2 you suggested able to do this?



  • @joeshmo said:

    I would like to link tables in relationships (1 to many etc) like in access

    Both are relational databases so if I understand your requirement correctly then yes both should be able to work.

    I prefer PostgreSQL but only because I have much more experience with it.

    I do not have experience with access (at least can't remember anything about access)


  • Moderators

    If you don't need a centralized database server I would suggest to use SQLite as it is much easier to use (no need to set up a database server).



  • @SGaist Thanks for the link, will check it out!

    In terms of being mroe specific I would like to be able to have a database with tables linked in 1 to many. From this, in Qt, I would like to be able to create records of the many database tied to the information in the 1 database.

    If this is clearer, is this something I can realistically achieve?


  • Qt Champions 2016

    @joeshmo said:
    Hi Could you try to tell a bit about what project is
    and what the info represent and how info will be
    tied to other info?

    While creating links between different tables in same DB, is easy,
    creating links between different tables in different databases are pretty advanced and
    I do wonder what you are trying to do.

    So if you forget a moment about databases and tell us that project is about and what it will do, then you are much more likely to get real good advice from all the clever people here :)



  • Hi @mrjj , thanks for offering to help!

    My project is to create a program that will allow the heads of faculty to easier write reviews for the members of staff they supervise (usually 8 members of staff). The reviews are Quality Assurance and lesson observations (I can just work on 1 for the time being, and add the other if it works well and I have time). I am making this so that the reviews can be easily written, viewed and edited in the same program so they cannot get lost.

    Both the reviews are usually written on a template printed off which has fields that need filling in to make sure the review covers what the school want it to.

    (I will only talk about the observation review, as I can focus on the other after I have this one completed)

    So far I have thought that having a table with the fields needed to be filled in for each lesson observation such as focus of the lesson, evidence of this context etc.

    Over all, heads of faculty can add, edit, remove or select members of staff from the program and then write reviews (observation or QA) for the member of staff following the template that I will implement into the GUI (labels, etc). The reviews will then be able to be opened later and edited or just to be viewed from the same program. The program should also be able to show information about each member of staff the head of faculty supervises such as teacher code, name etc.

    Hope this makes sense, I am more than happy to clear up any confusion as to specific parts, or talk about how the database may work, as I wrote this quite quickly!

    Thanks very much!


  • Qt Champions 2016

    hi, its pretty good description.
    One important question is.
    Will more than one "head" make reviews at the same time ?
    That is - multiple copies of the program run on different computers and access and change that
    data at the same time?
    If yes, you (might) need a database server.

    How good are you with SQL ? (if I may ask)



  • Hi,

    The was I was planning it is that it would be 1 "head" per computer. This means the program will not be pre-made, as such, with any information in it and the "head" will fill in the information for the members of staff they supervise the first time they open the program. Because of this, each head will have a the same program on their computer but they will not share data and will each be filled in with different members of staff's information.

    In the class we briefly touched on some SQL , probably very basic stuff, so I'm quite new to that as well. I made notes on it, and I'm sure there will be some tutorials out there somewhere I can use but I wouldn't say I'm confident.

    As an extra, I finally got my head around why I would like the tables to be linked relationally:
    1 member of staff record (parent) will be linked to all observation/QA records on separate (child) tables that involve them so. This hopefully makes sense, but we can cross that bridge in a bit.

    I really appreciate your willing to help me, as I am at quite a confused loss!


  • Lifetime Qt Champion

    Doing so you are going to run into data duplication (e.g. multiple copies of the same user with all the problems that come with entering the same names multiple times) and also problem of synchronization, retrieval of data etc.

    Even if it's not the easiest path, you should consider the use of a SQL server (PostgreSQL, MySQL or MariaDB) It's not overly complicated to setup though.

    If you have one at hand, you should talk with a DB admin, he can help you get the database schema correctly.



  • @SGaist Thanks for the suggestions.

    My program will not have Head of faculty information stored, so will only be teacher information and observation records. Because of this, I hopefully will result in 1 user per instance of the program and (if I understand your previous comment correctly, sorry if I didn't) then does not have any of the problems you mentioned.

    I'm starting to understand what I will need to do for the project, but I'm still not confident.

    I would like to make a start and see where it gets me so I will use ms access instead of SQLite manager, but cannot find how to link Qt to the access database. I keep hearing about the ODBC driver, but that means nothing to me. Any chance you know a good explanation for this you could send me?

    Thanks very much!


  • Qt Champions 2016

    Hi.
    If you are really really sure the heads do not expect to share staff info and
    the project is a personal tool for each and no reports is shared then you can
    make it a single user app. but beware of all what @SGaist mentions as you will get
    these problems if the heads try to share any of the data.

    Before digging into what data base to use. May I suggest you write up all
    information you wish to record. spend some time thinking about what you need to store.
    write it all up. You are going to need this a lot for creating the database. so
    don't start coding before you have full list of what data.

    ODBC driver.
    This is a common driver that give the same set of functions to talk to a database system.
    Normally, each system has its on functions. BUt if it support ODBC, it means its
    able to be handled the same regardless of the actual database.
    https://en.wikipedia.org/wiki/Open_Database_Connectivity

    Last time i used ACCESS database, it was very slow over network.

    So find out if you want single user or multiuser.
    then choose DB system.
    Most likely the heads expects to share staff info.
    So multi user. and u need something like PostgreSQL



  • @mrjj That makes a lot of sense, thanks :)

    Is it possible for the data to be printed, ie the whole gui page showing the reviews to be printed?

    If not, then I will probably look into the PostgreSQL and making the program multi user

    In regards to the information I want to record, I have already done that for the teacher info, Observations and QA just incase I am going to use both. Because of this, I am quite ready to start coding, but thanks for checking that I had that :)

    Any idea where I should start looking if I want to use PostgreSQL and can that link tables relationally?

    (Sorry if I'm sounding a bit obsessed with linking tables!)

    Thank you all very much!


  • Qt Champions 2016

    @joeshmo
    1: Is it possible for the data to be printed, ie the whole gui page showing the reviews to be printed?
    well yes, you can render controls to a paper page but normally you would create a pdf or
    print out the data in some other way. like a report.
    Else print will be like a screenshot. But possible.

    2: Any idea where I should start looking if I want to use PostgreSQL and can that link tables relationally?
    this is good first start
    https://forum.qt.io/topic/33926/postgresql-and-trying-to-connect-using-qt/20
    Note: version are bit older, so adjust names.
    and also
    https://www.youtube.com/watch?v=3XE2bKUAxfw

    3:(Sorry if I'm sounding a bit obsessed with linking tables!)
    Its ok. you will need that a lot.
    When you reference something from one table to another you use
    keys. that is your linking.
    http://www.tutorialspoint.com/sql/sql-foreign-key.htm

    How much time do you have for the project?



  • @mrjj I have until about easter time 2016 for the project to be completed.

    I have written work relating to the project too, so it does not need to be top of the range, just something that is easy to navigate and does what I want it to do.


  • Qt Champions 2016

    @joeshmo
    Ok. well you should have time to make it multi user if needed then.

    If the project are really going to be used multiuser,you need a pc that can act as server.

    Have you considered a web service instead of qt client application. ?
    something like
    https://www.djangoproject.com/start/overview/

    If you really need to make it a real multi user app.
    That way maintenance etc is lighter.



  • @joeshmo
    Hi , you can use ms access inside your c++ C# or whatever language projects. Microsoft gives it away I think to encourage people to use it over MySql ,Oracle and others. Recently I used ms access for my local database ,and used MySQL as a remote database running on a Linux machine .



  • @Lineaxe cool thanks!

    Could you show me where I can find out how to use ms access in c++?
    Also, if you mean Microsoft give it away free, I'm yet to find it free anywhere!

    Thanks


  • Qt Champions 2016

    @joeshmo

    You would be using ACCES via ODBC

    here they talk about that
    http://stackoverflow.com/questions/22552302/how-to-use-m-s-access-in-qt


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.