PDA

View Full Version : a c++ GUI with QT



borninT
21st March 2018, 22:30
Hello there If your good at QT already than this is probably a cake-walk for you, but Im new to QT so for me it was a bit tricky. My problem is that I have an assignement due for saturday . Actually i have to create a Gui with Qt. And all i was able to do was to write the declaration of the classes. And our teacher didn't even teach us how to use Qt. I know i should do it by my own but it's a whole new programming stuff and i don't have enough time i have also a project in english, php but those two i cna handle them. So if you guys please could help me just to give me the beginning i'm not asking for a whole resolution of my assignment do here is the subject
12795.

In this link you can find what i have done so far → http://txt.do/dgf0y .

And here is what the teacher ask us to do

1. Create the corresponding classes

2. Create the necessaries .h and .cpp files

3. create the Qt's interfaces for handling the manipulation of the data

4. Save in a file all the data created in the creation of each object

5. TRansfer the content of the file in a database

All help needed and thank for your understanding.

Cruz
22nd March 2018, 10:22
Hi!

I assume that you are basically finished with task 1. and 2. A quick scroll through the page you linked shows me that your classes look okay at first glance.

To attack task 3, I think it's best if you familiarize yourself with the line edits example (http://doc.qt.io/archives/qt-5.8/qtwidgets-widgets-lineedits-example.html).
Basically, you will have to create a gui with line edits that reflect the fields of your classes, i.e. their name, age, etc. When the user has filled in the lines, he
presses a button and triggers an event in your gui that reads the contents of the lines and uses the setter functions of your classes to pour the data into your classes.

For task 4., take a look at the documentation of QDataStream (http://doc.qt.io/qt-5/qdatastream.html) and the examples given within.

I am not sure what kind of databases you are dealing with in task 5. Is it an SQL database? Qt has something (http://doc.qt.io/qt-5/sql-connecting.html) for that, too.

kbsk007
22nd March 2018, 14:11
in Youtube you will find examples how to create the files,
The sites are "Qt Tutorials for Beginners" or "QT C++ GUI Tutorial"

borninT
27th March 2018, 22:01
Hello Cruz and kbsk007 thanks for your help i will try to follow that .
And Cruz for the database, it's the one with Wamp