laserpants / qt-material-widgets

:art: Qt widgets-based implementation of the Material Design specification.
BSD 3-Clause "New" or "Revised" License
2.94k stars 660 forks source link

method naming #15

Closed fperillo closed 6 years ago

fperillo commented 6 years ago

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:

The placeholder text

Are you following the meterial.io naming?

laserpants commented 6 years ago

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.")

laserpants commented 6 years ago

I added a wiki page for this.

fperillo commented 6 years ago
  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

laserpants commented 6 years ago

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.

laserpants commented 6 years ago

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