Problem with QWidget->mapToGlobal()

Michael Jansen kde at michael-jansen.biz
Tue Jul 26 08:34:57 BST 2011


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






More information about the kde-core-devel mailing list