Skip to content

Commit

Permalink
Make "shrink" an attribute of minsize for textareas, instead of an el…
Browse files Browse the repository at this point in the history
…ement

shrink only makes sense in combination with minsize, so make it an
attribute.

Also fix an off-by-one error resulting because MythPoint starts at 0, while
QSize starts at 1 (for a valid value).
  • Loading branch information
jpoet committed Jun 2, 2011
1 parent 31ad01a commit 74a2cbd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions mythtv/libs/libmythui/mythuitext.cpp
Expand Up @@ -688,11 +688,6 @@ bool MythUIText::ParseElement(
{
m_TemplateText = parseText(element);
}
else if (element.tagName() == "shrink")
{
// When minsize is used, select if are should be made narrow or short
m_ShrinkNarrow = (parseText(element).toLower() != "short");
}
else if (element.tagName() == "cutdown")
{
SetCutDown(parseBool(element));
Expand Down Expand Up @@ -768,6 +763,11 @@ bool MythUIText::ParseElement(
}
else
{
if (element.tagName() == "minsize" && element.hasAttribute("shrink"))
{
m_ShrinkNarrow = (element.attribute("shrink")
.toLower() != "short");
}
return MythUIType::ParseElement(filename, element, showWarnings);
}

Expand Down
8 changes: 6 additions & 2 deletions mythtv/libs/libmythui/mythuitype.cpp
Expand Up @@ -687,11 +687,15 @@ void MythUIType::SetMinArea(const QSize &size)
* The MinArea will have the same origin as the normal Area,
* but can have a smaller size.
*/
QSize minsize = QSize(m_MinSize.x(), m_MinSize.y());
QSize minsize = QSize(m_MinSize.x() + 1, m_MinSize.y() + 1);

QSize bounded(size);

bounded = bounded.expandedTo(minsize);
if (bounded.isNull())
bounded = minsize;
else
bounded = bounded.expandedTo(minsize);

bounded = bounded.boundedTo(m_Area.size());

if (bounded == m_MinArea.size())
Expand Down

0 comments on commit 74a2cbd

Please sign in to comment.