Results 1 to 17 of 17

Thread: Lots of beginner doubts

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: Lots of beginner doubts

    Quote Originally Posted by Nishant View Post
    Hey thanks for reply.
    about indentation i meant that why is it kept like QApplication and not as qapplication....for other examples take QHBoxLayout and not qhboxlayout
    C/C++ is case sensitive, so once you have written it once in one case, you have to use that case for entire project. Don't you agree however that QHBoxLayout looks and reads easier than qhboxlayout?

  2. #2
    Join Date
    Oct 2009
    Posts
    26
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3

    Default Re: Lots of beginner doubts

    Well dont you think its much cumbersome to change the case now and then??

  3. #3
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: Lots of beginner doubts

    I don't get what you mean? The case doesn't change, for objects like QApplication, the case is set in stone. You can't change it, you HAVE to use that casing. Therefore all applications use the same word EXACTLY, including the same case.

    Secondly, QtCreator supports code completion. So if you type qapp, it automatically suggests QApplication, and if you type qhb, it will suggest QHBoxLayout, etc. You don't need to remember the case of every letter, although most times its quite obvious.

  4. #4
    Join Date
    Oct 2009
    Posts
    26
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3

    Default Re: Lots of beginner doubts

    i meant that to type QHBoxLayout...and others you need to shift from lower case to uppercase while typing ...this very thing i don't like...do you get my prob now?

  5. #5
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: Lots of beginner doubts

    Quote Originally Posted by Nishant View Post
    i meant that to type QHBoxLayout...and others you need to shift from lower case to uppercase while typing ...this very thing i don't like...
    Then don't do it? Like I said above, if you type qhb (all lower case), then QtCreator will offer "QHBoxLayout" as a suggestion for you and you can just select that.

  6. #6
    Join Date
    Oct 2009
    Posts
    26
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3

    Default Re: Lots of beginner doubts

    Well, i understand that my doubt is too silly.but my editor doesn't suggest QHBoxLayout on typing qhb:have i turned anything off or m using the other version...
    in the about qt creator tab my qt creator says :
    Qt Creator 1.2.1
    Based on Qt 4.5.3 (32 bit)

  7. #7
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    288
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60
    Thanks
    23
    Thanked 32 Times in 28 Posts

    Default Re: Lots of beginner doubts

    My editor QTCreator doesnt suggest that either, but if I have a object of a Qt class, when using that object it will suggest the object methods, even if those methods are uppercase and I am typing in lowercase. If you prefer lowercase typing you can use it for your variables and class names, althought I think ist not a big deal using "Fisrt Letter Uppercase" writting.
    __________________________________________________
    My projects: calculator MathGraphica ; SuperEpicMegaHero game ; GooglePlay ; bitbucket ; github
    Like my projects ? Buy me a kofi

  8. #8
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: Lots of beginner doubts

    Maybe some settings need modification on your version of QtCreator. Goto tools->Options->Text Editor->Completion and untick "Case-sensitive completion".

    Then type 'qhb' and press Ctrl+Space. You should notice that 'qhb' gets changed to 'QHBoxLayout'. This will also work for all your own variables too, so you could have one like 'MyVeryLongVariableName' and then just type 'my' and Ctrl+Space. If there's more than one match, it'll list them.

    So now theres no need not to have long descriptive variable names

    Personally, I prefer the first letter lower case, and then each additional part upper case. Eg. 'lastActionState'.

  9. The following user says thank you to squidge for this useful post:

    john_god (24th December 2009)

  10. #9
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    288
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60
    Thanks
    23
    Thanked 32 Times in 28 Posts

    Default Re: Lots of beginner doubts

    I didnt know about Ctrl+Space. Thanks.
    __________________________________________________
    My projects: calculator MathGraphica ; SuperEpicMegaHero game ; GooglePlay ; bitbucket ; github
    Like my projects ? Buy me a kofi

  11. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Lots of beginner doubts

    Quote Originally Posted by Nishant View Post
    i meant that to type QHBoxLayout...and others you need to shift from lower case to uppercase while typing ...this very thing i don't like...do you get my prob now?
    It's a coding convention. You just have to live with that. Of course you can typedef every class in Qt to lowercase only but this wouldn't make much sense. And the code would be completely unreadable. The general tendency in C++ (and OOP in general) is that class names should start with a capital letter.

    See this as well: http://en.wikipedia.org/wiki/CamelCase
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.