I've tried to hide the bar of an QWindow object, but it doesn't work. The aim is, to show a scene from Ogre3D over an QWindows object in a MDI Area.
This is the code in the MainWindow:
ui->setupUi(this);
QWindow *pcwindow = new QWindow();
pcwindow->setHeight(ui->side->height());
pcwindow->setWidth(ui->side->width());
pcwindow->setFlags(Qt::Window | Qt::CustomizeWindowHint);
pcwindow->setFlags(Qt::Window | Qt::FramelessWindowHint);
app = new TutorialApplication;
try
{
app->Windowheight = pcwindow->height();
app->Windowwidth = pcwindow->width();
app->WindowsID = pcwindow->winId();
app->go();
}catch(Ogre::Exception& e) {
...
}
QWidget *container = QWidget::createWindowContainer(pcwindow);
container->setMinimumHeight(pcwindow->height());
container->setMinimumWidth(pcwindow->width());
container->setWindowFlags(Qt::SubWindow | Qt::CustomizeWindowHint);
ui->side->addSubWindow(container);
QTimer *timer = new QTimer(this);
timer->setInterval(10);
timer->start();
connect(timer, SIGNAL (timeout()), app, SLOT (RenderOneFrame()));
And it looks like this Screenshot
Does somebody know what is wrong? Thank you for your support.
Okay, I've found it. When you are using the
ui->side->addSubWindow(container);
command, you have to declare the WindowsFlag directly in addSubWindow. In my case this helps: Change:
ui->side->addSubWindow(container)
to
ui->side->addSubWindow(container,Qt::SubWindow | Qt::FramelessWindowHint);