Skip to content

Commit

Permalink
MythScreenType: Fix the area of a pop-up.
Browse files Browse the repository at this point in the history
We use a position of (-1, -1) to indicate that a pop-up should be centered.
To center the pop-up we need to move the whole rectangle, not
just the edge.  Qt's setX and setY position the edge of the rectangle,
leaving the other edges alone.  To move the whole rectangle, we need to use
QRect's move functions, instead of the set functions.

This fixes sub-elements use of percentages, since the area is now correct.
  • Loading branch information
jpoet committed Jul 11, 2011
1 parent 44a519e commit e717a49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mythtv/libs/libmythui/mythscreentype.cpp
Expand Up @@ -505,10 +505,10 @@ bool MythScreenType::ParseElement(
QRect screenArea = GetMythMainWindow()->GetUIScreenRect();

if (rect.x() == -1)
rectN.setX((screenArea.width() - rectN.width()) / 2);
rectN.moveLeft((screenArea.width() - rectN.width()) / 2);

if (rect.y() == -1)
rectN.setY((screenArea.height() - rectN.height()) / 2);
rectN.moveTop((screenArea.height() - rectN.height()) / 2);

SetArea(rectN);

Expand Down

0 comments on commit e717a49

Please sign in to comment.