Hi,
I am facing issue while try to create a 3D widget in paraview. While i create a QLabel and make it a child of parent then it is coming at the bottom of parent widget. I want have the image (QLabel) inside the parent. Following is a snippet of code.
myMainWindow::myMainWindow(QWidget* parentObject, Qt::WindowFlags wflags)
: Superclass(parentObject, wflags)
{
Ui::myMainWindow ui;
ui.setupUi(this);
setWindowTitle(tr(“Paraview Application”));
lineEdit = new QLineEdit;
imageLabel = new QLabel(this);
imageLabel->setBackgroundRole(QPalette::NoRole);
//imageLabel->setFrameStyle(QFrame::Box | QFrame::Raised);
imageLabel->setWindowFlag(Qt::Tool);
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
QImageReader reader("C:\\Users\\Z662413\\Desktop\\car1.jpg");
newImage = reader.read();
imageLabel->setPixmap(QPixmap::fromImage(newImage));
imageLabel->setAttribute(Qt::WA_OpaquePaintEvent);
imageLabel->setAlignment(Qt::AlignHCenter);
// Make a connection to the builtin server
pqApplicationCore* core = pqApplicationCore::instance();
core->getObjectBuilder()->createServer(pqServerResource(“builtin:”));
// Create render view
pqRenderView* view =
qobject_cast<pqRenderView*>(pqApplicationCore::instance()->getObjectBuilder()->createView(
pqRenderView::renderViewType(), pqActiveObjects::instance().activeServer()));
pqActiveObjects::instance().setActiveView(view);
// Set it as the central widget
this->setCentralWidget(view->widget());
QWidget* centralWdiget = this->centralWidget();
QLayout* layout = centralWdiget->layout();
layout->addWidget(imageLabel);
this->setCentralWidget(imageLabel);
}