Wong
18th May 2011, 07:34
Hi guys:
I got a problem that seems to be very strange. I want to write a media player with some dll, argument is window HWND. So I input QFrame::winId(). That qframe is child of qmainwindow.
MainWindow::MainWindow(QWidget *parent):
QMainWindow(parent)
{
this->setupUi(this);
m_hwnd = this->viewPage->winId(); //viewPage is a QFrame
...
}
It works properly.
6441
but when I write like this
MainWindow::MainWindow(QWidget* parent):
QMainWindow(parent)
{
...
this->setWindowFlags(Qt::WindowMinimizeButtonHint | Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground, true);
m_hwnd = this->viewPage->winId();
...
}
It doesn't work. I don't know why...
6439
I think winId() is invalid if does not have the frame. So I try to new other QFrame and setWindowFlags.
MainWindow::MainWindow(QWidget *parent):
QMainWindow(parent)
{
...
this->setWindowFlags(Qt::WindowMinimizeButtonHint | Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground, true);
QFrame* frame= new QFrame();
frame->setWindowFlags(Qt::FramelessWindowHint);
frame->show();
m_hwnd = frame->winId();
...
}
It's OK, although QFrame out of the QMainWindow.
6440
Now, I want custom titlebar. And get frame winId to play file...
I do not know where to begin, and unable to perceive where the problem lay.
Please, help me.
Thanks.
I got a problem that seems to be very strange. I want to write a media player with some dll, argument is window HWND. So I input QFrame::winId(). That qframe is child of qmainwindow.
MainWindow::MainWindow(QWidget *parent):
QMainWindow(parent)
{
this->setupUi(this);
m_hwnd = this->viewPage->winId(); //viewPage is a QFrame
...
}
It works properly.
6441
but when I write like this
MainWindow::MainWindow(QWidget* parent):
QMainWindow(parent)
{
...
this->setWindowFlags(Qt::WindowMinimizeButtonHint | Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground, true);
m_hwnd = this->viewPage->winId();
...
}
It doesn't work. I don't know why...
6439
I think winId() is invalid if does not have the frame. So I try to new other QFrame and setWindowFlags.
MainWindow::MainWindow(QWidget *parent):
QMainWindow(parent)
{
...
this->setWindowFlags(Qt::WindowMinimizeButtonHint | Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground, true);
QFrame* frame= new QFrame();
frame->setWindowFlags(Qt::FramelessWindowHint);
frame->show();
m_hwnd = frame->winId();
...
}
It's OK, although QFrame out of the QMainWindow.
6440
Now, I want custom titlebar. And get frame winId to play file...
I do not know where to begin, and unable to perceive where the problem lay.
Please, help me.
Thanks.