Hello!

Trying to learn QT.

My current project has one GUI and I need to be able to access elements of the UI from subclasses. None of the subclasses have a UI.

How do I pass Ui::MainWindow to subclasses? Basically they need to be able to update labels or text fields.

I've tried to pass it through the constructor like below:

Qt Code:
  1. SubClass::SubClass(Ui::MainWindow mw) {
  2. this->mw = mw;
  3. }
To copy to clipboard, switch view to plain text mode 
With it defined in the header file:
Qt Code:
  1. class SubClass {
  2. public:
  3. SubClass(Ui::MainWindow mw);
  4. Ui::MainWindow mw;
  5. }
To copy to clipboard, switch view to plain text mode 

Which of course doesn't work. I'm guessing there's a proper way to do this but I haven't been able to find it in any of the tutorials or documentation.

Any help would be appreciated.
Thanks