简体   繁体   中英

QWindow Hint doesn't work

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM