Hello,

I have a subwindow (m_window) in which I want to add a created (Painter)-Widget (GraphWidget):

Qt Code:
  1. m_window = new QWidget();
  2.  
  3. m_graphwidget = new GraphWidget ();
  4. m_graphwidget->setGeometry(QRect(500, 100, 50, 50));
  5. m_graphwidget->show();
  6.  
  7. // show some Labels
  8. showWindow();
  9.  
  10. m_window->show();
To copy to clipboard, switch view to plain text mode 

With this the GraphWidget is placed in another window, that's clear because i didn't connect the widget with m_window. To place the GraphWidget in the window I used m_graphwidget = new GraphWidget (m_window). But then I got the compiler error:

error: no matching function for call to ‘GraphWidget::GraphWidget(QWidget*&)’
I don't understand this message because m_window is only a pointer to a QWidget?!

I tried another way: I declared m_window as a QMainWindow object and connected it with the GraphWidget:

Qt Code:
  1. m_window->setCentralWidget(m_graphwidget);
To copy to clipboard, switch view to plain text mode 

In this case, the GraphWidget is placed in the window, but I can't set its position and I can see only one part of the labels (which are defined in showWindow(); ).

Can you tell me a solution of this problem?