Congratulations to our 2022 Qt Champions!

Are there any official code style specification for Qt programming?

  • Just wonder if there are any offical code style specification for Qt programming. I want to follow it so that it is consistent with the codes generated by Qt IDE Wizard.

  • Do not know if I misunderstood your question, but I'll answer what I understood.

    Each IDE has its form of organization code (indentation), which can be modified in the same settings for the user that the user is accustomed to.

    I think the only rule or style you must follow are the specifications of the language you are using, for example, in C + + with a semicolon at the end of lines of code, among other mandatory issues of language and not Qt

  • Maybe this can be helpful:
    "Qt Coding Style":

  • Though there is a unique way to write the codes acceptable by the compiler, it is possible to write in different code style.

    For example, in MFC/Microsoft, they use Cxxx for all the classes, such as CMainWindow for Main WIndow class. However, in Qt, it seems they do not use a prefix, use MainWindow for the class and all lower cases mainwindows.cpp for the class implementation file. To make sure our codes are consistent with those generated by the QT IDE automatically, we need to find the code sytle for Qt.

Log in to reply