laserpants / qt-material-widgets

:art: Qt widgets-based implementation of the Material Design specification.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

method naming

fperillo opened this issue · comments

I'd like to know where are you taking the name of the methods from so to be consistent with your naming
My sources are http://www.material-ui.com/#/components/text-field
and https://material.io/guidelines/components/text-fields.html#text-fields-layout

For example in TextField we have the moving label:

  • you called it Label (setLabel)
  • Material-UI calls it Floating Label
  • material.io calls it

The placeholder text

  • Qt calls it placeholderText
  • you didn't call it (it is inheirted by QLineEdit so use Qt name)
  • Material-UI calls it Hint Text
  • material.io calls it Placeholder text (Hint text)

Are you following the meterial.io naming?

Good question. I have a feeling that I initially followed Material-UI's naming. It is possible that their API has changed quite a bit since then, of course.

After some thinking, I came up with the following rule of thumb, but this is very much open for discussion:

  1. Be consistent with Qt naming conventions and API design style.
  2. In properties and method names, call the various design elements what Google calls them in their official guidelines (https://material.io). For example, "slider thumb" is consistent with their terminology. The exception here would be if there is an existing Qt API which has its own naming. Then Qt's naming should be used.
  3. Look at Material-UI (or similar implementations) when considering naming of methods or classes, and the official Material spec. doesn't give a clear answer.

(In case of the label, I thought "floating" was referring to the effect when the label is moving upwards, and since this can be disabled, it would be more appropriate to call it just "label.")

I added a wiki page for this.

  1. Be consistent with Qt naming conventions and API design style.

I agree

use google naming for elements

Ok

The exception here would be if there is an existing Qt API which has its own naming. Then Qt's naming should be used.

So it is Label and not floatingLabel

I think it should be Label, because I interpret "floating" in the Material spec. as a specific behavior of the label. Looking at this page; https://material.io/guidelines/components/text-fields.html#text-fields-layout, it says:

Text fields contain the following elements:

Label

Text field labels display the type of input a field requires. Every text field should have a label.

Labels are aligned with the input line and always visible. They can be resting (when a field is inactive and empty) or floating.

(emphasis added)

PS.

I also noticed that they call the line inputLine, and not underLine, as I wrote, so I'll go ahead and change I changed that.

Feel free to reopen if the explanation on the wiki page can be improved.