Results 1 to 3 of 3

Thread: QWidget::winId() can not get the right window handle

  1. #1
    Join Date
    Apr 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QWidget::winId() can not get the right window handle

    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?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QWidget::winId() can not get the right window handle

    That's the correct method... make sure you have the correct widget.

  3. #3
    Join Date
    Apr 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWidget::winId() can not get the right window handle

    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?

Similar Threads

  1. Getting the handle of the window
    By Luc4 in forum Qt Programming
    Replies: 13
    Last Post: 16th May 2010, 12:02
  2. Replies: 16
    Last Post: 15th March 2010, 11:22
  3. Embedding SDL in a QWidget That is not a Window
    By PhilippB in forum Qt Programming
    Replies: 0
    Last Post: 21st August 2008, 11:17
  4. Replies: 7
    Last Post: 17th July 2008, 21:47
  5. Problem with the QWidget::winId() method
    By yellowmat in forum Qt Programming
    Replies: 5
    Last Post: 22nd April 2008, 12:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.