[Patch] Fix undeleted "static QFont *_font" in kglobalsettings.cpp

Louai Al-Khanji louai.khanji at gmail.com
Thu Dec 4 14:03:07 GMT 2008


On Thu, Dec 4, 2008 at 3:16 PM, Friedrich W. H. Kossebau
<kossebau at kde.org> wrote:
> Two best practice questions, for handling the "QFont* mFonts[FontCount]" :
> 1. How to set an array of pointers all to 0 most efficiently (mFonts)?

Either memset or just loop through it.

> 2. How to mark the number of entries in an enum, so adding one more increases
> that number (FontCount) automatically?

I don't know if there is a clean way to do it. If it is part of a
QObject you can use the meta object system to get the count. Otherwise
I tend to do something like this:

enum Foo {
    Bar,
    Baz,
    FooSentinel /*  Keep as last entry, gives number of enum elements */
}

>
> Cheers
> Friedrich

- Louai




More information about the kde-core-devel mailing list