PDA

View Full Version : QWidget::winId() can not get the right window handle



ponponfish
17th May 2011, 07:17
I want to know my window handle, QWidget::winId() return one window handle, then I run Spy++ to check, these two window handle number is different, do I use the wrong method?
How to obtain window handle?

ChrisW67
17th May 2011, 07:20
That's the correct method... make sure you have the correct widget.

ponponfish
17th May 2011, 07:45
Following is my steps:
1. qDebug<<"winId() is"<< winId();
2. build and run, then I have one empty window
3. I can see debug message: winId() is 0x1117c
4. run Spy++, and I can see this window id is: Window 0001117E "Test" QWidget

why is that?