Creating UML Diagrams of a Qt application



  • Hi!

    I'm looking for some tool to create class diagrams of qt applications. I tried various software like MS Visio, which i quite liked bcs of the "easy" GUI with not that much of unneeded features and stuff. But all of those tools where missing a nice and easy way to apply Qt elements in it - like data types as eg. QString and so on.

    Anyone here has experience with creating UML diagrams for Qt apps?


  • Moderators

    I used "Umbrello":http://uml.sourceforge.net/ a few times. It can even import C++ headers defining classes. Unfortunately it was a bit on the crashy side and I had to make sure to save regularly:-)



  • I'm looking for the same tool.
    It will be nice add to QtCreator.
    Actually there are lot of things missing in QTCreator like:

    autocomplete of parent class in the dialogue to create new class

    add the implementation for many functions in one click

    changing one parameter name relflects immediately on the header file or cpp file it will be nice to implement

    But the performance is still awesome.



  • [quote author="maherali" date="1316456224"]autocomplete of parent class in the dialogue to create new class[/quote]
    We do have this, don't we?
    [quote author="maherali" date="1316456224"]add the implementation for many functions in one click[/quote]
    Hmm... what?
    [quote author="maherali" date="1316456224"]changing one parameter name relflects immediately on the header file or cpp file it will be nice to implement[/quote]
    Qt Creator does already support refactoring. Just right-click on a class or variable and select 'Refactoring'.



  • bq. We do have this, don’t we?

    when adding a new class using Add new item ... you will enter the class name, but when choosing the Base class, I want to choose QAbstractItemDelegate, it will be nice to autocomplete this, there is autocompletion for QObject, QWidget, QMainWindow, QDeclarativeItem (just these four)

    bq. Hmm… what?

    In header file try to write two functions f1,f2
    Try to select both functions, and refactor: oops there is no Add Implementation
    That's what I mean, it will be nice feature, usually I write the API prototype and then switch to CPP file to write the implementation, this way you will save yourself some navigations.

    bq. Qt Creator does already support refactoring

    You are right about refactoring, and CTRL+SHIFT+R but it's not practical, when you rename a variable in method prototype (in header file) you would be asked to rename the symbol in all your project, and then filter it, which is obviously not practical in most cases.
    There should be a smart behaviour: renaming the local variable, renaming the method parameter.

    Things that are very simple but will make QTCreator more productive.

    By the way when you want to override a protected event it will be nice to add the return value of the sizeHint() and just put it there to be QSize.



  • So here is what i experienced so far:

    I tried using several free, trial or open source tools for reverse/forward engineering. Non of them came even close to my expectations of a either easy to use or actually working tool for C++/Qt Code - mostly because reverse engineering for C++ is way more complicated compared to Java or C# and those free tools couldn't handle it.
    I ended up using MS Visual Studio 2010 since i got it for free via MSDNAA (lucky me). There is not that much of features or options to play with for creating diagrams from code and vice versa. I'm hardly missing export to MS Visio or at least something besides image/pdf - but at least it works as i should :)
    Comercial tools are way, way, way, waaaaaaay too expensive for personal use and for beginners impossible to understand because of the number of features and possibilities to use them.

    And my 2 cents for QtCreator: Awesome to work with, even with the lack of some "extended" features. But especially for Beginners and Semi-Pros the way to go when creating a Qt application!



  • [quote author="maherali" date="1316460461"]
    In header file try to write two functions f1,f2
    Try to select both functions, and refactor: oops there is no Add Implementation
    That's what I mean, it will be nice feature, usually I write the API prototype and then switch to CPP file to write the implementation, this way you will save yourself some navigations.
    [/quote]

    Set the cursor on the method name in the header and hit Alt-Return, Creator will then ask if a stub implementation should be added to the implementation .cpp. It does not work with selecting two methods though, but you can quickly switch back to the header using F4.



  • @Volker
    Thanks I know that, but selecting two methods or more at once is my point.



  • [quote author="Volker" date="1316467230"]Set the cursor on the method name in the header and hit Alt-Return, Creator will then ask if a stub implementation should be added to the implementation .cpp. It does not work with selecting two methods though, but you can quickly switch back to the header using F4.[/quote]

    Do you know is there such functionality for adding a simple setter / getter implementation of a member variable too?



  • [quote author="maherali" date="1316460461"]when adding a new class using Add new item ... you will enter the class name, but when choosing the Base class, I want to choose QAbstractItemDelegate, it will be nice to autocomplete this, there is autocompletion for QObject, QWidget, QMainWindow, QDeclarativeItem (just these four)[/quote]

    You can specify any base class, but for those four listed there will be additional code added (eg. the Q_OBJECT macro for QObject derived classes). But you are right - there is no auto-completion for currently known classes.


  • Moderators

    Lukas: Nope, no getter/setter support yet. Feel free to send in a merge request implementing it though:-)



  • Hi folks
    I know these are simple things but it's really what attract people to Visual Studio.


  • Moderators

    maherali: You greatly underestimate the complexity of the C++ language by calling those actions "simple things";-)



  • I know that it's not that simple because we have two files: header and cpp.
    Actually it's very pleasant to work with QTCreator.


Log in to reply
 

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