bool PageView::readUp()
{
  if( atTop() )
    return false;
  else {
    // Coordinate of the top of the viewport
    int top = contentsY();

    DocumentWidget* widget = 0;
    // Find the widget(s) that intersect the top of the viewport
    // TODO: It would be better to use a binary search.
    for(Q_UINT16 i=0; i<widgetList->size(); i++)
    {
      widget = widgetList->at(i);
      if (childY(widget) < top && childY(widget) + widget->height() > top)
      {
        // Draw scrollguide
        widget->drawScrollGuide(top - childY(widget));
      }
    }

    int newValue = QMAX( verticalScrollBar()->value() - (int)(height() * 0.9),
                         verticalScrollBar()->minValue() );
    verticalScrollBar()->setValue( newValue );
    return true;
  }
}
Exemple #2
0
void Hand::setMotor(float power) {
	if(atTop() && power < 0.0) { power = 0.0; }
	tal_a->Set(power);
}