Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] from new_project/ui_new_project ==to=> edit_project. (same Ui, same code, but little bit different)
Forum Updated to NodeBB v4.3 + New Features

[solved] from new_project/ui_new_project ==to=> edit_project. (same Ui, same code, but little bit different)

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jerome_isAviableJ Offline
    jerome_isAviableJ Offline
    jerome_isAviable
    wrote on last edited by
    #1

    here is a little code exemple:
    http://pastebin.com/EU8iEYZS

    is 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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Not a direct answer but aren't you describing a QWizard ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • jerome_isAviableJ Offline
        jerome_isAviableJ Offline
        jerome_isAviable
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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 :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved