Samstag, 25. Juni 2011

Das QT Getter und Setter WTF

Alles was Schoen und Gut ist aber die Getter und Setter Regeln von QT gehen ja mal wirklich nicht! Hier die lustigen Regeln, die wohl jemanden beim Saufen eingefallen sind:
  • Adjectives are prefixed with is-. Examples:
    • isChecked()
    • isDown()
    • isEmpty()
    • isMovingEnabled()
    However, adjectives applying to a plural noun have no prefix:
    • scrollBarsEnabled(), not areScrollBarsEnabled()
  • Verbs have no prefix and don't use the third person (-s):
    • acceptDrops(), not acceptsDrops()
    • allColumnsShowFocus()
  • Nouns generally have no prefix:
    • autoCompletion(), not isAutoCompletion()
    • boundaryChecking()
    Sometimes, having no prefix is misleading, in which case we prefix with is-:
    • isOpenGLAvailable(), not openGL()
    • isDialog(), not dialog()



Dann sind ihnen wohl die Ideen ausgegangen.

Quelle: http://doc.qt.nokia.com/qq/qq13-apis.html#theartofnaming (a bissl runter scrollen)

Keine Kommentare:

Kommentar veröffentlichen