[solved] from new_project/ui_new_project ==to=> edit_project. (same Ui, same code, but little bit different)
-
here is a little code exemple:
http://pastebin.com/EU8iEYZSis it possible to go from a "new_project" class include a QDialog from Ui (create by QtDesigner) to create a "edit_project" ?
Considerations are:
the edit_project has to use the exactly same Dailog windows (plurial because from it, i call some other dialogs), and the same code, but modify the code for not create a new "project", but edit one who exist allready.My code comil, run, the window open... but i have some troubles.
I think this is not a good qay to do because of some troubles...
bu how to do it well ?My new_project contain some treeviews, combobox, editline, textEdit, checkbox, and call other dialogs... also have some specifique model for views... some specifique class for object create inside, some specifique treeView promoted, etc...
When i open it (edit_project), the dialog open well... but when i clic on button for call an other dialog to open, 2 dialogs open instead of only 1... when i close it, the application crash.I search for ideas around it and not have to re-write again all the code instead of use this one exist allready.
-
Hi,
Not a direct answer but aren't you describing a QWizard ?
-
Idon't know SGaist... but i'm interested to know that... i will go for a look about QWizard (and i'm curious too...).
OK, i find for do what i would like a solution. In fact it is only C++ lake of knowledge from myself.
Just learn how to inherit class properly and override member functions... (declaration, use of virtual, override, etc...). I had some error because i do it wrong... i create a new Ui::edit_project instead of se the super class new_project. so when i used the sub class edit_project, this one call 2 times the ui... also, the solution is not to create a condition in the constructore of the super class, but directly and simply use the ui of the super class from the sub class, without create an other one.My question would be (maybe) clearer if i ask for "how to inherit a class contain a QDialog object and Ui created by QtDesigner".
Also, in the inherit class, i no have to create a new Ui, just use this from the new_project "super" class from the edit "sub" class directly.
In fact, it is really simple.I do it because i have a "new_project" Dialog Box with many entries who create a new project in my application (and some other: new location, new structure, etc...) and i don't want to rewrite an other one class and Ui for just use the same code... also, create a condition inside it for new or edit context seems to be heavy too... so i use inherit now and this works just fine and make me win time and clarity in my code.
So, now i know this is possible and easy to do it. thanks SGaist.
-
You're welcome !
Since it's all clear now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)