blackhole
26th July 2011, 18:56
Hello,
I have a subwindow (m_window) in which I want to add a created (Painter)-Widget (GraphWidget):
m_window = new QWidget();
m_graphwidget = new GraphWidget ();
m_graphwidget->setGeometry(QRect(500, 100, 50, 50));
m_graphwidget->show();
// show some Labels
showWindow();
m_window->show();
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:
m_window->setCentralWidget(m_graphwidget);
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?
I have a subwindow (m_window) in which I want to add a created (Painter)-Widget (GraphWidget):
m_window = new QWidget();
m_graphwidget = new GraphWidget ();
m_graphwidget->setGeometry(QRect(500, 100, 50, 50));
m_graphwidget->show();
// show some Labels
showWindow();
m_window->show();
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:
m_window->setCentralWidget(m_graphwidget);
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?