Save object to a file
-
saveFilm is not a member of FilmInput.
Besides that, please, got through the examples and the documentation of Qt, that would be beneficial to you.
I don't want to sound rude but what you wrote here will not do for an assignment.
Why does Film inherit QWidget ?
Why does FilmWriter inherit Film if it's only function is to write a Film given as a parameter ?
Why do you use a UI file if you create your interface by hand anyway ? -
I thought that FilmWriter would need to inherit Film in order to create an object of type Film. Film inheriting QWidget is a mistake as it is left over from the question which was one class called film inheriting QWidget which I have to break up into 3 classes and then add functionality. Also the UI file was created automatically for me with Qt creator. I will look up some info on interfaces. So the question is to have the saveFilm function in the filmWriter class, how do I get it to work like that rather than making saveFilm a member of FilmInput and removing the FilmWriter class?
-
No it doesn't, as long as it knows how to use Film.
For the rest it's essentially doc reading
-
if I take out #include "Film.h" in FilmWriter there is a problem with the FilmWriter class, if I then take out : public Film there is a problem with the func saveFilm because it's parameter is of type Film. So how do I make it know how to use Film?
-
This is C/C++ basic knowledge. Without the header file how would your class know anything about Film ?
What problem would it be ?
-
well it wouldn't know about Film without the header file. Are you saying that it doesn't need to be a child of Film but just include the header?
-
Yes, it's exactly what I'm saying
-
Ok great. But now after the changes I am still getting the same error :-?
:: error: collect2: ld returned 1 exit status -
If you are talking about the saveFilm problem and the message didn't changed, then saveFilm is still not a member of FilmInput.
Isn't it a member of FilmWriter ?
-
Yes and I don't want it to be a member of FilmInput, I want it to be member of FilmWriter only and somehow (I don't know how) be called in FilmInput. I thought if I included the FilmWriter header it would work, but obviously I must do something else.
-
FilmWriter is a class, how do you call a function from a class ?
-
You create an object and call the function with the object. That's it! Ok so now you have helped me to get rid of that error, thanks a lot. Another question, when I click on the save film button which invokes saveFilm the program crashes, should I start a new thread because this is a new question or can you still help me on this one?
-
Run your application through the debugger, it will tell you where the crash occurs
-
I got this: The inferior stopped because it received a signal from the operating system
signal name: SIGSEGV
Signal meaning: Segmentation fault
then it is pointing to line 2185 in qglobal.h
inline QFlags operator&(Enum f) const { QFlags g; g.i = i & f; return g; } -
What does the stack trace look like ?
The lines under qglobal.h ? -
I have a print screen, how do I post a pic on here?
-
You have to use a picture hosting service or a public dropbox folder etc...
-
-
https://www.dropbox.com/s/mosnz8o23elipn5/Qtstack.jpg
doesn't work with a space in the name
-
Looks strange... Just to be on the safe side, delete the build directory completely and re-run your application.
17/37