Hello.
I have a custom widget class ( inherited from QWidget ) and an UI class made in Qt Designer and attached to mainwindow widget by ..->setupUi(…) method.
In the UI class I’ve put QWidget in Qt Designer ( empty region ) and I need to put inside it my custom widget class ( inherited from QWidget ).
I tried to make this by setting parent when construction custom widget class:
Qt Code:
  1. ...
  2. MainWindow::MainWindow(QWidget *parent) :
  3. QMainWindow(parent),
  4. mc(new Ui::MainControl),intern(new Ui::Internal)
  5. {
  6. mc->setupUi(this);
  7. intern->setupUi(this->mc->centralwidget);
  8. //constructing image viewing:
  9. image_preview=new ImageView();
  10. image_preview->setParent(intern->widget_image);
  11. ...
To copy to clipboard, switch view to plain text mode 
But I get segmentation fault on Linux when I run the program. When I comment the last row:
Qt Code:
  1. //image_preview->setParent(intern->widget_image);
To copy to clipboard, switch view to plain text mode 
There is no seg. fault but image_preview is not added to intern UI class.
Does anybody know how to add the custom widget image_preview to the UI class member intern->widget_image , so the widget will be seen and active on the UI?
Thanks a lot for help.