quryo Posted November 27, 2018 Share Posted November 27, 2018 Hello, I'm building a tool where I need the global screen position from a local widget position (as I'm using a QCompleter). The usual way to do this seems to be with `QWidget::mapToGlobal`. However, the result seems to be always wrong. I believe this is because there is no full Qt widget hierarchy in the panel. For instance, when printing the `geometry()` QRect of the widget hierarchy of a panel that is on the right side of the screen, I never see the offset on the screen that the panel obviously has: mainWindow = hou.qt.mainWindow() curParent = self.parent() for i in range(0,30): if curParent is None: print("Stopping due to unparented") break if curParent == mainWindow: print("Stopping as main win reached") break print("cur ", i, ": ", str(curParent.geometry()), " mapped ", str(curParent.mapToGlobal(QtCore.QPoint(0,0)))) curParent = curParent.parent() results in ('cur ', 0, ': ', 'PySide.QtCore.QRect(9, 32, 589, 430)', ' mapped ', 'PySide.QtCore.QPoint(9, 32)') ('cur ', 1, ': ', 'PySide.QtCore.QRect(0, 0, 607, 471)', ' mapped ', 'PySide.QtCore.QPoint(0, 0)') ('cur ', 2, ': ', 'PySide.QtCore.QRect(0, 0, 607, 471)', ' mapped ', 'PySide.QtCore.QPoint(0, 0)') Stopping due to unparented This is in Houdini 16.5.439. I'd appreciate any pointers on how to get the Houdini-internal view hierarchy or to get parenting work properly. Cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.