[Please recommend] Tutorial on how to use Widgets



  • Greetings!

    I'm trying to figure out how to use various different widgets for my status bar. I need # of columns, # of rows and current file size. Other features such as progress bar when loading large files/large number of files would also be helpful.

    I've found the online reference to be incredibly difficult to learn from!

    Maybe it's because I'm used to the "Processing" programming-language reference, which came with a very usable reference compilation complete with example code and pictorial-representation (when applicable). For the last 6 months since learning Processing, I've begun learning C++, and found many useful websites complete with usability examples.

    Unfortunately with Qt [C++], I haven't been able to find a complete, usable reference. Are there any plans to create one?

    Here is a mockup of what I'm currently working on;

    !http://i51.tinypic.com/zyhllk.png(Mockup)!

    Over the next 3 days I plan to add all the status bar features, the filesystem tree [clickable] and a filter for the filesystem tree to show only folders and *.txt files.

    Are there any relevant tutorials/books which will enable me to achieve this goal? — It'd be greatly appreciated if you could give me a few pointers and/or suggest reference material.

    Thank you,

    Alec Taylor

    FYI: I currently have a working text-editor with an iconified toolbar which I created following various tutorials; using QScintilla2 instead of TextEdit.



  • "Here":http://doc.qt.nokia.com/4.7/tutorials.html are the official tutorials, but Qt tutorials/documentation won't help you if you don't know C++ already. So make sure that you know the basic of C++ including OOP, deep understanding of pointers, memory management (Qt simplifies this a little bit, but you need to know what Qt delete and what you should).

    After you know the topics listed above Qt will be easy, but note that reading documentation isn't the best way to learn for everybody (maybe because it's very big), for example a book will explain topics in some order and you might find that you learn best that way.

    Another "link":http://doc.qt.nokia.com/4.7/qt-basic-concepts.html from my bookmarks, you will find here some explanations on topics like signals/slots, MVC, etc... read them when you don't understand something in tutorials or want more explanation on specific topic



  • In Qt Demos are many program using Widgets, look at there :) For me (I'm to new with Qt) this is the best form of lerning, because you can see source code and model on him :)



  • There are many examples in the "Qt documentation":http://doc.qt.nokia.com/4.7/all-examples.html . One group ("Main Window Examples":http://doc.qt.nokia.com/4.7/examples-mainwindow.html ) contains all stuff of main windows, dock windows, statusbars, toolbars etc.

    The first onw ("Application Example":http://doc.qt.nokia.com/4.7/mainwindows-application.html ) contains a custom status bar. I would look at this example and start there.



  • Thanks Zlatomir, I was quite confused about slots (and only know a little about signals), I'll be sure to read the docs on them tomorrow.

    BlackDante: I've been through a lot of them, but really the "Application Example" Gerolf mentioned was the only one I found useful. The Rich Text and Normal Text [with svg] were interesting, but not as helpful as the aforementioned.

    Gerolf: Thanks, my project so far is pretty much that application, minus the menubar and using QScintilla2 instead of TextEdit... in the screenshot in the bottom right-corner it says "MOD", however the actual program only has the other (temporary) text... because the example function only contains;
    @void MainWindow::createStatusBar() { statusBar()->showMessage(tr("Ready")); }@

    And the documentation for the "createStatusBar()" function was extremely difficult to follow, pretty much useless. I've ended up spending hours going through text-editor source-code (written with Qt) to try and find the few lines for columns, rows and filesize... to no avail.

    If you could recommend a statusBar tutorial it would be greatly appreciated !http://i52.tinypic.com/r1lq51.png!

    Also the "Main Windows Examples" I only found a few hours ago, the dock examples especially look useful =]

    Thanks again for your continual advice,

    Alec Taylor



  • Maybe it's time to step back a bit. You try to make a quite big application for a beginner - both in C++ an Qt. I'm quite sure you will stumble over a big bunch of problems. It would be much more easier for you if you start with the tutorials (e.g. the "Getting Started with Qt":http://doc.qt.nokia.com/stable/gettingstartedqt.html) and then look at the examples. They are documented and commented in Qt Assistant (and in the online docs, which are identical). After that you have a more thorough understanding of all the concepts behind Qt and things will much more easier for you.

    If you were a craftsman you would not build a cathedral in the very beginning too, why should it be different in software engineering?



  • Hi,

    I builded your app completly from the examples of "Application Example":http://doc.qt.nokia.com/4.7/mainwindows-application.html .
    It's just a quick prototype, no guarantee for anything :-) Here is the "link to the source...":https://docs.google.com/uc?id=0B8PL33_OKajLMTkwNjYxOGItYmYzMC00ZDYzLWEyODItYjQzZDJiMTNkOTMy&export=download&authkey=CJ-BvdAC&hl=en

    !http://lh6.ggpht.com/_m1PNLlZctqY/TR-zz3ubLkI/AAAAAAAAADk/0BtWxOVXhdM/s640/TreeEditor.jpg(Example image)!



  • Thanks, it seems really quite good. A few off by one errors [in the status-bar] etc., but all in all, tis pretty great!

    I've only made a few modifications (the dock is now movable/closable/floatable)...

    The only bad thing about this is; I only designed it, I didn't code it :(

    I'm sure I've learned a lot by reading the code, but I'm sure I could've learned more by coding it myself...

    On the other hand, I've now got quite a solid grounding to begin work on the IDE... so I suppose it isn't all bad!

    A quick question though; are all Qt applications this slow to startup? — It's taking around 10 seconds to startup on my computer [quad-core, 4GB of RAM, 64-bit Windows]... I was thinking maybe moving to a different cross-platform UI framework... I'm sure it's the QFileSystemModel, so maybe that can be reordered to allow the whole application to start and a message saying "Loading..." in that dock for the first 10 seconds...

    Thanks again,

    Alec Taylor



  • No I never experienced a slow startup for Qt applications.



  • Hi Alec,

    how did you start it? From QtCreator?
    Normally it's fast...

    YOu can code it by yourself, just do it. it is an example, and I wanted to show, that you really find nearly everything in the examples....



  • Alec, you should start the application and delay the folder scan and display a "QProgressDialog":http://doc.qt.nokia.com/stable/qprogressdialog.html

    Or do it at startup and show the user a "QSplashScreen":http://doc.qt.nokia.com/stable/qsplashscreen.html



  • The folders are displayed with QFileSystemModel, which is in fact an asynchronous model.
    On mymachine, when I start the release version from the explorer, it takes about 0.5 - 1 sec till the window is there. If you start it from QtCreator, it takes longer, that's correct.


Log in to reply
 

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