Пример #1
0
void QmlInputWidget::completeNick()
{
  // Attention: This is a Hack/Workaround!
  // Turning the focus on/off fixes a problem with a bug related to predictive
  // text (the text fragment proposed by the dictionary stays visible even
  // after the auto completion. makes things look buggy)
  bool oldFocus = hasFocus();
  setWidgetFocus(false);

  _presenter->completeNick();

  if(oldFocus)
    setWidgetFocus(true);
}
Пример #2
0
void KNWidgetSwitcher::setCurrentIndex(int currentIndex)
{
    if(currentIndex==m_currentIndex)
    {
        return;
    }
    if(currentIndex>=0 && currentIndex<m_widgets.size())
    {
        m_switchAnime->stop();
        m_flyOutAnime->setTargetObject(m_widgets.at(m_currentIndex));
        m_flyInAnime->setTargetObject(m_widgets.at(currentIndex));
        QRect centerRect=rect(),
              leftRect=QRect(-centerRect.width(),
                             0,
                             centerRect.width(),
                             centerRect.height()),
              rightRect=QRect(centerRect.width(),
                              0,
                              centerRect.width(),
                              centerRect.height());
        m_flyOutAnime->setStartValue(centerRect);
        m_flyInAnime->setEndValue(centerRect);
        if(currentIndex > m_currentIndex)
        {
            //This widget is after the current, move left.
            m_flyOutAnime->setEndValue(leftRect);
            m_flyInAnime->setStartValue(rightRect);
        }
        else
        {
            //Move right.
            m_flyOutAnime->setEndValue(rightRect);
            m_flyInAnime->setStartValue(leftRect);
        }
        m_movedOutPage = m_currentIndex;
        setWidgetVisible(currentIndex, true);
        setWidgetFocus(currentIndex);
        m_switchAnime->start();
        m_currentIndex = currentIndex;
    }
}