[Development] Proposal - QtSerialPort graduation from the Playground

Thiago A. CorrĂȘa thiago.correa at gmail.com
Wed Jan 23 22:45:56 CET 2013


On Wed, Jan 23, 2013 at 6:57 PM, Laszlo Papp <lpapp at kde.org> wrote:
> On Wed, Jan 23, 2013 at 8:27 PM, Thiago A. CorrĂȘa <thiago.correa at gmail.com>
> wrote:
>>
>> IMHO we could drop the enumeration from the public API.
>
>
> What would you use for setting a conrete value for your serialport like the
> terminal example demonstrates that use case?

You mean filling the Combo Box with available rates right? (
ui->rateBox->addItem(QLatin1String("9600"), SerialPort::Rate9600); )
I would just fill in the numbers in the second argument of addItem.
Other than maybe getting a compiler error in case of a typo, there
isn't much gain in the enums themselfs. A list of common values can be
kept in the documentation, and most likely ppl will just copy them
from hyperterminal when they need them for a configuration dialog like
this.

Having the enum feels like setBaudRate (or setRate as it's now) should
take the enum as parameter, which would be wrong, as it would
effectively prevent rates above 115200 unless they are added to the
enum.

This is highly subjective for me, so I would be happy either way.
Personally I would just choose to ignore the enum and use the numeric
values in my own code.

>>
>> I'm not native english
>> speaker but I think writting it as baudrate (ie, as a single word) is
>> common[1], and therefore I guess it wouldn't be against the convention
>> to call it baudrate/setBaudrate if that form os prefered.
>
>
> I believe that camelCase makes sense here as they are usually as separate
> words (i.e. even if I type "baudrate" into Google).

No strong objections here.

>>
>> If we keep the enumeration, then Baud9600 isn't a bad name.
>
>
> Fine, I will make a patch soon then if there are no objections against it.
>
>> [1] I've looked up an Oxford Semi datasheet I have here and it's
>> written only as baud rate, but another one from Atmel has both forms.
>
>
> Hmm, perhaps the link is missing. ;-)
>

Oh, I simply had them here in my harddisk from different projects.
They are not of much relevance except explain why I thought both forms
are ok. Can get links to them if it's desired :-)



More information about the Development mailing list