I've been writing my user interface directly instead of using the Qt UI design option, and I'm having trouble adding a Viewer panel.
I've copied the interface.h and interface.cpp files from this example code: http://www.libqglviewer.com/examples/interface.html, into my project, and attempted to insert a Viewer panel via the following code:
QGroupBox *groupBox;
groupBox = new QGroupBox();
QVBoxLayout *mainLayout = new QVBo开发者_运维问答xLayout;
Viewer viewer = new Viewer(groupBox);
textEdit = new QTextEdit;
mainLayout->addWidget(viewer);
mainLayout->addWidget(textEdit);
groupBox->setLayout(mainLayout);
setCentralWidget(groupBox);
but when I try to build, I get:  error: C2664: 'QBoxLayout::addWidget' : cannot convert parameter 1 from 'Viewer' to 'QWidget *'
From what I can see in the ui code, the exact same command is used, and I can't see where the difference is:     vboxLayout->addWidget(viewer);, and the type isn't converted anywhere else.
Any ideas? Many thanks.
This line is very suspicious:
Viewer viewer = new Viewer(groupBox);
Try with:
Viewer *viewer = new Viewer(groupBox);
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论