Guest User

Untitled

a guest
Jan 16th, 2014
35
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. main.cpp
  2. --------------
  3. int main(int argc, char *argv[])
  4. {
  5. QQuickView *view = SailfishApp::createView();
  6. QObject *object = view->rootObject();
  7.  
  8.     MyClass myClass;
  9.     QObject::connect(object, SIGNAL(clearCookies()),
  10.                      &myClass, SLOT(clearCookies()));
  11.  
  12. view->show();
  13.  
  14.  
  15.     return app->exec();
  16. }
  17. --------------
  18.  
  19. myClass.h
  20. ---------------
  21.  
  22. class MyClass : public QObject
  23. {
  24.     Q_OBJECT
  25.  
  26. public:
  27.     MyClass();
  28.  
  29. public slots:
  30.     // Poor mans approach as the default Cookie and Cache stuff works pretty good // TODO: Need to reconsider this for specific cookie denial/approval
  31.     void privateMode();
  32.  
  33.     void clearCookies();
  34. };
  35.  
  36. #endif // MYCLASS_H
  37.  
  38. -------------
  39.  
  40. myClass.cpp
  41. -------------
  42.  
  43. MyClass::MyClass()
  44. {
  45.  
  46. }
  47.  
  48. void MyClass::privateMode() {
  49.     // Do something
  50. }
  51.  
  52. void MyClass::clearCookies() {
  53.   // I want to access view from main.cpp here
  54. }
RAW Paste Data