Newbie, trying to understand the syntax.

  • My first post here, so hello and thanks a million for Qt. I've used KDE for many years...

    I'm enjoying trying to learn programming, but I'm frustrated by not being able to find documentation on the actual symbols used in a line. I have books and tutorials, but they only seem to explain what a whole line of code does and it's hard to search for things like '<-' and 'tr' individually.

    Similarly; it took me ages to find out to press CTRL-space in the editor lol.

    Is there any resource which explains line syntax and Creator usage at that very basic level?

  • Qt Champions 2017

    Hi and welcome
    Qt used c++ and as such requires you to understand
    some key concepts to read the examples.
    It will be a bit hard else. Not to discourage you. But
    it is complex framework.

    Maybe something like

    the -> is used when you have a pointer to an object.

    QTextEdit *Myedit = new TextEdit; // we create new instance of the type QTextEdit
    Myedit->Text(); // here we use a function called Text via the pointer.

    the tr("text") is a function to translate text for qt.

    so while it is possible to find examples that explains Qt, it will not also explains the
    c++ syntax at the same time. So best to start with some c++.

    For Creator, you could look at

  • @mrjj Thanks for that. The second article you linked is wonderfully clear and pretty relevant to what I'm trying to do. I'd looked through quite a lot of c++ code, but concluded those two particular symbols must be Qt only. Thanks for the explanation.

    For 'tr' Is that "translation" as in i18n?

  • Qt Champions 2017

    yes tr sort of marks the texts for extraction and its i18n yes.

    You can always paste some lines here and ask for what it means if unclear but
    you will need know how to use classes and pointers and other c++ concepts as to not
    be frustrated fast with some of the examples.

  • @mrjj Thanks again. I'll be fine, but if I do get stuck I know where to come :)

    Must say I'm hugely impressed with it so far...

  • Qt Champions 2017

    It is indeed a nice framework.
    (if i may say so :)

Log in to reply

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