On Wednesday 17 April 2013 22:20:26 Ignat Semenov wrote: > - setCurrentItem() - which one did you like better, monolithic > setCurrentItem(), find() and then set() depending on find(), or the last > one with set() being unnecessary? For me, it's usually "code what to do not > how", but this time I was not sure if it was just too much auxiliary code.
The monolithic one. While I agree that the naming is a bit unfortu- nate, as mentioned it had the advantage that the failure mode was a no-op (no match, no call) instead of setting the combo boxes' current index to -1 (and thus presumably unsetting the current item, or worse crashing if QComboBox doesn't do any bounds checking). > - int(FolderViev::Unsorted) is a hack around the fact the sorting column is > not homogenuous. 4 of them are enum KDirModel::(something), 1 is > FV::Unsorted. Hence there is no way to have a real typed enum bracing them > all in there. All the others, which you should have noticed, are enums with > qvariant's since that gives you compiler warnings and errors in case you > mess up - a nice thing imho :) I just thought to mention that C++11, once we can depend on it, would allow you to do this: enum Foo : unsigned int { ... }; ... that forces the compiler to use unsigned int as the integral type used for the enumeration (which is otherwise left up to the implemen- tation, but usually an int anyway) and thus makes it superfluous to surround every mention of FolderView::Unsorted with int(). > Thank you for the advice! > > Best regards, > Ignat Semenov Cheers, Eike _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel