View Single Post
daperl's Avatar
Posts: 2,427 | Thanked: 2,986 times | Joined on Dec 2007
#87
Originally Posted by fcrochik View Post
On a quick inspection of the code it seems that I can't... The "d" on the code bellow is private and I could not find any method that exposes it even to a class that inherits it.

Code:
QWebPageClient* webPageClient = m_page->d->client;
(*) m_page is a QWebPage object

The only I can think of would be to recompile the qtwebkit module but that would create another set of problems... Do you know of any other way or have any other ideas?

Felipe
For now, why not just cast using fake data types where d and client are the same bytes away as in the private data types. Or even better, just copy, paste and rename the private data types. The following compiles:

Code:
typedef struct {
  int z;
} QWebPageClient;

typedef struct {
  int *zi;
  QWebPageClient *client;
} d_type;

typedef struct {
  int *zi;
  QWebPageClient *client;
} fake_d_type;

typedef struct {
  long *al;
  d_type *d;
} m_page_type;

typedef struct {
  int *ai;
  fake_d_type *d;
} fake_m_page_type;

main () {

  m_page_type *m_page;
  QWebPageClient *webPageClient;

  webPageClient = ((fake_m_page_type *)m_page)->d->client;

}
__________________
N9: Go white or go home