本文整理汇总了C++中MythUIType::CanTakeFocus方法的典型用法代码示例。如果您正苦于以下问题:C++ MythUIType::CanTakeFocus方法的具体用法?C++ MythUIType::CanTakeFocus怎么用?C++ MythUIType::CanTakeFocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythUIType
的用法示例。
在下文中一共展示了MythUIType::CanTakeFocus方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetArea
/** \brief Return the first MythUIType which accepts focus found at the given
* coordinates
*
* \param p QPoint coordinates
* \param recursive Whether to perform a recursive search
*
* \return The widget at these coordinates
*/
MythUIType *MythUIType::GetChildAt(const QPoint &p, bool recursive,
bool focusable) const
{
if (GetArea().contains(p))
{
if (!IsVisible() || !IsEnabled())
return NULL;
if (m_ChildrenList.isEmpty())
return NULL;
/* check all children */
QList<MythUIType *>::const_iterator it;
for (it = m_ChildrenList.end() - 1; it != m_ChildrenList.begin() - 1; --it)
{
if (!(*it))
continue;
// If this point doesn't fall within the child's area then move on
// This requires that the area is actually accurate and in some
// cases this still isn't true
if (!(*it)->GetArea().contains(p - GetArea().topLeft()))
continue;
MythUIType *child = *it;
if (recursive && (focusable && !child->CanTakeFocus()))
child = child->GetChildAt(p - GetArea().topLeft(), recursive,
focusable);
if (child)
{
// NOTE: Assumes no selectible ui type will contain another
// selectible ui type.
if (focusable && !child->CanTakeFocus())
continue;
return child;
}
}
}
return NULL;
}
示例2: GetArea
/** \brief Return the first MythUIType which accepts focus found at the given
* coordinates
*
* \param p QPoint coordinates
* \param recursive Whether to perform a recursive search
*
* \return The widget at these coordinates
*/
MythUIType *MythUIType::GetChildAt(const QPoint &p, bool recursive,
bool focusable) const
{
if (GetArea().contains(p))
{
if (!IsVisible() || !IsEnabled())
return NULL;
if (m_ChildrenList.isEmpty())
return NULL;
/* check all children */
QList<MythUIType *>::const_iterator it;
for (it = m_ChildrenList.end() - 1; it != m_ChildrenList.begin() - 1; --it)
{
if (!(*it))
continue;
MythUIType *child = NULL;
if ((*it)->GetArea().contains(p - GetArea().topLeft()))
child = *it;
if (!child && recursive)
child = (*it)->GetChildAt(p - GetArea().topLeft(), recursive,
focusable);
if (child)
{
// NOTE: Assumes no selectible ui type will contain another
// selectible ui type.
if (focusable && !child->CanTakeFocus())
continue;
return child;
}
}
}
return NULL;
}
示例3: SetFocusWidget
bool MythScreenType::SetFocusWidget(MythUIType *widget)
{
if (!widget || !widget->IsVisible())
{
QMap<int, MythUIType *>::iterator it = m_FocusWidgetList.begin();
MythUIType *current;
while (it != m_FocusWidgetList.end())
{
current = *it;
if (current->CanTakeFocus() && current->IsVisible())
{
widget = current;
break;
}
++it;
}
}
if (!widget)
return false;
if (m_CurrentFocusWidget == widget)
return true;
MythUIText *helpText = dynamic_cast<MythUIText *>(GetChild("helptext"));
if (helpText)
helpText->Reset();
if (m_CurrentFocusWidget)
m_CurrentFocusWidget->LoseFocus();
m_CurrentFocusWidget = widget;
m_CurrentFocusWidget->TakeFocus();
if (helpText && !widget->GetHelpText().isEmpty())
helpText->SetText(widget->GetHelpText());
return true;
}