[CLOSED] How does someone make sense of Qt?



  • In a recent post about the (non-) existence of UML class diagrams for QML types and Qt C++ classes, I indicated that there are 32 different TextField.qml files in the Qt 5.2.0 that I downloaded for Windows 8, ranging in size from 3KB to 21KB. After exploring further, I have no idea which TextField.qml file to use in generating diagrams for QML types, although I can "arbitrarily" select one of the 6 that inherit from FocusScope, or why there are 32 files named TextField.qml. Has anyone heard of common or shared directories?

    To make matters worse, there is no C++ class close in name to TextField and it seems that QLineEdit is the "corresponding" C++ class that one would use. Is this correct?

    In addition, there are 1070 C++ classes listed on the "All Classes":http://qt-project.org/doc/qt-5/classes.html page and 327 QML types listed on the "All QML Types":http://qt-project.org/doc/qt-5/qmltypes.html page. How does anyone get their hands around this and make sense of the "dual ladder" of C++ classes and QML types?

    Thanks.

    Steve



  • Should there be a corresponence? My limited understanding is that QML is Javascript, which is a 'prototyping' language, different from the 'inheritance' language C++.

    My experience... when I started, I looked at a class diagram for Qt. Then I learned from the documentation (which tells super and subclasses), and haven't looked at the class diagram in a long time. (I use PyQt, read C++ documentation, and don't use QML.)

    The sheer number of classes is not a bad thing. There is an adage: if your code is too complicated, add an object.



  • I think picking up Qt with never using it before, I would first look at the examples. If you already know c++, the examples are enough to help you get started. QML and QWidgets are two different technologies with their own pro's and con's.



  • I have used numerous languages over the years, including JavaScript and C++. I do not regard JavaScript as a prototyping language, especially with node.js and all of the available modules for it. JavaScript allows inheritance in a somewhat more limited sense than C++ and is more powerful and flexible in other ways.

    I am interested in using QML/JavaScript with minimal C++ since it's also a more productive way to develop software (e.g., less error prone, fewer lines of code, etc.).

    I haven't found any UML class diagrams for the Qt C++ classes or the QML types so if you know where they are, please let me know.

    Thanks.

    Steve



  • I've looked at several of the the examples, code in GitHub and Gitorious (among others), reviewed the documentation, viewed tutorials, looked at forum posts, etc. Despite all this, I'm just starting to get my arms partly around Qt after 3 months.

    Thanks.

    Steve



  • "An old thread lamenting that class diagrams are outdated.":http://www.qtcentre.org/threads/19730-Is-there-a-qt-4-5-class-pdf-out-there

    An old diagram named qt43-class-chart.pdf can be "downloaded here":http://subversion.assembla.com/svn/robot-polytech-ese/docs/_docs_software/_global/Qt/.

    I agree that QML (and Python) are easier than C++, but don't believe the marketing hype that you will be creating programs easily. Another rule-of-thumb: it takes 10,000 hours of practice to become proficient. Study other GUI frameworks. Unfortunately, some good material is only in printed books.


  • Moderators

    Hi,

    What would you like to understand through these UML diagrams (if they existed)?

    • "If I were to reimplement this QML app in C++, which classes would I use?"
    • "What are the C++ implementation details of this QML type?"
    • Something else?

    [quote]it seems that QLineEdit is the “corresponding” C++ class that one would use. Is this correct?[/quote]Correct. However, they share no implementation details whatsoever.

    That's because C++ widgets were invented >10 years ago to provide static desktop GUI components (buttons, text input fields, combo boxes, checkboxes, etc.), whereas QML was invented ~3 years ago to provide fluid, heavily-animated smartphone GUI components. TextField and other components in "Qt Quick Controls submodule":http://qt-project.org/doc/qt-5/qtquickcontrols-index.html use new QML technology to mimic traditional widgets.

    [quote]I’ve looked at several of the the examples, code in GitHub and Gitorious (among others), reviewed the documentation, viewed tutorials, looked at forum posts, etc. Despite all this, I’m just starting to get my arms partly around Qt after 3 months.[/quote]I found that I learnt fastest when I jumped into the deep and and started coding, without waiting until I fully understood all the features offered by Qt. The latter would take forever.

    Do you have a project in mind you could try to implement?



  • bootchk,

    It's nice to see that there were class diagrams for the Qt 4.3 C++ classes. Unfortunately, they are too old to be of much value and only contain class names (not attributes and methods).

    I never said it was easy to do software development. I just feel that there are advantages to using QML and JavaScript over C++.

    I don't know where your "10,000 hours of practice to become proficient" comes from, but this is roughly 5 years since there are approximately 2,000 hours in a year (~50 weeks x 40 hours/week in a light week ;-)).

    I've used (too) many GUI frameworks in multiple languages. They all have a base of assumptions and take time to understand and properly learn. Unless the goal is to use a specific framework, I find that just studying a framework is a tremendous waste of time.

    I do agree that some of the best material is in books. That's because they take time to write, are generally written by knowledgeable people and consolidate a lot of material into a (hopefully) readable form.

    Thanks.

    Steve



  • JKSH,

    The class diagram represents the static view of a system, such as an application framework or library. It's uses include visualizing, describing and documenting different aspects of a system. The class diagram shows a collection of classes, interfaces, associations, collaborations and constraints. It is one of the most widely used of the 14 UML diagrams.

    I'm interested in a QML class diagram that I can evolve as I develop apps so I will probably have to create one myself. QML types in such a diagram can be tied (e.g., by links) to Qt's QML documentation, etc. I may also create some other UML diagrams with an agile development approach and not just hack away

    I'm aware that TextEdit and QLineEdit "share no implementation details whatsoever" and have not implied that they do. Since there are over 3 times the number of C++ classes as there are QML types, there will be occassions where I will require the use of C++ functionality within QML types that I develop, such as for 3D graphics. All of the examples that I've seen so far using OpenGL in QML require writing C++ classes - which I'd like to avoid. Looking at C++ examples and documentation such as "All Classes by Module":http://qt-project.org/doc/qt-5/modules-cpp.html and "All Classes":http://qt-project.org/doc/qt-5/classes.html, it's not always "obvious" what C++ class to use and how to use it in QML.

    I certainly agree with your statement about jumping into the deep as the best way to proceed and have done this over the last 3 months. Baptism by fire can be painful the the alternatives are probably worse. Having forums where people can discuss ideas and problems also helps with the learning curve.

    Thanks.

    Steve



  • I read about 10,000 hours in a Malcolm Gladwell book, where an example was the Beatles playing 100 hours a week in clubs for 5 years.



  • bootchk,

    Malcolm Gladwell's books, such as Outliers, are interesting but I wouldn't put too much stock in their accuracy.

    Steve


  • Moderators

    Hi SteveG,

    Have a look at this user's work: http://qt-project.org/forums/viewthread/36786/



  • JKSH,

    The C++ class diagrams are nice. I've asked some questions in the thread you referenced.

    Thanks.

    Steve


Log in to reply
 

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