So I need a custom widget which will subclass QFrame. I do the subclassing, and everything works fine. Except that, there is no way way to set this inside a method. As a result, when I call normal methods that are applicable to QFrame on my custom widget, such as setGeometry, it does nothing. Because I have nowhere specified that. How do I specify that? My code:

Qt Code:
  1. class MyWidget: public QFrame
  2. {
  3. MyWidget(QWidget *parent);
  4.  
  5. private:
  6. prapareUI();
  7. QWidget *parent;
  8. QFrame *baseWidget;
  9. }
  10.  
  11. MyWidget::MyWidget(QWidget *parent): parent(parent) {
  12. prepareUI();
  13. }
  14.  
  15. MyWidget::prepareUI() {
  16. baseWidget = new QFrame(parent);
  17. //do other stuff, add more widgets to base class, it is the container after all
  18. }
  19.  
  20. //main class
  21. MyWidget *widget = new MyWidget(this);
  22. widget->setGeometry(50,50,100,100);
To copy to clipboard, switch view to plain text mode 

The widget appears fine as expected, all UI elements added properly inside it. However, because I could not tell main that the setGeometry method on MyWidget should actually call setGeometry internally on the QFrame member variable baseWidget, it does nothing, and it is positioned on the top left corner of the widget by default. How do I fix this? I can extend setGeometry of course, so that it will internally call setGeometry on the baseWidget, but then, this way I will have to redefine many built in methods. Is there no way I can tell the widget that 'this' refers to 'baseWidget'?