[Qt-interest] qfontdatabase_qws.cpp access private data from qfontdatabase.cpp

Alessandro Portale Alessandro.Portale at trolltech.com
Thu Jul 9 13:13:42 CEST 2009


Hi,

indeed, QFontDatabase has an interesting way of spreading adaption code 
for different platforms into separate .cpp files.

qfontdatabase.cpp, Line 1036 simply includes qfontdatabase_qws.cpp. 
That's why the code in qfontdatabase_qws.cpp has that private access to 
anything in qfontdatabase.cpp.

That's also why You won't find qfontdatabase_*.cpp in any .pro or .pri 
files.

Alessandro

Linda Maria schrieb:
> Hi again
>  
> My question was obviously not well formulated. It is simple, 
> qfontdatabase_qws.cpp is accessing private implementation declared in 
> qfontdatabase.cpp. How is this done?
>  
> Thanks,
> Linda
> 
> 
>     Message: 5
>     Date: Thu, 9 Jul 2009 11:38:45 +0200
>     From: Linda Maria <linda.maria.bjork at gmail.com
>     <mailto:linda.maria.bjork at gmail.com>>
>     Subject: [Qt-interest] How does qfontdatabase_qws.cpp access private
>            data    from qfontdatabase.h?
>     To: qt-interest at trolltech.com <mailto:qt-interest at trolltech.com>
>     Message-ID:
>            <9ecdb1790907090238j1bee2ca1u4917f9b832ed28 at mail.gmail.com
>     <mailto:9ecdb1790907090238j1bee2ca1u4917f9b832ed28 at mail.gmail.com>>
>     Content-Type: text/plain; charset="iso-8859-1"
> 
>     Hi
> 
>     I thought I knew how to read C++ code, but obviously I was wrong. I
>     cannot
>     figure out how private data from qfontdatabase.cpp can be accessed from
>     qfontdatabase.h. For example:
> 
> 
>     QFontDatabasePrivate is delclared and partly implemented in
>     qfontdatabase.cpp and only forward declared in qfontdatabase.h. Then,
>     qfontdatabase_qws.cpp starts accessing the QFontDatabasePrivate
>     implementation. How is this done?
> 
>     It would be nice if Qt used more of pure C++ code rather than
>     showing off
>     with macro definitions.
> 
>     Thanks,
> 
>     Linda



More information about the Qt-interest-old mailing list