Qt doesn't seem to be as "cute" as I thought!

  • Hi guys,

    I'm a mech. Engineer(well almost) and needed to make a simple GUI for some program that I had written in C++ a while ago. It's nothing fancy just a simple program that would calculate some maschine parts (shatfs and stuff) (actually the formulas and the process for calculating such things ain't simple at all but the GUI should be pretty simple, just some radioboxes, checkboxes, buttons...etc.).

    I usually did this kind of stuff in Visual Studio with C# but a few days ago, at the Uni. I was told that using the PC's there is not allowed 'cause I'm not a student anymore (technically I am but..anyway).

    So this thought occurred to me: " You're screwed, right in the down under", because I need this for my Bachelor Work (?) (or is it Bachelor Thesis...anyHo').
    Then I called a highschool friend of mine, (he's a Software Engineer). He was like: "No big deal, just use Qt, it's open source (not in the thousands of euros like VS) and you'll be able to cook a simple GUI like that in just few days".
    After the phone call I was like, ok then Qt it is! Went home, searched for Qt, downloaded and installed version 5.4 (or 5.3 or a little bit of both...idk). In the meantime i searched around for some books and found the one called: "C++ GUI programming with Qt4" i downloaded it (illegally of course 'cause I'm a pretty broke (still) student plus there was no time to wait for derlivery).

    So far so good. First time Qt starts, looks pretty neat, make myself a little bit familiar with the home screen and went down to study the book, after a couple of hours I felt that it's time to try the first example from the book, i go through the " eff...You world" thing, it works great, move on to the next example...ehm...64 errors!

    After removing some typos of mine, the program's still not running...ok... . I call Youtube, search for qt tutorials find a guy with his channel (realvoids or voidrealms...something). I try his examples i manage to run a few (with a great deal of help from the comments ) and that's it.... In 3 days i couldn't even show a variable to a textbox (QLineEdit..in Qt i believe). Anyway.

    I was wondering how the effing eff is someone supposed to learn programming in this platform if there ain't no books, no tutorials, nothing...just the docummentation from which a beginner can't learn [insert s word here]?!!

    I apologise if someone feels offended from this. That was deffinitely not my intention, just felt the need to release some frustration somewhere.

    Thou shall have a great life.

  • Welcome to DevNet,

    Unfortunately there is no Qt5 book.
    I've started from "Getting started guide":http://doc.qt.io/qt-5/gettingstarted.html
    Then went to "Creating a Qt Widget Based Application":http://doc.qt.io/qtcreator/creator-writing-program.html
    And jumped to "Qt Examples And Tutorials":http://doc.qt.io/qt-5/qtexamplesandtutorials.html

    If you have the errors in your project then post it here and we will try to help you.

    BTW(By The Way) Visual Studio 2013 Community is free, like a free beer.

  • Thank you andreyc, for your reply and the links.
    Actually I didn't think somebody would read this long, silly post!

    About fre VS as free beer (lol) I know that but I can't hard code the GUI from scratch. I'm not skilled enough for that.

    If i don't give up programming after graduation i'll look into the links and post some question around here.
    Maybe till then a book will pop up somewhere too.

  • Well, first of all, Qt being "cute" is an urban legend, or a "community make-believe", much like people who have spent lots of time with other languages/frameworks often have a rather idealized and quite frankly unrealistic view of their favorites. I personally don't think there is anything remotely "cute" about code and programming and that's actually OK because it would be lame and pointless, that being said, Qt is overall marginally better than a lot other solutions I've personally used, but still far, far from perfect. Yeah, if believing Qt is cute or believing in pink unicorns make you feel better - whatever floats your boat, everyone is entitled to opinion.

    Then again, there is the factor with stumbling with something new and unknown - even experienced developers sometimes have problem picking up new things. And it doesn't help if you have unrealistic over-expectations of how good or easy it is going to be. Without aiming to depress you, but it will take 2-3 years of daily usage before you get fluent with Qt to the point you using it will make it look easy. Of course you can post questions here or on SO (stackoverflow) or a bunch of other, less popular places, and your questions will no doubt be dumb and not met with a lot of enthusiasm in the beginning, but that's the process of learning, 2-3 years later you will ask yourself how could you even ask such stupid questions.

    The documentation of Qt is quite decent, but like with everything else, it takes some time before you begin to take advantage from it. Take a peek "here":http://stackoverflow.com/questions/17591672/book-suggestions-for-qt-programming/17591850#17591850 for some recommendations on books on Qt, but be advised, current books do not cover Qt5, but are still applicable in many aspects, plus they do teach the Qt programming paradigm, at least the C++ side of it. As for the errors you got from following books - who knows really, it might be you doing it wrong, it might be incompatibilities between that code and Qt5, it really sucks if you don't understand what the error is, and in C++ error messages are rarely informative of the actual issue, and those 64 errors might actually be the product of a little typo which results in a cascade of errors, it might be something as trivial as trying to use an identifier which happens to be occupied by some macro dug somewhere deep.

    If you are more interested in GUI, you should probably begin with QML, which is quicker and easier to work with than QWidgets with C++ and the learning curve is not very steep. It is quite easy to expose your existing C++ logic to QML. But unless it is something really calculation heavy, it will be better to implement the formulas in QML using JS.

    All this in case you consider investing actual effort into learning programming, because quite frankly, if all you need is a form to input data to do formula calculations, you might as well use a form in excel or libreoffice...

  • Hi,

    I have been using Qt for more than 5 years, therefore much of the things I do with Qt seem to me quite easy.

    I checked the latest Qt documentation to see how a beginner can get started with Qt.

    1. Go to the "documentation":http://doc.qt.io/
    2. First link on the top of the page is "Getting Started Guides":http://doc.qt.io/qt-5/gettingstarted.html
    3. Assuming Qt is already installed, "Setting Up Projets":http://doc.qt.io/qt-5/gettingstarted.html#setting-up-projects > "Qt Widgets Projects":http://doc.qt.io/qtcreator/creator-writing-program.html seems quite helpful.

  • Thank You for the honest words utcenter.

    As for the title of this pst (Qt not "cute"), I never believed that it is possible to learn a platform like Qt or any other, in a few days or even months -people get degrees in programming,. It's not like engineers or sociologists... can wake up one morning and say: " Hey, you kno what? I'm gona start developing software."

    I was able to learn the GUI basics in .net in about 2 weeks ( at this point, maybe you'd say you don't know anything about GUI or programming and truth is that may be the case but it was enough to deal with the challenges of a mech. engin. student). It looks like Qt is great because a lot of people like and prefer it but I was frustrated with fact that there's not enough (imo not at all) learning material around.
    I know it's not easy to write books, but things like step by step tutorials (video or without it) of some examples are not that hard or time consuming to make.

    In the last couple of days while trying to make a simple calculator I got to the point where I created the UI, wrote the variables, functions... in the back (C++ obviously) but couldn't link them together!

    Qt5 has been introduce in 2012 (correct me if i'm wrong), two years from now mho is that there should be more learning material on it (Qt5).

    Forgive me my grammar or writing mistakes.

  • You are just making premature conclusions based on a few missteps and less than realistic expectations. 2 months should be enough to pick up on making UIs for your formulas with QML. C++ is a different story though, it will take at least a coupe of years before you begin to get comfortable with it.

    Go "here":http://qmlbook.org/ and learn chapter 4 for starters, then look at "QtQuickControls":http://doc.qt.io/qt-5/qtquickcontrols-index.html

  • I agree with all posts here.

    I used C, C++ YEARS ago with a number of different "GUIs" and everyone is different. Learning Qt and how it works will be just as easy (or hard) as learning any other GUI.

    Start small. Make a Qt widgets program. You'll get a main window. On that main window in the UI designer drop a spin box and a button. Doesn't matter where, just put them in there.

    To do something on your button press right click on the button and select "goto slot". Pick clicked() and you'll be in a method. In here you can experiment with getting your value and using it. Your class should have a "ui" pointer and you can access the controls you put on your window using that pointer.

    This is the "Windows forms" or code-behind way of doing things because you are using what a lot of people would call "code-behind". I think for simple programs this is just fine. If you plan to have multiple developers and lots of changing data sources and logic then some of the more complex paradigms like MVC or MVVM can be implemented but frankly they add more work.

    Later you can expand and use signals and slots and you'll see how cool it can be (or cute).

    In the end a program using MVC or a derivative will be easier to maintain but if you only have a hand full of fields and buttons then probably just the code-behind will work.

    I also think anything you have trouble with you can post here and people will help. its a great group!

  • @GuessHoesBack You are exactly who I was thinking about when I made a series on courses on Qt for Pluralsight. The trilogy of courses is now complete and I cover everything from downloading the tools and getting started to understanding Qt Quick to integrating Qt Quick with C++. All you have to do is sit back and watch but you'll obviously get more out of it if you follow along and code the examples.

    Pluralsight is a subscription based site. Many universities are customers and provide logons to students. If yours isn't (or won't), then send me a request through the forum mail and I'll send you a VIP pass. Good for unlimited viewing (online and offline) for a week. Plus you can download the course materials.

Log in to reply

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