Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 99485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:23:47+00:00 2026-05-11T00:23:47+00:00

I’m working with a group of other programmers on an open source project built

  • 0

I’m working with a group of other programmers on an open source project built using C++ and Qt.

Now, we need a naming convention for widgets (and other variables generally) to use it as a standard in all of our code so that, the code gets better readability and we get better coordination between programmers.

Any advice?

EDIT: Am not talking about naming new classes,

instead I am talking about naming instances of Qt Widgets, let’s say I have a text edit for user name, should I name it txtEdtUsrNm?

And in that case, how am I supposed to choose derivations?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T00:23:48+00:00Added an answer on May 11, 2026 at 12:23 am

    As long as you are thinking along these lines, I’d start by reading this QtQuarterly article from start-to-finish.

    Designing Qt-Style C++ APIs

    That said, one thing that we do is to put the ‘use’ of the instance as the first part and the last full word of the class as the last part.

    So, your ‘user name’ QTextEdit is

    QTextEdit * userNameEdit = new QTextEdit(this); 

    If there is ambiguity, such as QListView and QTreeView, pick the last unabiguous section.

    QListView * userListView; 

    You can figure out abbreviations how you like (such as ‘Lbl’ for QLabel), but generally, the whole word has worked and has been easy to read.

    On the other hand, we are not too strict about this and it might be more important to name the intention of the instance variable without the class name because if, in the future, you want to change the class, you get to change the name which, in the absence of good refactoring tools, is a pain.

    Maybe figure out the general widgets you use the most, and pick a naming convention for the most general super-classes and let everything else go.

    Example list of things that adhere to the convention:

    • layout = All classes that end in ‘Layout’ and inherit QLayout
    • button = All classes that end in ‘Button’ and inherit QAbstractButton

    The QAbstractClassName classes are a good place to think about what should be in that list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.