Quote Originally Posted by purplecoast View Post
Thanks. I actually do need them because in my case I have a GUI-based library that another GUI application uses. And the GUI app needs to call method of the QtDesigner UI objects from the base library.
Either the file should be regenerated from the ui file or you should expose the objects in a proper header file as part of your class's interface. Doing it the way you are trying to do is not a pretty design.

Qt Code:
  1. // header file
  2.  
  3. namespace Ui {
  4. class MyWidget;
  5. }
  6.  
  7. class MyWidget : public QWidget {
  8. public:
  9. MyWidget();
  10. ~MyWidget();
  11. QPushButton *button() const; // expose object
  12. private:
  13. Ui::MyWidget *ui;
  14. };
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. // implementation file
  2. #include "headerfile"
  3. #include "ui_mywidget.h"
  4.  
  5. MyWidget::MyWidget() : QWidget() {
  6. ui = new Ui::MyWidget;
  7. ui->setupUi(this);
  8. }
  9.  
  10. MyWidget::~MyWidget() { delete ui; }
  11.  
  12. QPushButton* MyWIdget::button() const { return ui->button; }
To copy to clipboard, switch view to plain text mode