Problem with QWidget->mapToGlobal()
Hi If i open the window menu (alt+f3) with the mouse the window shows up in the top left corner of my screen. The reason is that the following code from workspace/kwin/libkdecorations/kcommondecoration.cpp line 706 QRect menuRect = m_button[MenuButton]->rect(); QPoint menutop = m_button[MenuButton]->mapToGlobal(menuRect.topLeft()); QPoint menubottom = m_button[MenuButton]-> mapToGlobal(menuRect.bottomRight()) + QPoint(0, 2); KDecorationFactory* f = factory(); showWindowMenu(QRect(menutop, menubottom)); The mapToGlobal() call is supposed to map the coordinates to screen coordinates as far i can see. But it does not do that. It always returns some small values like (gdb) p menubottom $2 = {xp = 23, yp = 24} I could even say always those values because it looks like the menu is always on the same spot. I have a two screen setup here. That could be related. Any ideas what is wrong here? Mike
Re: Problem with QWidget->mapToGlobal()
On Tuesday 26 July 2011 09:34:57 Michael Jansen wrote: > The mapToGlobal() call is supposed to map the coordinates to screen > coordinates as far i can see. But it does not do that. It always returns > some small values like We've seen this fail in Kontact mobile in situations where the widget was embedded in a graphicsview, directly or indirectly. Could be totally unrelated, of course, just thought I'd mention it. Fixed in Qt, I believe, back then. Till
Re: Problem with QWidget->mapToGlobal()
I have the same problem with master and Qt 4.7. Clicking the windeco icon on a window which is on either screen results in the menu displaying as far left on the left screen, and the top of the screen + (heightOfTitlebar) it seems. Simply right-clicking the titlebar itself results in an incorrect offset (resulting in it being on the left-most screen at the top. The difference is that the first one is statically always at left-top. The second case (sort of) follows the x axis of the titlebar, but at the top. Anyways, ran it through gdb just for curiousity's sake and yeah mapToGlobal isn't giving what one might expect. Does the widget need a parent or something? Because other uses of it seem pretty similar to this one, yet they work fine. or is this some qt/x bug? -- Shaun Reich, KDE Software Developer (kde.org)
Re: Problem with QWidget->mapToGlobal()
On 26/07/2011 22:55, Shaun Reich wrote: I have the same problem with master and Qt 4.7. Clicking the windeco icon on a window which is on either screen results in the menu displaying as far left on the left screen, and the top of the screen + (heightOfTitlebar) it seems. Simply right-clicking the titlebar itself results in an incorrect offset (resulting in it being on the left-most screen at the top. The difference is that the first one is statically always at left-top. The second case (sort of) follows the x axis of the titlebar, but at the top. Anyways, ran it through gdb just for curiousity's sake and yeah mapToGlobal isn't giving what one might expect. Does the widget need a parent or something? Because other uses of it seem pretty similar to this one, yet they work fine. or is this some qt/x bug? It has also been noticed here: http://developer.qt.nokia.com/forums/viewthread/7980/ where the reporter seems to think that (on embedded at least) there was a byte->pixel conversion missing in some cases. Sean -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.