本文整理汇总了C++中MythRect::y方法的典型用法代码示例。如果您正苦于以下问题:C++ MythRect::y方法的具体用法?C++ MythRect::y怎么用?C++ MythRect::y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythRect
的用法示例。
在下文中一共展示了MythRect::y方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseElement
/**
* \copydoc MythUIType::ParseElement()
*/
bool MythScreenType::ParseElement(
const QString &filename, QDomElement &element, bool showWarnings)
{
if (element.tagName() == "area")
{
MythRect rect = parseRect(element, false);
MythRect rectN = parseRect(element);
QRect screenArea = GetMythMainWindow()->GetUIScreenRect();
if (rect.x() == -1)
rectN.moveLeft((screenArea.width() - rectN.width()) / 2);
if (rect.y() == -1)
rectN.moveTop((screenArea.height() - rectN.height()) / 2);
SetArea(rectN);
if (m_Area.width() < screenArea.width() ||
m_Area.height() < screenArea.height())
{
m_FullScreen = false;
}
else
{
m_FullScreen = true;
}
}
else
{
return MythUIType::ParseElement(filename, element, showWarnings);
}
return true;
}
示例2: Create
bool MythUIVirtualKeyboard::Create()
{
if (!LoadWindowFromXML("keyboard/keyboard.xml", "keyboard", this))
return false;
BuildFocusList();
loadKeyDefinitions(gCoreContext->GetLanguageAndVariant());
updateKeys(true);
int screenWidth, screenHeight;
float xmult, ymult;
GetMythUI()->GetScreenSettings(screenWidth, xmult, screenHeight, ymult);
MythRect editArea = m_parentEdit->GetArea();
MythRect area = GetArea();
MythPoint newPos;
//FIXME this assumes the edit is a direct child of the parent screen
MythUIType *parentScreen = NULL;
parentScreen = dynamic_cast<MythUIType *>(m_parentEdit->parent());
if (parentScreen)
{
editArea.moveTopLeft(QPoint(editArea.x() + parentScreen->GetArea().x(),
editArea.y() + parentScreen->GetArea().y()));
}
switch (m_preferredPos)
{
case VK_POSABOVEEDIT:
if (editArea.y() - area.height() - 5 > 0)
{
newPos = QPoint(editArea.x() + editArea.width() / 2 - area.width() / 2,
editArea.y() - area.height() - 5);
}
else
{
newPos = QPoint(editArea.x() + editArea.width() / 2 - area.width() / 2,
editArea.y() + editArea.height() + 5);
}
break;
case VK_POSTOPDIALOG:
newPos = QPoint(screenWidth / 2 - area.width() / 2, 5);
break;
case VK_POSBOTTOMDIALOG:
newPos = QPoint(screenWidth / 2 - area.width() / 2, screenHeight - 5 - area.height());
break;
case VK_POSCENTERDIALOG:
newPos = QPoint(screenWidth / 2 - area.width() / 2, screenHeight / 2 - area.height() / 2);
break;
default:
// VK_POSBELOWEDIT
if (editArea.y() + editArea.height() + area.height() + 5 < screenHeight)
{
newPos = QPoint(editArea.x() + editArea.width() / 2 - area.width() / 2,
editArea.y() + editArea.height() + 5);
}
else
{
newPos = QPoint(editArea.x() + editArea.width() / 2 - area.width() / 2,
editArea.y() - area.height() - 5);
}
break;
}
// make sure the popup doesn't go off screen
if (newPos.x() < 5)
newPos.setX(5);
if (newPos.x() + area.width() + 5 > screenWidth)
newPos.setX(screenWidth - area.width() - 5);
if (newPos.y() < 5)
newPos.setY(5);
if (newPos.y() + area.height() + 5 > screenHeight)
newPos.setY(screenHeight - area.height() - 5);
SetPosition(newPos);
return true;
}
示例3: SetMinAreaParent
/**
* Adjust the size of sibling objects within the button.
*/
void MythUIType::SetMinAreaParent(MythRect actual_area, MythRect allowed_area,
const MythUIType *calling_child)
{
int delta_x = 0, delta_y = 0;
MythRect area;
// If a minsize is not set, don't use MinArea
if (!m_MinSize.isValid())
return;
m_MinArea.setWidth(0);
if (m_Area.width() < m_NormalSize.width())
m_Area.setWidth(m_NormalSize.width());
if (m_Area.height() < m_NormalSize.height())
m_Area.setHeight(m_NormalSize.height());
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.topLeft());
allowed_area.translate(m_Area.topLeft());
QList<MythUIType *>::iterator it;
for (it = m_ChildrenList.begin(); it != m_ChildrenList.end(); ++it)
{
if (*it == calling_child || !(*it)->m_Initiator)
continue;
// Find union of area(s)
area = (*it)->GetArea();
area.translate(m_Area.topLeft());
actual_area = actual_area.united(area);
area = (*it)->m_Area;
area.translate(m_Area.topLeft());
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 = (actual_area.x() + actual_area.width()) -
(m_Area.x() + m_Area.width());
delta_y = (actual_area.y() + actual_area.height()) -
(m_Area.y() + m_Area.height());
}
else
{
delta_x = (actual_area.x() + actual_area.width()) -
(allowed_area.x() + allowed_area.width());
delta_y = (actual_area.y() + actual_area.height()) -
(allowed_area.y() + 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);
}
area = (*it)->GetArea();
area.translate(m_Area.topLeft());
actual_area = actual_area.united(area);
}
QSize bound(actual_area.width(), actual_area.height());
if (m_Vanished)
{
m_MinArea.moveLeft(0);
//.........这里部分代码省略.........