[Interest] Dealing with unexported class in private API

Thiago Macieira thiago.macieira at intel.com
Mon Sep 25 18:03:00 CEST 2017


On Monday, 25 September 2017 03:39:37 PDT iman ahmadvand wrote:
> Hi.
> Nowadays I'm dealing with problem of the symbols absence for some private
> part classes.
> for example in qabstractscrollarea_p.h class
> QAbstractScrollAreaScrollBarContainer
> is not exported while QAbstractScrollAreaPrivate is.
> So if you try to access QAbstractScrollAreaPrivate::scrollBarContainers you
> get linker error ! (seems to happen on windows only)
> 
> I need to access that class member (scrollBarContainers->layout) without
> compiling dependencies!
> Is there a solution ?

Yes, there are two possibilities:

1) put up with the problem. Figure out a way to do what you want to do without 
modifying the header. And please don't ask questions about the private API 
either: you can use them at your own risk, but you need to understand them on 
your own. Please read the "We mean it" comment.

2) import your fuctionality into Qt. That way, we can review your use of the 
priate APi and decide whether it makes sense to export more private API.

Note that there's a variant to solution (1), which is to add *public* API that 
allows you to achieve what you want to achieve. That can be submitted to the 
code review for Qt 5.11 (dev branch) with an explanation of what it does and 
why it's good, without submitting the use of it.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list