Qt video tutorials on YouTube
-
(I think this thread should be moved to the Qt in Education forum...) [done -mariusg]
Wow! That's some HUGE work! Kudos!
The little problem with video tutorials is that if you do a mistake you can't fix the video :-)
(Ok, you can add some "baloon" from Youtube or so, but it's definitely harder rather than just changing some text in a document :-))For instance, it's Qt, not QT :-)
Are you planning to collect comments / feedback / bugreports in here?
-
I know, videos can be a pain.
have found over the years to be a good learning tool.
I found if I can't explain it to someone else then I really don't know it :)
And places like YouTube allow for some nice feedback.I will collect comments / feedback / bug reports anywhere I can get them, I am just here to learn and share what I learned.
-
First of all: I do humbly apologize for the nitpicking approach, but, all in all, you asked for feedbacks, so... :-)
So, here's the first round of reviewing:
h4. General
- It's Qt, not QT :-P
h4. 1
- You can develop "Commercial" software (i.e. closed source, not free-as-in-beer) even with the LGPL. But you're right on insisting on what the biggest difference is (if you modify Qt you have to share the modifications).
h4. 2
- 01:00 add a note about why the two inclusion header are different? <QDebug> vs <QtCore/..:>
- 01:43 you're not creating a QString, but using the QDebug::operator<<(const char *)
- 02:06 QtCore is not a framework but a module/library
- 03:20 same thing
- 03:43 TARGET isn't the name of the project but the name of the executable to build
- 03:43 CONFIG += console links to the Windows console subsystem, or you won't be able to see any console output (that's why a console opens)
- 04:15 QT += core doesn't "add" anything to a specific file; you still must #include anything you use, or the compiler will complain (and Creator won't autocomplete, etc.). The list that pops up is of classes, objects, macros, functions etc. you got by #including QCoreApplication and QDebug, and it does NOT contain EVERYTHING available in the core module (an #include <QtCore> would do that). For instance, QAbstractItemModel is missing from that list.
- 04:42 Same thing; you get the QString #include "for free" because of other includes, but you're not including it explicitely (nor including every header from core), which is bad practice
h4. 3
- 02:53 ... and it's different because you're using QApplication and not QCoreApplication!
- (Oohh adorable kitten :D)
- 03:18 Here a lot of clarification is needed, or perhaps it would be best to skip some parts for now and explain better later. You're not "including the namespace Ui"; that's a standard forward declaration for the class Ui::MainWindow, which is NOT the ui file but it's generated from it by uic. The fact that your C++ class in mainwindow.h has the same name of the Ui::MainWindow class is pure coincidence, and it should be stressed that they're not the same thing
- 03:42 Q_OBJECT doesn't "convert" a class into a QObject; that's done by inheritance itself (but you need to inherit from QObject to be able to use Q_OBJECT). Q_OBJECT adds support for signals and slots, translations, qobject_cast and a lot of other things.
- 03:47 "Everything in Qt"? That's just plain wrong, all value classes (for instance) don't inherit from QObject at all.
- 04:45 You forgot to say that the ui member is initialized with a new on line 6, therefore there's a delete in the dtor
h4. 4
- 01:05 You must not select anything to successfully apply a layout to a toplevel widget! In fact, your layout does not make the widgets expand to fill the available space like they should, but you must resize the layout manually
- 03:22 Q_OBJECT macro has nothing to do with the fact you can use the connect method (it doesn't "provide" it or so), and connect is not a macro but a method of the QObject class
h4. 5
- 02:08 An action triggers a signal, not an event
- 02:20 How about spending some words on what that automatically create method is (a slot) and how's gonna get connected to the action triggered signal?
- 06:40 setModal(true) + exec() is nonsense; exec() always shows the dialog as modal
- 09:15 "When the qmainwindow closes the dialog will also be destroyed" is incorrect, s/closes/is destroyed/ would be better (or you should explain what the DeleteOnClose flag does); if your mainwindow is kept open (and usually mainwindows are long-lived windows), you're leaking memory!
h4. 6
- 01:58 Actually, a QLabel and a QLineEdit call for a form layout, not a horizontal layout
- 02:34 You can also introduce the "Preview" designer feature, to avoid to recompile every time
- 03:50 Better practice: connect Cancel to reject() slot
- 04:12 Buddies don't accept "input" for other widgets --- it accepts the input focus on behalf of a QLabel when the user presses the label's shortcut key sequence. It is therefore wrong to state that the focus is transferred to the buddy widget (a QLabel can accept focus because of its text interaction flags, and you can for instance select text or activate links).
h4. 7
- 02:16 Why a QLabel on the heap? (which'll produce garbage?)
- 02:58 "Haven't created a window" is misleading --- just any widget without a parent becomes a window.
- 04:55 "All Qt widgets are HTML aware" is a quite strong assertion :-) They aren't. Just QLabel, QText* and some other are.
- 05:40 Well, the fact that the Qt engine is smart enough is not a good reason to teach people bad habits :P
h4. 9
- 00:40 1) typo on QtCore (you typed QTCore) 2) QtGui includes QApplication, so nonsense to bring it in as well 3) QtGui includes QtCore, samething
-
h4. 11
- foreach is not a method, but a Qt (not standard C++!) macro
- 06:40 When you build a QDir object with the default ctor, the current working directory of the process is used, not the "system" one (which doesn't exist)
- 06:25 The explaination is incorrect; you can create with mkdir an arbitrary directory, but it'll just create THAT directory and not all the parent directories that are necessary to create that one (which is what mkpath does). Mkdir does not enforce the directory to be a subdirectory of the CWD.
- 11:16 Dot and dot-dot do not refer to the parent and the parent-parent, but the directory itself and its parent.
h4. 12
- 03:10 WriteOnly and Text are actually defined in QIODevice; a better style is to prefix the enum with the scope of the class that declared them, rather than an arbitrary subclass.
- 03:36 Minor typo on "writting"
- 03:48 Since you're teaching good practice, it is important to stress that. (Calling close() isn't mandatory since the QFile object will be destroyed at the end of scope, closing it. The explicit call to close() becomes therefore a matter of "style"/"habit").
- 04:38 The QTextStream is called "out" instead of "mOut". Why not keeping your naming convention for variables?
- 04:44 Not a reference, but a pointer to
- 05:05 This is an error: the explaination is correct, but you actually want to call "out.flush()", not (only) "mFile.flush()" there, otherwise you're not flushing the QTextStream's internal buffer but QFile's one. After out.flush() you can call mFile.flush(). Again, it should be stressed that you're introducing flush() just for the sake of argument, because QTextStream automatically flushes when it's destroyed (and QFile automatically flushes when it's closed, and it automatically closes when it's destroyed => you can remove the last two lines altogether and have a correct behaviour). Instead, you call mFile.close() without flushing the QTextStream, which is an error!
- 06:00 Why QString and readAll()? For consistency, you wrote a char array, then you read back a char array, or create a QString in the write method and read back a QString.
-
WOW... awesome feedback!
Can I have permission to re-post your comments on you tube until I have time to go back and re-do the videos with corrections? That way someone stumbling across the video will have the same corrections....for both Qt and C++ as I am still new with both.
As a side note, I did watch the Qt video tutorials
"Official Videos Link":http://qt.nokia.com/developer/learning/online/trainingAnd found them very helpful, but they seemed more a marketing tool for people to take the training classes - I was really looking for the "how to get things done" videos which is why I started making my own, not only does it help me learn by doing, but also helps me find my own flaws :)
Unfortunately my time and resources are limited which is why the videos have a very "home made" style...any chance we can get more official videos from the Qt staff?
I will take time to go through all your feed back as I am going to keep making videos (I am in love with Qt) and want them to be as accurate as possible.
Thanks again!
-
There are some comments about the videos about threading here:
http://www.qtcentre.org/threads/38256-QT-video-tutorials-on-YouTube -
[quote author="rootshell" date="1296525099"]WOW... awesome feedback!
Can I have permission to re-post your comments on you tube until I have time to go back and re-do the videos with corrections? That way someone stumbling across the video will have the same corrections....for both Qt and C++ as I am still new with both.[/quote]
Of course you can! Since redoing the screencasts can take a lot of time, you can simply set up an errata page, or add the comments in each video's description and use the "notes" feature that Youtube provides to add references to them.
-
This is turning into an epic thread. Wow! Thanks peppe for the great feedback on the videos. And of course the videos themselves are pretty neat!
I was wondering if it made sense to move all of this to the wiki for easier discovery and edits on the feedback itself...
[quote author="rootshell" date="1296525099"]
As a side note, I did watch the Qt video tutorials
"Official Videos Link":http://qt.nokia.com/developer/learning/online/trainingAnd found them very helpful, but they seemed more a marketing tool for people to take the training classes - I was really looking for the "how to get things done" videos which is why I started making my own, not only does it help me learn by doing, but also helps me find my own flaws :)
[/quote]Really? Which videos did you watch? I didn't have the same impression but I'm curious to hear how we could improve. As you already mentioned video production needs humongous efforts if you want to reach a professional result.
We could try though. ;)
-
@peppe
Have been taking your comments and posting them to the notes of the videos:
"http://www.youtube.com/watch?v=JtyCM4BTbYo":http://www.youtube.com/watch?v=JtyCM4BTbYoPretty neat how it jumps right to the spot in the video
Thank you SO much for your feedback I am learning a lot!
-
@ Alexandra
Don't misunderstand, I loved the official videos, and even purchased both official Qt books because of them, those official videos are what sparked my interest in Qt...I actually wish there was a complete set of those videos online (the entire KDAB training course)
Like many programmers, I was faced with a problem...make a multi-platform application. After researching Python, Java, Mono, and C++ (Qt vs others), I came to the conclusion that many others before me have - Qt wins, no contest. I found the official videos and from the moment I watched Mirko Boehm explain a basic "hello world", I was hooked.
Unlike others, I was not bothered by the trainers accents.
My only comments about the official videos:
Keep things simple, I am very new to C++ and Qt, some of the concepts went by so fast I had to re-watch it a few times. But one thing I love about Qt is how it makes working with C++ very easy!
Perhaps explain things in a manner that a new student with no experience would need.
But keep in mind these comments are coming from someone that is struggling with a new language (C++), a new IDE (Qt Creator), and a new lib (Qt) - I have over a decade of experience with other languages (C#, VB, Pascal, a bit of Java and Python), but three new things at once is a bit of a learning curve, and honestly I have avoided C++ all these years because of it's complexities :)
Admittedly most of my comments and frustrations with Qt and C++ come from my general lack of understanding of both :)
-
Amazing work, thanks rootshell! :)
BTW, I have faced some of the concerns that you have raised about learning C++ and Qt at once from the basics, and want to make a complex, useful and cool app at the same time, after experiencing only a few in other languages (I've only learned C).
I have a feeling I will learn a lot from these videos :) Thanks again!
Oh, and moving some of the subject to the wiki make sense, at least a wiki page about them and continuing this discussion for even better videos :)
-
Well, I've just watched all the videos I was interested in, and I found them quite good. Thanks for them, and with all the feedbacks and the new ones you will hopefully make, we will get a very good starting point if someone want to learn Qt or just too lazy to read.
Oh, one suggestion, if it possible, try to make bigger the captured area, and see what we get.
-
A note about video 48.
At the end you say that QThread is not meant to be used with signals and slots. That's not true, a QThread can use signals and slots without any problem.
The problem is thread affinity. Although the documentation is correct and you can in general circumstances subclass QThread and implement the run() function, this will not work easily with signals and slots across threads.
If you define signals and slots inside the QThread subclass, they are called from the main thread context, not the new thread you created.
Maybe it is better to understand that QThread is NOT a new thread in itself. QThread is just a manager for one new thread. The QThread object itself lives in the thread it is created in (the main thread for example).
-
[quote author="tbscope" date="1297435387"]A note about video 48.
At the end you say that QThread is not meant to be used with signals and slots. That's not true, a QThread can use signals and slots without any problem.
The problem is thread affinity. Although the documentation is correct and you can in general circumstances subclass QThread and implement the run() function, this will not work easily with signals and slots across threads.
If you define signals and slots inside the QThread subclass, they are called from the main thread context, not the new thread you created.
Maybe it is better to understand that QThread is NOT a new thread in itself. QThread is just a manager for one new thread. The QThread object itself lives in the thread it is created in (the main thread for example).[/quote]
Very good explanation - thank you!