本文整理汇总了C++中MythRect::setRect方法的典型用法代码示例。如果您正苦于以下问题:C++ MythRect::setRect方法的具体用法?C++ MythRect::setRect怎么用?C++ MythRect::setRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythRect
的用法示例。
在下文中一共展示了MythRect::setRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetMinAreaParent
/**
* Adjust the size of sibling objects within the button.
*/
void MythUIType::SetMinAreaParent(MythRect actual_area, MythRect allowed_area,
MythUIType *calling_child)
{
int delta_x = 0, delta_y = 0, delta_w = 0, delta_h = 0;
MythRect area;
// If a minsize is not set, don't use MinArea
if (!m_MinSize.isValid())
return;
if (calling_child->m_Vanished)
{
actual_area.moveLeft(0);
actual_area.moveTop(0);
allowed_area.moveLeft(0);
allowed_area.moveTop(0);
}
actual_area.translate(m_Area.x(), m_Area.y());
allowed_area.translate(m_Area.x(), m_Area.y());
QList<MythUIType *>::iterator it;
for (it = m_ChildrenList.begin(); it != m_ChildrenList.end(); ++it)
{
if (*it == calling_child || !(*it)->m_Initiator)
continue;
if (!(*it)->m_Vanished)
{
// Find union of area(s)
area = (*it)->GetArea();
area.translate(m_Area.x(), m_Area.y());
actual_area = actual_area.united(area);
area = (*it)->m_Area;
area.translate(m_Area.x(), m_Area.y());
allowed_area = allowed_area.united(area);
}
}
// Make sure it is not larger than the area allowed
actual_area = actual_area.intersected(m_Area);
allowed_area = allowed_area.intersected(m_Area);
if (m_Vanish && actual_area.size().isNull())
{
m_Vanished = true;
}
else
{
if (calling_child->m_Vanished)
{
delta_x = m_Area.x() - actual_area.x();
delta_y = m_Area.y() - actual_area.y();
delta_w = actual_area.width() - m_Area.width();
delta_h = actual_area.height() - m_Area.height();
}
else
{
delta_x = allowed_area.x() - actual_area.x();
delta_y = allowed_area.y() - actual_area.y();
delta_w = actual_area.width() - allowed_area.width();
delta_h = actual_area.height() - allowed_area.height();
}
m_Vanished = false;
}
for (it = m_ChildrenList.begin(); it != m_ChildrenList.end(); ++it)
{
if (*it == calling_child)
continue;
if (!(*it)->m_Initiator)
{
if (m_Vanished)
(*it)->VanishSibling();
else
(*it)->AdjustMinArea(delta_x, delta_y, delta_w, delta_h);
}
area = (*it)->GetArea();
area.translate(m_Area.topLeft());
actual_area = actual_area.united(area);
}
if (m_Vanished)
{
m_MinArea.setRect(0, 0, 0, 0);
actual_area.setRect(0, 0, 0, 0);
}
else
{
QSize bound(actual_area.width(), actual_area.height());
bound = bound.expandedTo(GetMinSize());
//.........这里部分代码省略.........